# Copyright (C) 1995, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.23 1995-11-27 09:56:18 adam Exp $
+# $Id: Makefile,v 1.24 1995-11-27 13:58:53 adam Exp $
SHELL=/bin/sh
RANLIB=ranlib
-YAZLIB=-lyaz
-#YAZINC=-I../../yaz/include
-OSILIB=../../xtimosi/src/libmosi.a -lrfc
+YAZLIB=../../yaz/lib/libyaz.a
+YAZINC=-I../../yaz/include
+OSILIB=../../xtimosi/src/libmosi.a ../../yaz/lib/librfc.a
#NETLIB=-lnsl -lsocket
INCLUDE=-I../include $(YAZINC)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.19 1995-11-25 10:24:06 adam
+ * Revision 1.20 1995-11-27 13:58:53 adam
+ * New option -t. storeStore data implemented in server.
+ *
+ * Revision 1.19 1995/11/25 10:24:06 adam
* More record fields - they are enumerated now.
* New options: flagStoreData flagStoreKey.
*
rGroup.fileMatch = NULL;
rGroup.flagStoreData = -1;
rGroup.flagStoreKeys = -1;
+ rGroup.fileType = NULL;
prog = *argv;
if (argc < 2)
" [-g group] cmd1 dir1 cmd2 dir2 ...\n");
exit (1);
}
- while ((ret = options ("c:g:v:m:d:", argv, argc, &arg)) != -2)
+ while ((ret = options ("t:c:g:v:m:d:", argv, argc, &arg)) != -2)
{
if (ret == 0)
{
}
else if (ret == 'c')
configName = arg;
+ else if (ret == 't')
+ rGroup.fileType = arg;
else
{
logf (LOG_FATAL, "Unknown option '-%s'", arg);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.26 1995-11-25 10:24:07 adam
+ * Revision 1.27 1995-11-27 13:58:54 adam
+ * New option -t. storeStore data implemented in server.
+ *
+ * Revision 1.26 1995/11/25 10:24:07 adam
* More record fields - they are enumerated now.
* New options: flagStoreData flagStoreKey.
*
return &r;
}
-static int record_read (int fd, char *buf, size_t count)
+static int record_ext_read (int fd, char *buf, size_t count)
{
return read (fd, buf, count);
}
+static int record_int_pos;
+static char *record_int_buf;
+static int record_int_len;
+
+static int record_int_read (int fd, char *buf, size_t count)
+{
+ int l = record_int_len - record_int_pos;
+ if (l <= 0)
+ return 0;
+ l = (l < count) ? l : count;
+ memcpy (buf, record_int_buf + record_int_pos, l);
+ record_int_buf += l;
+ return l;
+}
+
static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream,
oid_value input_format, Z_RecordComposition *comp,
oid_value *output_format, char **rec_bufp,
exit (1);
}
logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score);
- if ((retrieveCtrl.fd = open (fname, O_RDONLY)) == -1)
+ if (rec->size[recInfo_storeData] > 0)
{
- char *msg = "Record doesn't exist";
- logf (LOG_WARN|LOG_ERRNO, "Retrieve: Open record file %s", fname);
- *output_format = VAL_SUTRS;
- *rec_bufp = msg;
- *rec_lenp = strlen (msg);
- rec_rm (&rec);
- return 0; /* or 14: System error in presenting records */
+ retrieveCtrl.readf = record_int_read;
+ record_int_len = rec->size[recInfo_storeData];
+ record_int_buf = rec->info[recInfo_storeData];
+ record_int_pos = 0;
+ }
+ else
+ {
+ if ((retrieveCtrl.fd = open (fname, O_RDONLY)) == -1)
+ {
+ char *msg = "Record doesn't exist";
+ logf (LOG_WARN|LOG_ERRNO, "Retrieve: Open record file %s", fname);
+ *output_format = VAL_SUTRS;
+ *rec_bufp = msg;
+ *rec_lenp = strlen (msg);
+ rec_rm (&rec);
+ return 0; /* or 14: System error in presenting records */
+ }
+ retrieveCtrl.readf = record_ext_read;
}
retrieveCtrl.localno = sysno;
retrieveCtrl.score = score;
retrieveCtrl.odr = stream;
- retrieveCtrl.readf = record_read;
retrieveCtrl.input_format = retrieveCtrl.output_format = input_format;
retrieveCtrl.comp = comp;
retrieveCtrl.diagnostic = 0;