From 10e178572346e8c5c3caaa43b803dd10c005cb5f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 21 May 1999 12:00:17 +0000 Subject: [PATCH] Better diagnostics for extraction process. --- configure | 52 +++++++++++++++++++++++++++------------------------- configure.in | 4 +++- include/recctrl.h | 9 ++++++++- index/extract.c | 15 ++++++++++----- recctrl/recgrs.c | 33 +++++++++++++++++++++------------ recctrl/rectext.c | 7 +++++-- recctrl/sgmlread.c | 8 ++++---- 7 files changed, 78 insertions(+), 50 deletions(-) diff --git a/configure b/configure index 5ccddee..83a0dac 100755 --- a/configure +++ b/configure @@ -1020,17 +1020,19 @@ echo "configure:1009: checking for Tcl" >&5 SHLIB_VERSION=$TCL_SHLIB_VERSION echo "$ac_t""$TCL_VERSION" 1>&6 ODEFS="-DHAVE_TCL_H=1" +else + ODEFS="-DHAVE_TCL_H=0" fi # # sockets checkBoth=0 echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1029: checking for connect" >&5 +echo "configure:1031: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1074,7 +1076,7 @@ fi if test "$ac_cv_func_connect" = "no"; then echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:1078: checking for main in -lsocket" >&5 +echo "configure:1080: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1082,14 +1084,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1115,12 +1117,12 @@ if test "$checkBoth" = "1"; then oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:1119: checking for accept" >&5 +echo "configure:1121: checking for accept" >&5 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_accept=yes" else @@ -1165,12 +1167,12 @@ fi fi echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1169: checking for gethostbyname" >&5 +echo "configure:1171: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1211,7 +1213,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:1215: checking for main in -lnsl" >&5 +echo "configure:1217: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1219,14 +1221,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1251,7 +1253,7 @@ fi # # tcpd wrapper echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6 -echo "configure:1255: checking for main in -lwrap" >&5 +echo "configure:1257: checking for main in -lwrap" >&5 ac_lib_var=`echo wrap'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1259,14 +1261,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lwrap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1289,12 +1291,12 @@ fi # # headers echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1293: checking for ANSI C header files" >&5 +echo "configure:1295: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1302,7 +1304,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1319,7 +1321,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1337,7 +1339,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1358,7 +1360,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1369,7 +1371,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else diff --git a/configure.in b/configure.in index 492aa2c..2c0dc13 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ # Zebra, Index Data Aps, 1994-1999 -# $Id: configure.in,v 1.6 1999-05-21 11:08:46 adam Exp $ +# $Id: configure.in,v 1.7 1999-05-21 12:00:17 adam Exp $ # See the file LICENSE.2 for details. # AC_INIT(include/zebraver.h) @@ -42,6 +42,8 @@ if test -r ${tclconfig}/tclConfig.sh; then SHLIB_VERSION=$TCL_SHLIB_VERSION AC_MSG_RESULT($TCL_VERSION) ODEFS="-DHAVE_TCL_H=1" +else + ODEFS="-DHAVE_TCL_H=0" fi # # sockets diff --git a/include/recctrl.h b/include/recctrl.h index 15b7597..44d4618 100644 --- a/include/recctrl.h +++ b/include/recctrl.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: recctrl.h,v $ - * Revision 1.29 1999-05-20 12:57:18 adam + * Revision 1.30 1999-05-21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.29 1999/05/20 12:57:18 adam * Implemented TCL filter. Updated recctrl system. * * Revision 1.28 1999/03/02 16:15:42 quinn @@ -186,6 +189,10 @@ struct recType struct recRetrieveCtrl *ctrl); /* Retrieve proc */ }; +#define RECCTRL_EXTRACT_OK 0 +#define RECCTRL_EXTRACT_EOF 1 +#define RECCTRL_EXTRACT_ERROR 2 + typedef struct recTypes *RecTypes; RecTypes recTypes_init (data1_handle dh); diff --git a/index/extract.c b/index/extract.c index d235a44..da261e2 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.94 1999-05-20 12:57:18 adam + * Revision 1.95 1999-05-21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.94 1999/05/20 12:57:18 adam * Implemented TCL filter. Updated recctrl system. * * Revision 1.93 1999/05/15 14:36:38 adam @@ -1297,14 +1300,16 @@ static int recordExtract (SYSNO *sysno, const char *fname, log_event_start (NULL, NULL); - if (r) - { + if (r == RECCTRL_EXTRACT_EOF) + return 0; + else if (r == RECCTRL_EXTRACT_ERROR) + { /* error occured during extraction ... */ if (rGroup->flagRw && records_processed < rGroup->fileVerboseLimit) { - logf (LOG_WARN, "fail %s %s %ld code = %d", rGroup->recordType, - fname, (long) recordOffset, r); + logf (LOG_WARN, "fail %s %s %ld", rGroup->recordType, + fname, (long) recordOffset); } return 0; } diff --git a/recctrl/recgrs.c b/recctrl/recgrs.c index a8ed698..e4c910a 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: recgrs.c,v $ - * Revision 1.27 1999-05-20 12:57:18 adam + * Revision 1.28 1999-05-21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.27 1999/05/20 12:57:18 adam * Implemented TCL filter. Updated recctrl system. * * Revision 1.26 1999/03/02 16:15:44 quinn @@ -201,8 +204,9 @@ struct grs_handlers { struct grs_handler *handlers; }; -static data1_node *read_grs_type (struct grs_handlers *h, - struct grs_read_info *p, const char *type) +static int read_grs_type (struct grs_handlers *h, + struct grs_read_info *p, const char *type, + data1_node **root) { struct grs_handler *gh = h->handlers; const char *cp = strchr (type, '.'); @@ -218,19 +222,18 @@ static data1_node *read_grs_type (struct grs_handlers *h, { if (!memcmp (type, gh->type->type, cp-type)) { - data1_node *node; if (!gh->initFlag) { gh->initFlag = 1; gh->clientData = (*gh->type->init)(); } p->clientData = gh->clientData; - node = (gh->type->read)(p); + *root = (gh->type->read)(p); gh->clientData = p->clientData; - return node; + return 0; } } - return NULL; + return 1; } static void grs_add_handler (struct grs_handlers *h, RecTypeGrs t) @@ -416,9 +419,10 @@ static int grs_extract(void *clientData, struct recExtractCtrl *p) gri.mem = mem; gri.dh = p->dh; - n = read_grs_type (h, &gri, p->subType); + if (read_grs_type (h, &gri, p->subType, &n)) + return RECCTRL_EXTRACT_ERROR; if (!n) - return -1; + return RECCTRL_EXTRACT_EOF; oe.proto = PROTO_Z3950; oe.oclass = CLASS_SCHEMA; @@ -429,11 +433,11 @@ static int grs_extract(void *clientData, struct recExtractCtrl *p) if (dumpkeys(n, p, 0) < 0) { data1_free_tree(p->dh, n); - return -2; + return RECCTRL_EXTRACT_ERROR; } data1_free_tree(p->dh, n); nmem_destroy(mem); - return 0; + return RECCTRL_EXTRACT_OK; } /* @@ -532,7 +536,12 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) gri.dh = p->dh; logf (LOG_DEBUG, "grs_retrieve"); - node = read_grs_type (h, &gri, p->subType); + if (read_grs_type (h, &gri, p->subType, &node)) + { + p->diagnostic = 14; + nmem_destroy (mem); + return 0; + } if (!node) { p->diagnostic = 14; diff --git a/recctrl/rectext.c b/recctrl/rectext.c index 6d36db3..24d1c63 100644 --- a/recctrl/rectext.c +++ b/recctrl/rectext.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: rectext.c,v $ - * Revision 1.10 1999-05-20 12:57:18 adam + * Revision 1.11 1999-05-21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.10 1999/05/20 12:57:18 adam * Implemented TCL filter. Updated recctrl system. * * Revision 1.9 1998/10/16 08:14:38 adam @@ -145,7 +148,7 @@ static int text_extract (void *clientData, struct recExtractCtrl *p) } } while (r > 0); buf_close (fi); - return 0; + return RECCTRL_EXTRACT_OK; } static int text_retrieve (void *clientData, struct recRetrieveCtrl *p) diff --git a/recctrl/sgmlread.c b/recctrl/sgmlread.c index 79e7e6f..4fa9780 100644 --- a/recctrl/sgmlread.c +++ b/recctrl/sgmlread.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: sgmlread.c,v $ - * Revision 1.6 1999-05-20 12:57:18 adam + * Revision 1.7 1999-05-21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.6 1999/05/20 12:57:18 adam * Implemented TCL filter. Updated recctrl system. * * Revision 1.5 1999/02/02 14:51:31 adam @@ -31,19 +34,16 @@ static data1_node *grs_read_sgml (struct grs_read_info *p) { - logf (LOG_LOG, "grs_read_sgml"); return data1_read_record (p->dh, p->readf, p->fh, p->mem); } static void *grs_init_sgml() { - logf (LOG_LOG, "grs_init_gsml"); return 0; } static void grs_destroy_sgml(void *clientData) { - logf (LOG_LOG, "grs_destroy_sgml"); } static struct recTypeGrs sgml_type = { -- 1.7.10.4