* 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 $
*
*/
#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)))
/*
* 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 */
/* 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
/* 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);
/* 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);
/* ----------------------------------------------------------- */
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
* 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 <stdio.h>
{
int ret;
- nmem_init ();
#ifdef WIN32
/* We need to initialize the thread list */
ThreadList_Initialize();
yaz_log(LOG_LOG, "Entering event loop.");
ret = event_loop(&pListener);
}
- nmem_exit ();
return ret;
}
* 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
}
}
+
+#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
# 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
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
Z3950DIR=$(SRCDIR)\Z39.50
ILLDIR=$(SRCDIR)\ill
CCLDIR=$(SRCDIR)\ccl
+ZOOMDIR=$(SRCDIR)\zoom
CLIENTDIR=$(SRCDIR)\CLIENT
SERVERDIR=$(SRCDIR)\SERVER
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)
###########################################################
DLL_LINK_OPTIONS= /dll
CLIENT_LINK_OPTIONS = /subsystem:console
+ZOOMSH_LINK_OPTIONS = /subsystem:console
SERVER_LINK_OPTIONS = -lib
ZTEST_LINK_OPTIONS = /subsystem:console
$(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" \
$(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 \
YAZ_ZUTIL_OBJS= \
$(OBJDIR)\diagbib1.obj \
$(OBJDIR)\zget.obj \
- $(OBJDIR)\prt-ext.obj \
$(OBJDIR)\logrpn.obj \
$(OBJDIR)\pquery.obj \
$(OBJDIR)\yaz-ccl.obj \
$(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) \
$(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)
$(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
generated_files: \
$(GENERATED_H_FILES) \
$(GENERATED_C_FILES) \
- $(PROTOH)
-
###########################################################
############### Compiling
{$(CCLDIR)}.c{$(OBJDIR)}.obj:
$(CPP) $(COPT) $<
+{$(ZOOMDIR)}.c{$(OBJDIR)}.obj:
+ $(CPP) $(COPT) $<
+
############### ASN-generated files
!if $(HAVE_TCL)
<<
$(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
- @echo Linking the client $(CLIENT)
+ @echo Linking $(CLIENT)
$(LINK) @<<
$(LNKOPT)
$(CLIENT_LINK_OPTIONS)
/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) @<<
del $(DLL)
del $(CLIENT)
del $(ZTEST)
+ del $(ZOOMSH)
del $(TMPDIR)\*.
del $(LIBDIR)\*.MAP
del $(LIBDIR)\*.LIB
del $(OBJDIR)\*.OBJ
- del $(PROTOH)
-
realclean: clean
del $(Z3950_C_DIR)\*.c
del $(Z3950_C_DIR)\*.h
############### 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
###########################################################
#
# $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
//
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
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
/*
- * $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.
*/
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);
}
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)
{
#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)
}
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;
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;
FD_ZERO (&input);
FD_ZERO (&output);
+ FD_ZERO (&except);
r = 0;
for (i = 0; i<no; i++)
{
FD_SET (fd, &output);
r++;
}
+ if (mask & Z3950_SELECT_EXCEPT)
+ {
+ FD_SET (fd, &except);
+ r++;
+ }
}
if (!r)
{
yaz_log (LOG_DEBUG, "no more events");
return 0;
}
- r = select (max_fd+1, &input, &output, 0, &tv);
+ yaz_log (LOG_DEBUG, "select start");
+ r = select (max_fd+1, &input, &output, &except, &tv);
+ yaz_log (LOG_DEBUG, "select stop, returned r=%d", r);
for (i = 0; i<no; i++)
{
mask += Z3950_SELECT_READ;
if (FD_ISSET(fd, &output))
mask += Z3950_SELECT_WRITE;
+ if (FD_ISSET(fd, &except))
+ mask += Z3950_SELECT_EXCEPT;
if (mask)
Z3950_connection_do_io(c, mask);
}
/*
* Private C header for ZOOM C.
- * $Id: zoom-p.h,v 1.1 2001-10-23 21:00:20 adam Exp $
+ * $Id: zoom-p.h,v 1.2 2001-10-24 12:24:43 adam Exp $
*/
#include <yaz/proto.h>
#include <yaz/comstack.h>
#define Z3950_SELECT_READ 1
#define Z3950_SELECT_WRITE 2
+#define Z3950_SELECT_EXCEPT 4
struct Z3950_connection_p {
COMSTACK cs;
/*
- * $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
*/
#include <string.h>
#include <ctype.h>
-#define HAVE_READLINE_READLINE_H 1
-#define HAVE_READLINE_HISTORY_H 1
-
#if HAVE_READLINE_READLINE_H
#include <readline/readline.h>
#endif
while (*cp == ' ')
cp++;
*t_start = cp;
- while (*cp && *cp != ' ')
+ while (*cp && *cp != ' ' && *cp != '\r' && *cp != '\n')
{
cp++;
len++;
/*
- * $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 <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <yaz/xmalloc.h>
/*
- * $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 <stdio.h>
+#include <string.h>
+
#include <yaz/nmem.h>
#include <yaz/xmalloc.h>
-
#include <yaz/zoom.h>
const char *my_callback (void *handle, const char *name)
Z3950_search s;
Z3950_options o;
- nmem_init ();
-
o = Z3950_options_create ();
if (argc < 4)
{
Z3950_connection_destroy (z[i]);
}
Z3950_options_destroy(o);
- nmem_exit ();
- xmalloc_trav("");
- exit (0);
}
/*
- * $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
*/
Z3950_search s;
Z3950_options o;
- nmem_init ();
-
o = Z3950_options_create ();
if (argc < 4)
{
Z3950_resultset_destroy (r2[i]);
}
Z3950_options_destroy(o);
- nmem_exit ();
- xmalloc_trav("");
exit (0);
}
/*
- * $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..
*/
Z3950_resultset r[10]; /* and result sets .. */
Z3950_options o;
- nmem_init ();
-
o = Z3950_options_create ();
for (block = 0; block < 3; block++)
}
}
Z3950_options_destroy (o);
- nmem_exit ();
- xmalloc_trav("");
-
exit (0);
}