From bc66c2a11aa31c16f46c49100e99dc9b7e940faf Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 24 Oct 2001 12:24:43 +0000 Subject: [PATCH] WIN32 updates: ZOOM runs, nmem_init/nmem_exit called in DllMain. --- client/client.c | 3 +- include/yaz/zoom.h | 44 ++++++++++- server/statserv.c | 4 +- util/nmem.c | 22 +++++- win/makefile | 213 ++++++++++++++++++++++++++++++++++++++-------------- win/yaz.rc | 8 +- zoom/zoom-c.c | 41 ++++++---- zoom/zoom-p.h | 3 +- zoom/zoomsh.c | 7 +- zoom/zoomtst3.c | 3 +- zoom/zoomtst5.c | 10 +-- zoom/zoomtst6.c | 6 +- zoom/zoomtst7.c | 7 +- 13 files changed, 263 insertions(+), 108 deletions(-) diff --git a/client/client.c b/client/client.c index 774a08b..244ba5f 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2001, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.127 2001-08-08 19:35:06 adam Exp $ + * $Id: client.c,v 1.128 2001-10-24 12:24:43 adam Exp $ * */ @@ -1919,7 +1919,6 @@ static void initialize(void) #if YAZ_MODULE_ccl FILE *inf; #endif - nmem_init(); if (!(out = odr_createmem(ODR_ENCODE)) || !(in = odr_createmem(ODR_DECODE)) || !(print = odr_createmem(ODR_PRINT))) diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index 67e389e..36f0022 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -1,6 +1,6 @@ /* * Public header for ZOOM C. - * $Id: zoom.h,v 1.1 2001-10-23 21:00:19 adam Exp $ + * $Id: zoom.h,v 1.2 2001-10-24 12:24:43 adam Exp $ */ /* the types we use */ @@ -20,35 +20,45 @@ typedef struct Z3950_record_p *Z3950_record; /* create connection, connect to host, if portnum is 0, then port is read from host string (e.g. myhost:9821) */ +YAZ_EXPORT Z3950_connection Z3950_connection_new (const char *host, int portnum); /* create connection, don't connect, apply options */ +YAZ_EXPORT Z3950_connection Z3950_connection_create (Z3950_options options); /* connect given existing connection */ +YAZ_EXPORT void Z3950_connection_connect(Z3950_connection c, const char *host, int portnum); /* destroy connection (close connection also *) */ +YAZ_EXPORT void Z3950_connection_destroy (Z3950_connection c); /* set option for connection */ +YAZ_EXPORT const char *Z3950_connection_option (Z3950_connection c, const char *key, const char *val); /* return host for connection */ +YAZ_EXPORT const char *Z3950_connection_host (Z3950_connection c); /* return error code (0 == success, failure otherwise). cp holds error string on failure, addinfo holds addititional info (if any) */ +YAZ_EXPORT int Z3950_connection_error (Z3950_connection c, const char **cp, const char **addinfo); /* returns error code */ +YAZ_EXPORT int Z3950_connection_errcode (Z3950_connection c); /* returns error message */ +YAZ_EXPORT const char *Z3950_connection_errmsg (Z3950_connection c); /* returns additional info */ +YAZ_EXPORT const char *Z3950_connection_addinfo (Z3950_connection c); #define Z3950_ERROR_NONE 0 @@ -65,51 +75,66 @@ const char *Z3950_connection_addinfo (Z3950_connection c); /* result sets */ /* create result set given a search */ +YAZ_EXPORT Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_search q); /* create result set given PQF query */ +YAZ_EXPORT Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q); /* destroy result set */ +YAZ_EXPORT void Z3950_resultset_destroy(Z3950_resultset r); /* result set option */ +YAZ_EXPORT const char *Z3950_resultset_option (Z3950_resultset r, const char *key, const char *val); /* return size of result set (hit count, AKA resultCount) */ +YAZ_EXPORT int Z3950_resultset_size (Z3950_resultset r); /* return record at pos (starting from ), render given spec in type */ +YAZ_EXPORT void *Z3950_resultset_get (Z3950_resultset s, int pos, const char *type, int *len); /* retrieve records */ +YAZ_EXPORT void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs, size_t *cnt); /* return record object at pos. Returns 0 if unavailable */ +YAZ_EXPORT Z3950_record Z3950_resultset_record (Z3950_resultset s, int pos); /* like Z3950_resultset_record - but never blocks .. */ +YAZ_EXPORT Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, int pos); /* ----------------------------------------------------------- */ /* records */ /* Get record information, in a form given by type */ +YAZ_EXPORT void *Z3950_record_get (Z3950_record rec, const char *type, int *len); /* Destroy record */ +YAZ_EXPORT void Z3950_record_destroy (Z3950_record rec); /* ----------------------------------------------------------- */ /* searches */ /* create search object */ +YAZ_EXPORT Z3950_search Z3950_search_create(void); /* destroy it */ +YAZ_EXPORT void Z3950_search_destroy(Z3950_search s); /* specify prefix query for search */ +YAZ_EXPORT int Z3950_search_prefix(Z3950_search s, const char *str); /* specify sort criteria for search */ +YAZ_EXPORT int Z3950_search_sortby(Z3950_search s, const char *criteria); @@ -117,16 +142,32 @@ int Z3950_search_sortby(Z3950_search s, const char *criteria); /* options */ typedef const char *(*Z3950_options_callback)(void *handle, const char *name); +YAZ_EXPORT Z3950_options_callback Z3950_options_set_callback (Z3950_options opt, Z3950_options_callback c, void *handle); +YAZ_EXPORT Z3950_options Z3950_options_create (void); + +YAZ_EXPORT Z3950_options Z3950_options_create_with_parent (Z3950_options parent); + +YAZ_EXPORT const char *Z3950_options_get (Z3950_options opt, const char *name); + +YAZ_EXPORT void Z3950_options_set (Z3950_options opt, const char *name, const char *v); + +YAZ_EXPORT void Z3950_options_destroy (Z3950_options opt); + +YAZ_EXPORT int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa); + +YAZ_EXPORT int Z3950_options_get_int (Z3950_options opt, const char *name, int defa); + +YAZ_EXPORT void Z3950_options_addref (Z3950_options opt); /* ----------------------------------------------------------- */ @@ -136,6 +177,7 @@ void Z3950_options_addref (Z3950_options opt); events are pending. The positive integer specifies the connection for which the event occurred. There's no way to get the details yet, sigh. */ +YAZ_EXPORT int Z3950_event (int no, Z3950_connection *cs); YAZ_END_CDECL diff --git a/server/statserv.c b/server/statserv.c index 4329b77..cecc6b1 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -6,7 +6,7 @@ * NT server based on threads by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.77 2001-10-05 14:43:22 adam Exp $ + * $Id: statserv.c,v 1.78 2001-10-24 12:24:43 adam Exp $ */ #include @@ -671,7 +671,6 @@ int statserv_start(int argc, char **argv) { int ret; - nmem_init (); #ifdef WIN32 /* We need to initialize the thread list */ ThreadList_Initialize(); @@ -739,7 +738,6 @@ int statserv_start(int argc, char **argv) yaz_log(LOG_LOG, "Entering event loop."); ret = event_loop(&pListener); } - nmem_exit (); return ret; } diff --git a/util/nmem.c b/util/nmem.c index 131ab1e..358d7a6 100644 --- a/util/nmem.c +++ b/util/nmem.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: nmem.c,v $ - * Revision 1.30 2001-10-05 13:55:17 adam + * Revision 1.31 2001-10-24 12:24:43 adam + * WIN32 updates: ZOOM runs, nmem_init/nmem_exit called in DllMain. + * + * Revision 1.30 2001/10/05 13:55:17 adam * Added defines YAZ_GNU_THREADS, YAZ_POSIX_THREADS in code and yaz-config * * Revision 1.29 2001/10/04 00:37:58 adam @@ -509,3 +512,20 @@ void nmem_exit (void) } } + +#ifdef WIN32 +BOOL WINAPI DllMain (HINSTANCE hinstDLL, + DWORD reason, + LPVOID reserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + nmem_init (); + break; + case DLL_PROCESS_DETACH: + nmem_exit (); + } + return TRUE; +} +#endif \ No newline at end of file diff --git a/win/makefile b/win/makefile index 1f60dfa..acf07e5 100644 --- a/win/makefile +++ b/win/makefile @@ -1,5 +1,5 @@ # makefile.mak - makefile for MS NMAKE -# $Id: makefile,v 1.26 2001-09-27 12:09:18 adam Exp $ +# $Id: makefile,v 1.27 2001-10-24 12:24:43 adam Exp $ # # Programmed by # HL: Heikki Levanto, Index Data @@ -25,13 +25,9 @@ DEBUG=1 # 0 for release, 1 for debug -NEW_Z3950=1 # 0= use old asn files - # 1= generate files from *.asn (needs tcl) - - default: all -all: dirs yaz_date_h proto_h dll client ztest +all: dirs yaz_date_h dll client ztest zoomsh generate: generated_files @@ -59,6 +55,7 @@ RETDIR=$(SRCDIR)\RETRIEVAL Z3950DIR=$(SRCDIR)\Z39.50 ILLDIR=$(SRCDIR)\ill CCLDIR=$(SRCDIR)\ccl +ZOOMDIR=$(SRCDIR)\zoom CLIENTDIR=$(SRCDIR)\CLIENT SERVERDIR=$(SRCDIR)\SERVER @@ -76,15 +73,25 @@ DLL=$(BINDIR)\Yaz.dll IMPLIB=$(LIBDIR)\Yaz.lib CLIENT=$(BINDIR)\yaz-client.exe +ZOOMSH=$(BINDIR)\zoomsh.exe ZTEST=$(BINDIR)\yaz-ztest.exe -PROTOH=$(INCLDIR)\yaz\proto.h YAZ_DATE_H=$(INCLDIR)\yaz\yaz-date.h +ZOOMTST1=$(BINDIR)\zoomtst1.exe +ZOOMTST2=$(BINDIR)\zoomtst2.exe +ZOOMTST3=$(BINDIR)\zoomtst3.exe +ZOOMTST4=$(BINDIR)\zoomtst4.exe +ZOOMTST5=$(BINDIR)\zoomtst5.exe +ZOOMTST6=$(BINDIR)\zoomtst6.exe +ZOOMTST7=$(BINDIR)\zoomtst7.exe + + # shortcut names defined here dll : $(DLL) client: $(CLIENT) ztest: $(ZTEST) -proto_h: $(PROTOH) +zoomsh: $(ZOOMSH) $(ZOOMTST1) $(ZOOMTST2) $(ZOOMTST3) \ + $(ZOOMTST4) $(ZOOMTST5) $(ZOOMTST6) $(ZOOMTST7) yaz_date_h: $(YAZ_DATE_H) ########################################################### @@ -151,6 +158,7 @@ RELEASE_LNK_OPTIONS= /pdb:none DLL_LINK_OPTIONS= /dll CLIENT_LINK_OPTIONS = /subsystem:console +ZOOMSH_LINK_OPTIONS = /subsystem:console SERVER_LINK_OPTIONS = -lib ZTEST_LINK_OPTIONS = /subsystem:console @@ -190,6 +198,24 @@ YAZ_CLIENT_OBJS= \ $(OBJDIR)\client.obj \ $(OBJDIR)\admin.obj +YAZ_ZOOMSH_OBJS = \ + $(OBJDIR)\zoomsh.obj + +YAZ_ZOOMTST1_OBJS = \ + $(OBJDIR)\zoomtst1.obj +YAZ_ZOOMTST2_OBJS = \ + $(OBJDIR)\zoomtst2.obj +YAZ_ZOOMTST3_OBJS = \ + $(OBJDIR)\zoomtst3.obj +YAZ_ZOOMTST4_OBJS = \ + $(OBJDIR)\zoomtst4.obj +YAZ_ZOOMTST5_OBJS = \ + $(OBJDIR)\zoomtst5.obj +YAZ_ZOOMTST6_OBJS = \ + $(OBJDIR)\zoomtst6.obj +YAZ_ZOOMTST7_OBJS = \ + $(OBJDIR)\zoomtst7.obj + YAZ_SERVER_OBJS= \ "$(OBJDIR)\eventl.obj" \ "$(OBJDIR)\requestq.obj" \ @@ -211,20 +237,6 @@ YAZ_CCL_OBJS= \ $(OBJDIR)\cclstr.obj \ $(OBJDIR)\ccltoken.obj -YAZ_ASN_OBJS= \ - $(OBJDIR)\proto.obj \ - $(OBJDIR)\prt-acc.obj \ - $(OBJDIR)\prt-add.obj \ - $(OBJDIR)\prt-arc.obj \ - $(OBJDIR)\prt-dat.obj \ - $(OBJDIR)\prt-dia.obj \ - $(OBJDIR)\prt-esp.obj \ - $(OBJDIR)\prt-exd.obj \ - $(OBJDIR)\prt-exp.obj \ - $(OBJDIR)\prt-grs.obj \ - $(OBJDIR)\prt-rsc.obj \ - $(OBJDIR)\prt-univ.obj - YAZ_COMSTACK_OBJS= \ $(OBJDIR)\comstack.obj \ $(OBJDIR)\tcpip.obj \ @@ -275,7 +287,6 @@ YAZ_UTIL_OBJS= \ YAZ_ZUTIL_OBJS= \ $(OBJDIR)\diagbib1.obj \ $(OBJDIR)\zget.obj \ - $(OBJDIR)\prt-ext.obj \ $(OBJDIR)\logrpn.obj \ $(OBJDIR)\pquery.obj \ $(OBJDIR)\yaz-ccl.obj \ @@ -330,13 +341,18 @@ Z3950_OBJS= \ $(OBJDIR)\zes-pquery.obj \ $(OBJDIR)\zes-psched.obj \ $(OBJDIR)\zes-pset.obj \ - $(OBJDIR)\zes-update0.obj + $(OBJDIR)\zes-update0.obj \ + $(OBJDIR)\prt-ext.obj ILL_OBJS= \ $(OBJDIR)\ill-get.obj\ $(OBJDIR)\ill-core.obj\ $(OBJDIR)\item-req.obj +YAZ_ZOOM_OBJS = \ + $(OBJDIR)\zoom-c.obj \ + $(OBJDIR)\zoom-opt.obj + COMMON_YAZ_OBJS= \ $(YAZ_UTIL_OBJS) \ $(YAZ_ODR_OBJS) \ @@ -344,18 +360,13 @@ COMMON_YAZ_OBJS= \ $(YAZ_ZUTIL_OBJS) \ $(YAZ_CCL_OBJS) \ $(YAZ_RET_OBJS) \ - $(YAZ_SERVER_OBJS) + $(YAZ_SERVER_OBJS) \ + $(YAZ_ZOOM_OBJS) -!if $(NEW_Z3950) YAZ_OBJS= \ $(COMMON_YAZ_OBJS) \ $(Z3950_OBJS) \ $(ILL_OBJS) -!else -YAZ_OBJS= \ - $(COMMON_YAZ_OBJS) \ - $(YAZ_ASN_OBJS) -!endif DLL_OBJS= $(YAZ_OBJS) @@ -364,27 +375,11 @@ ALL_OBJS= \ $(YAZ_CLIENT_OBJS) \ $(ZTEST_OBJS) - -########################################################## -############## proto.h -########################################################## - -!if $(NEW_Z3950) -$(PROTOH): $(INCLDIR)\yaz\z-proto.h - type $(INCLDIR)\yaz\z-proto.h > $(PROTOH) -!else -$(PROTOH): $(INCLDIR)\yaz\prt-proto.h - copy $(ASNDIR)\*.h $(INCLDIR)\yaz - type $(INCLDIR)\yaz\prt-proto.h > $(PROTOH) -!endif - - ########################################################### ############### Generated C and H files ##### ###################################################### - Z3950_C_DIR=$(Z3950DIR) ILL_C_DIR=$(ILLDIR) #!!! Should be moved to OBJ, but that requires too much trickery @@ -474,8 +469,6 @@ GENERATED_H_FILES= \ generated_files: \ $(GENERATED_H_FILES) \ $(GENERATED_C_FILES) \ - $(PROTOH) - ########################################################### ############### Compiling @@ -528,6 +521,9 @@ generated_files: \ {$(CCLDIR)}.c{$(OBJDIR)}.obj: $(CPP) $(COPT) $< +{$(ZOOMDIR)}.c{$(OBJDIR)}.obj: + $(CPP) $(COPT) $< + ############### ASN-generated files !if $(HAVE_TCL) @@ -616,7 +612,7 @@ $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS) $(YAZ_RES) << $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS) - @echo Linking the client $(CLIENT) + @echo Linking $(CLIENT) $(LINK) @<< $(LNKOPT) $(CLIENT_LINK_OPTIONS) @@ -628,6 +624,110 @@ $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS) /out:$(CLIENT) << +$(ZOOMSH) : "$(BINDIR)" $(YAZ_ZOOMSH_OBJS) + @echo Linking $(ZOOMSH) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMSH_OBJS) + /pdb:"$(LIBDIR)\zoomsh.pdb" + /map:"$(LIBDIR)\zoomsh.map" + /out:$(ZOOMSH) +<< + +$(ZOOMTST1) : "$(BINDIR)" $(YAZ_ZOOMTST1_OBJS) + @echo Linking $(ZOOMTST1) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST1_OBJS) + /pdb:"$(LIBDIR)\zoomtst1.pdb" + /map:"$(LIBDIR)\zoomtst1.map" + /out:$(ZOOMTST1) +<< + +$(ZOOMTST2) : "$(BINDIR)" $(YAZ_ZOOMTST2_OBJS) + @echo Linking $(ZOOMTST2) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST2_OBJS) + /pdb:"$(LIBDIR)\zoomtst2.pdb" + /map:"$(LIBDIR)\zoomtst2.map" + /out:$(ZOOMTST2) +<< + +$(ZOOMTST3) : "$(BINDIR)" $(YAZ_ZOOMTST3_OBJS) + @echo Linking $(ZOOMTST3) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST3_OBJS) + /pdb:"$(LIBDIR)\zoomtst3.pdb" + /map:"$(LIBDIR)\zoomtst3.map" + /out:$(ZOOMTST3) +<< + +$(ZOOMTST4) : "$(BINDIR)" $(YAZ_ZOOMTST4_OBJS) + @echo Linking $(ZOOMTST4) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST4_OBJS) + /pdb:"$(LIBDIR)\zoomtst4.pdb" + /map:"$(LIBDIR)\zoomtst4.map" + /out:$(ZOOMTST4) +<< + +$(ZOOMTST5) : "$(BINDIR)" $(YAZ_ZOOMTST5_OBJS) + @echo Linking $(ZOOMTST5) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST5_OBJS) + /pdb:"$(LIBDIR)\zoomtst5.pdb" + /map:"$(LIBDIR)\zoomtst5.map" + /out:$(ZOOMTST5) +<< + +$(ZOOMTST6) : "$(BINDIR)" $(YAZ_ZOOMTST6_OBJS) + @echo Linking $(ZOOMTST6) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST6_OBJS) + /pdb:"$(LIBDIR)\zoomtst6.pdb" + /map:"$(LIBDIR)\zoomtst6.map" + /out:$(ZOOMTST6) +<< + +$(ZOOMTST7) : "$(BINDIR)" $(YAZ_ZOOMTST7_OBJS) + @echo Linking $(ZOOMTST7) + $(LINK) @<< + $(LNKOPT) + $(ZOOMSH_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_ZOOMTST7_OBJS) + /pdb:"$(LIBDIR)\zoomtst7.pdb" + /map:"$(LIBDIR)\zoomtst7.map" + /out:$(ZOOMTST7) +<< + $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(DLL) @echo Linking the ztest $(ZTEST) $(LINK) @<< @@ -656,6 +756,7 @@ clean: del $(DLL) del $(CLIENT) del $(ZTEST) + del $(ZOOMSH) del $(TMPDIR)\*. del $(LIBDIR)\*.MAP @@ -663,8 +764,6 @@ clean: del $(LIBDIR)\*.LIB del $(OBJDIR)\*.OBJ - del $(PROTOH) - realclean: clean del $(Z3950_C_DIR)\*.c del $(Z3950_C_DIR)\*.h @@ -689,17 +788,12 @@ $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR): ############### Explicit dependencies ########################################################### -$(ALL_OBJS): $(PROTOH) - # force recompilation of everything, if makefile changed $(Z3950_OBJS): $(GENERATED_C_FILES) $(GENERATED_H_FILES) $(ILL_OBJS): $(ILL_CORE_FILES) $(ITEM_REQ_FILES) -!if $(NEW_Z3950) -$(PROTOH): $(GENERATED_C_FILES) $(GENERATED_H_FILES) -!endif # makes sure we generate before compiling anything, as the # new proto.h refers to the generated files, and is included # in various places @@ -709,7 +803,10 @@ $(PROTOH): $(GENERATED_C_FILES) $(GENERATED_H_FILES) ########################################################### # # $Log: makefile,v $ -# Revision 1.26 2001-09-27 12:09:18 adam +# Revision 1.27 2001-10-24 12:24:43 adam +# WIN32 updates: ZOOM runs, nmem_init/nmem_exit called in DllMain. +# +# Revision 1.26 2001/09/27 12:09:18 adam # Function nmem_exit calls oid_exit (when reference is 0). # # Revision 1.25 2001/09/24 21:51:56 adam diff --git a/win/yaz.rc b/win/yaz.rc index 5ea1dbd..c48e2a1 100644 --- a/win/yaz.rc +++ b/win/yaz.rc @@ -54,8 +54,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,0,11 - PRODUCTVERSION 1,7,0,11 + FILEVERSION 1,7,0,12 + PRODUCTVERSION 1,7,0,12 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -73,14 +73,14 @@ BEGIN VALUE "Comments", "Z39.50 C Library\0" VALUE "CompanyName", "Index Data\0" VALUE "FileDescription", "YAZ Toolkit\0" - VALUE "FileVersion", "1, 7, 0, 11\0" + VALUE "FileVersion", "1, 7, 0, 12\0" VALUE "InternalName", "YAZ\0" VALUE "LegalCopyright", "Copyright © 1996-2001 Index Data\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "yaz.rc\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Index Data YAZ Toolkit\0" - VALUE "ProductVersion", "1, 7, 0, 11\0" + VALUE "ProductVersion", "1, 7, 0, 12\0" VALUE "SpecialBuild", "\0" END END diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index 51908f8..907aa2d 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoom-c.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -409,7 +409,7 @@ void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs, Z3950_resultset_retrieve (r, force_present, start, count); if (force_present) { - int i; + size_t i; for (i = 0; i< *cnt; i++) recs[i] = Z3950_resultset_record_immediate (r, i+start); } @@ -432,15 +432,18 @@ static void do_connect (Z3950_connection c) if (c->cs) { - cs_connect (c->cs, add); - c->state = STATE_CONNECTING; - c->mask = Z3950_SELECT_READ | Z3950_SELECT_WRITE; - } - else - { - c->state = STATE_IDLE; - c->error = Z3950_ERROR_CONNECT; + int ret = cs_connect (c->cs, add); + yaz_log (LOG_DEBUG, "cs_connect returned %d", ret); + if (ret >= 0) + { + c->state = STATE_CONNECTING; + c->mask = Z3950_SELECT_READ | Z3950_SELECT_WRITE | Z3950_SELECT_EXCEPT; + return; + } } + c->event_pending = 1; + c->state = STATE_IDLE; + c->error = Z3950_ERROR_CONNECT; } int z3950_connection_socket(Z3950_connection c) @@ -1293,7 +1296,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) { #if 0 int r = cs_look(c->cs); - yaz_log (LOG_LOG, "Z3950_connection_do_io c=%p mask=%d cs_look=%d", + yaz_log (LOG_DEBUG, "Z3950_connection_do_io c=%p mask=%d cs_look=%d", c, mask, r); if (r == CS_NONE) @@ -1303,7 +1306,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) } else if (r == CS_CONNECT) { - yaz_log (LOG_LOG, "calling rcvconnect"); + yaz_log (LOG_DEBUG, "calling rcvconnect"); if (cs_rcvconnect (c->cs) < 0) { c->error = Z3950_ERROR_CONNECT; @@ -1351,7 +1354,7 @@ int Z3950_connection_do_io(Z3950_connection c, int mask) int Z3950_event (int no, Z3950_connection *cs) { struct timeval tv; - fd_set input, output; + fd_set input, output, except; int i, r; int max_fd = 0; @@ -1370,6 +1373,7 @@ int Z3950_event (int no, Z3950_connection *cs) FD_ZERO (&input); FD_ZERO (&output); + FD_ZERO (&except); r = 0; for (i = 0; i #include @@ -20,6 +20,7 @@ struct Z3950_search_p { #define Z3950_SELECT_READ 1 #define Z3950_SELECT_WRITE 2 +#define Z3950_SELECT_EXCEPT 4 struct Z3950_connection_p { COMSTACK cs; diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 2f3897f..9f9d0e4 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -1,5 +1,5 @@ /* - * $Id: zoomsh.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomsh.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * ZOOM-C Shell */ @@ -9,9 +9,6 @@ #include #include -#define HAVE_READLINE_READLINE_H 1 -#define HAVE_READLINE_HISTORY_H 1 - #if HAVE_READLINE_READLINE_H #include #endif @@ -32,7 +29,7 @@ static int next_token (const char **cpp, const char **t_start) while (*cp == ' ') cp++; *t_start = cp; - while (*cp && *cp != ' ') + while (*cp && *cp != ' ' && *cp != '\r' && *cp != '\n') { cp++; len++; diff --git a/zoom/zoomtst3.c b/zoom/zoomtst3.c index d03bd62..b52d1d1 100644 --- a/zoom/zoomtst3.c +++ b/zoom/zoomtst3.c @@ -1,11 +1,12 @@ /* - * $Id: zoomtst3.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomtst3.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * Asynchronous multi-target client doing search and piggyback retrieval */ #include #include +#include #include diff --git a/zoom/zoomtst5.c b/zoom/zoomtst5.c index 4acb072..84e5819 100644 --- a/zoom/zoomtst5.c +++ b/zoom/zoomtst5.c @@ -1,13 +1,14 @@ /* - * $Id: zoomtst5.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomtst5.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * Asynchronous multi-target client doing search, sort and present */ #include +#include + #include #include - #include const char *my_callback (void *handle, const char *name) @@ -26,8 +27,6 @@ int main(int argc, char **argv) Z3950_search s; Z3950_options o; - nmem_init (); - o = Z3950_options_create (); if (argc < 4) { @@ -122,7 +121,4 @@ int main(int argc, char **argv) Z3950_connection_destroy (z[i]); } Z3950_options_destroy(o); - nmem_exit (); - xmalloc_trav(""); - exit (0); } diff --git a/zoom/zoomtst6.c b/zoom/zoomtst6.c index e3ea841..2745547 100644 --- a/zoom/zoomtst6.c +++ b/zoom/zoomtst6.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst6.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomtst6.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * Asynchronous multi-target client doing two searches */ @@ -43,8 +43,6 @@ int main(int argc, char **argv) Z3950_search s; Z3950_options o; - nmem_init (); - o = Z3950_options_create (); if (argc < 4) { @@ -114,7 +112,5 @@ int main(int argc, char **argv) Z3950_resultset_destroy (r2[i]); } Z3950_options_destroy(o); - nmem_exit (); - xmalloc_trav(""); exit (0); } diff --git a/zoom/zoomtst7.c b/zoom/zoomtst7.c index 939d8bc..0c5a659 100644 --- a/zoom/zoomtst7.c +++ b/zoom/zoomtst7.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst7.c,v 1.1 2001-10-23 21:00:20 adam Exp $ + * $Id: zoomtst7.c,v 1.2 2001-10-24 12:24:43 adam Exp $ * * API test.. */ @@ -20,8 +20,6 @@ int main(int argc, char **argv) Z3950_resultset r[10]; /* and result sets .. */ Z3950_options o; - nmem_init (); - o = Z3950_options_create (); for (block = 0; block < 3; block++) @@ -143,9 +141,6 @@ int main(int argc, char **argv) } } Z3950_options_destroy (o); - nmem_exit (); - xmalloc_trav(""); - exit (0); } -- 1.7.10.4