# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.25 1995-10-06 08:51:13 quinn Exp $
+# $Id: Makefile,v 1.26 1995-11-01 13:54:12 quinn Exp $
# Uncomment the lines below to enable mOSI communcation.
ODEFS=-DUSE_XTIMOSI
#CC=
SHELL=/bin/sh
MAKE=make
-SUBDIR=util odr asn $(RFC1006) ccl comstack client server makelib
+SUBDIR=util odr asn $(RFC1006) ccl comstack retrieval client server makelib
# Add external libraries to the ELIBS macro
ELIBS=
CONTROL=RANLIB="ranlib" ELIBS=$(ELIBS)
* Europagate, 1995
*
* $Log: cclfind.c,v $
- * Revision 1.3 1995-09-29 17:11:59 quinn
+ * Revision 1.4 1995-11-01 13:54:20 quinn
+ * Minor adjustments
+ *
+ * Revision 1.3 1995/09/29 17:11:59 quinn
* Smallish
*
* Revision 1.2 1995/09/27 15:02:44 quinn
static char *copy_token_name (struct ccl_token *tp)
{
- char *str = malloc (tp->len + 1);
+ char *str = xmalloc (tp->len + 1);
assert (str);
memcpy (str, tp->name, tp->len);
str[tp->len] = '\0';
static struct ccl_rpn_node *mk_node (enum rpn_node_kind kind)
{
struct ccl_rpn_node *p;
- p = malloc (sizeof(*p));
+ p = xmalloc (sizeof(*p));
assert (p);
p->kind = kind;
return p;
ccl_rpn_delete (rpn->u.p[1]);
break;
case CCL_RPN_TERM:
- free (rpn->u.t.term);
+ xfree (rpn->u.t.term);
for (attr = rpn->u.t.attr_list; attr; attr = attr1)
{
attr1 = attr->next;
- free (attr);
+ xfree (attr);
}
break;
case CCL_RPN_SET:
- free (rpn->u.setname);
+ xfree (rpn->u.setname);
break;
case CCL_RPN_PROX:
ccl_rpn_delete (rpn->u.p[0]);
ccl_rpn_delete (rpn->u.p[1]);
break;
}
- free (rpn);
+ xfree (rpn);
}
static struct ccl_rpn_node *find_spec (struct ccl_rpn_attr **qa);
{
struct ccl_rpn_attr *n;
- n = malloc (sizeof(*n));
+ n = xmalloc (sizeof(*n));
assert (n);
n->type = type;
n->value = value;
lookahead = lookahead->next;
}
p = mk_node (CCL_RPN_TERM);
- p->u.t.term = malloc (len);
+ p->u.t.term = xmalloc (len);
assert (p->u.t.term);
p->u.t.attr_list = NULL;
p->u.t.term[0] = '\0';
{
ccl_error = CCL_ERR_TRUNC_NOT_BOTH;
if (qa)
- free (qa);
+ xfree (qa);
ccl_rpn_delete (p);
return NULL;
}
{
ccl_error = CCL_ERR_TRUNC_NOT_RIGHT;
if (qa)
- free (qa);
+ xfree (qa);
ccl_rpn_delete (p);
return NULL;
}
{
ccl_error = CCL_ERR_TRUNC_NOT_LEFT;
if (qa)
- free (qa);
+ xfree (qa);
ccl_rpn_delete (p);
return NULL;
}
}
for (lookahead = look_token; lookahead != la; lookahead=lookahead->next)
no++;
- ap = malloc (no * sizeof(*ap));
+ ap = xmalloc (no * sizeof(*ap));
assert (ap);
for (i=0; look_token != la; i++)
{
if (!ap[i])
{
ccl_error = CCL_ERR_UNKNOWN_QUAL;
- free (ap);
+ xfree (ap);
return NULL;
}
ADVANCE;
if (KIND != CCL_TOK_EQ)
{
ccl_error = CCL_ERR_EQ_EXPECTED;
- free (ap);
+ xfree (ap);
return NULL;
}
ADVANCE;
ADVANCE;
if (!(p = find_spec (ap)))
{
- free (ap);
+ xfree (ap);
return NULL;
}
if (KIND != CCL_TOK_RP)
{
ccl_error = CCL_ERR_RP_EXPECTED;
ccl_rpn_delete (p);
- free (ap);
+ xfree (ap);
return NULL;
}
ADVANCE;
}
else
p = search_terms (ap);
- free (ap);
+ xfree (ap);
return p;
}
rel = 0;
add_attr (p1, CCL_BIB1_REL, 4);
p->u.p[1] = p2;
add_attr (p2, CCL_BIB1_REL, 2);
- free (ap);
+ xfree (ap);
return p;
}
else /* = term - */
{
add_attr (p1, CCL_BIB1_REL, 4);
- free (ap);
+ xfree (ap);
return p1;
}
}
else
{
add_attr (p1, CCL_BIB1_REL, rel);
- free (ap);
+ xfree (ap);
return p1;
}
}
ADVANCE;
p = search_term (ap);
add_attr (p, CCL_BIB1_REL, 2);
- free (ap);
+ xfree (ap);
return p;
}
ccl_error = CCL_ERR_TERM_EXPECTED;
}
- free (ap);
+ xfree (ap);
return NULL;
}
* Europagate, 1995
*
* $Log: cclqual.c,v $
- * Revision 1.3 1995-09-29 17:12:00 quinn
+ * Revision 1.4 1995-11-01 13:54:21 quinn
+ * Minor adjustments
+ *
+ * Revision 1.3 1995/09/29 17:12:00 quinn
* Smallish
*
* Revision 1.2 1995/09/27 15:02:44 quinn
break;
if (!q)
{
- struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual));
+ struct ccl_qualifier *new_qual = xmalloc (sizeof(*new_qual));
assert (new_qual);
new_qual->next = b->list;
b->list = new_qual;
- new_qual->name = malloc (strlen(name)+1);
+ new_qual->name = xmalloc (strlen(name)+1);
assert (new_qual->name);
strcpy (new_qual->name, name);
attrp = &new_qual->attr_list;
{
struct ccl_rpn_attr *attr;
- attr = malloc (sizeof(*attr));
+ attr = xmalloc (sizeof(*attr));
assert (attr);
attr->type = *pairs++;
attr->value = *pairs++;
CCL_bibset ccl_qual_mk (void)
{
- CCL_bibset b = malloc (sizeof(*b));
+ CCL_bibset b = xmalloc (sizeof(*b));
assert (b);
b->list = NULL;
return b;
* Europagate, 1995
*
* $Log: ccltoken.c,v $
- * Revision 1.3 1995-09-29 17:12:00 quinn
+ * Revision 1.4 1995-11-01 13:54:22 quinn
+ * Minor adjustments
+ *
+ * Revision 1.3 1995/09/29 17:12:00 quinn
* Smallish
*
* Revision 1.2 1995/09/27 15:02:44 quinn
}
if (!first)
{
- first = last = malloc (sizeof (*first));
+ first = last = xmalloc (sizeof (*first));
assert (first);
last->prev = NULL;
}
else
{
- last->next = malloc (sizeof(*first));
+ last->next = xmalloc (sizeof(*first));
assert (last->next);
last->next->prev = last;
last = last->next;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: tcpip.c,v $
- * Revision 1.7 1995-10-30 12:41:16 quinn
+ * Revision 1.8 1995-11-01 13:54:27 quinn
+ * Minor adjustments
+ *
+ * Revision 1.7 1995/10/30 12:41:16 quinn
* Added hostname lookup for server.
*
* Revision 1.6 1995/09/29 17:12:00 quinn
typedef struct tcpip_state
{
char *altbuf; /* alternate buffer for surplus data */
- int altsize; /* size as malloced */
+ int altsize; /* size as xmalloced */
int altlen; /* length of data or 0 if none */
int written; /* -1 if we aren't writing */
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
#endif
return 0;
- if (!(p = malloc(sizeof(struct comstack))))
+ if (!(p = xmalloc(sizeof(struct comstack))))
return 0;
- if (!(state = p->private = malloc(sizeof(tcpip_state))))
+ if (!(state = p->private = xmalloc(sizeof(tcpip_state))))
return 0;
#ifdef WINDOWS
if (!(p->blocking = blocking) && ioctlsocket(s, FIONBIO, &tru) < 0)
h->cerrno = CSOUTSTATE;
return 0;
}
- if (!(new = malloc(sizeof(*new))))
+ if (!(new = xmalloc(sizeof(*new))))
{
h->cerrno = CSYSERR;
return 0;
}
memcpy(new, h, sizeof(*h));
new->iofile = h->newfd;
- if (!(state = new->private = malloc(sizeof(tcpip_state))))
+ if (!(state = new->private = xmalloc(sizeof(tcpip_state))))
{
h->cerrno = CSYSERR;
return 0;
{
if (!*bufsize)
{
- if (!(*buf = malloc(*bufsize = CS_TCPIP_BUFCHUNK)))
+ if (!(*buf = xmalloc(*bufsize = CS_TCPIP_BUFCHUNK)))
return -1;
}
else if (*bufsize - hasread < CS_TCPIP_BUFCHUNK)
- if (!(*buf = realloc(*buf, *bufsize *= 2)))
+ if (!(*buf =xrealloc(*buf, *bufsize *= 2)))
return -1;
if ((res = recv(h->iofile, *buf + hasread, CS_TCPIP_BUFCHUNK, 0)) < 0)
#ifdef WINDOWS
req += CS_TCPIP_BUFCHUNK - rest;
if (!sp->altbuf)
{
- if (!(sp->altbuf = malloc(sp->altsize = req)))
+ if (!(sp->altbuf = xmalloc(sp->altsize = req)))
return -1;
} else if (sp->altsize < req)
- if (!(sp->altbuf = realloc(sp->altbuf, sp->altsize = req)))
+ if (!(sp->altbuf =xrealloc(sp->altbuf, sp->altsize = req)))
return -1;
TRC(fprintf(stderr, " Moving %d bytes to altbuf(0x%x)\n", tomove,
(unsigned) sp->altbuf));
TRC(fprintf(stderr, "tcpip_close\n"));
close(h->iofile);
if (sp->altbuf)
- free(sp->altbuf);
- free(sp);
- free(h);
+ xfree(sp->altbuf);
+ xfree(sp);
+ xfree(h);
return 0;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: xmosi.c,v $
- * Revision 1.7 1995-10-30 12:41:17 quinn
+ * Revision 1.8 1995-11-01 13:54:29 quinn
+ * Minor adjustments
+ *
+ * Revision 1.7 1995/10/30 12:41:17 quinn
* Added hostname lookup for server.
*
* Revision 1.6 1995/09/29 17:12:00 quinn
mosi_state *state;
int flags = O_RDWR;
- if (!(r = malloc(sizeof(*r))))
+ if (!(r = xmalloc(sizeof(*r))))
return 0;
- if (!(state = r->private = malloc(sizeof(*state))))
+ if (!(state = r->private = xmalloc(sizeof(*state))))
return 0;
state->call = 0;
*/
struct netbuf MDF *mosi_strtoaddr(const char *str)
{
- struct netbuf *ret = malloc(sizeof(struct netbuf));
- struct sockaddr_in *add = malloc(sizeof(struct sockaddr_in));
- struct t_mosiaddr *mosiaddr = malloc(sizeof(struct t_mosiaddr));
+ struct netbuf *ret = xmalloc(sizeof(struct netbuf));
+ struct sockaddr_in *add = xmalloc(sizeof(struct sockaddr_in));
+ struct t_mosiaddr *mosiaddr = xmalloc(sizeof(struct t_mosiaddr));
struct hostent *hp;
char *p, *b, buf[512], *nsap;
short int port = 102;
h->cerrno = CSOUTSTATE;
return 0;
}
- if (!(new = malloc(sizeof(*new))))
+ if (!(new = xmalloc(sizeof(*new))))
return 0;
*new = *h;
- if (!(new->private = ns = malloc(sizeof(*ns))))
+ if (!(new->private = ns = xmalloc(sizeof(*ns))))
return 0;
*ns = *st;
if (!h->blocking)
{
if (!*bufsize)
{
- if (!(*buf = malloc(*bufsize = CS_MOSI_BUFCHUNK)))
+ if (!(*buf = xmalloc(*bufsize = CS_MOSI_BUFCHUNK)))
return -1;
}
else if (*bufsize - ct->hasread < CS_MOSI_BUFCHUNK)
- if (!(*buf = realloc(*buf, *bufsize *= 2)))
+ if (!(*buf =xrealloc(*buf, *bufsize *= 2)))
return -1;
if ((res = u_rcv(h->iofile, *buf + ct->hasread, CS_MOSI_BUFCHUNK,
int mosi_close(COMSTACK h)
{
- free(h->private);
+ xfree(h->private);
if (h->iofile >= 0)
u_close(h->iofile);
- free(h);
+ xfree(h);
return 0;
}
* OF THIS SOFTWARE.
*
* $Log: comstack.h,v $
- * Revision 1.12 1995-10-30 12:41:27 quinn
+ * Revision 1.13 1995-11-01 13:54:33 quinn
+ * Minor adjustments
+ *
+ * Revision 1.12 1995/10/30 12:41:27 quinn
* Added hostname lookup for server.
*
* Revision 1.11 1995/09/29 17:12:01 quinn
#include <yconfig.h>
#include <oid.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#define COMSTACK_DEFAULT_TIMEOUT -1 /* not used yet */
--- /dev/null
+/*
+ * Copyright (c) 1995, Index Data.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef D1_ATTSET_H
+#define D1_ATTSET_H
+
+#include <oid.h>
+
+/*
+ * This structure describes a attset, perhaps made up by inclusion
+ * (supersetting) of other attribute sets. When indexing and searching,
+ * we perform a normalisation, where we associate a given tag with
+ * the set that originally defined it, rather than the superset. This
+ * allows the most flexible access. Eg, the tags common to GILS and BIB-1
+ * should be searchable by both names.
+ */
+
+struct data1_attset;
+
+typedef struct data1_att
+{
+ struct data1_attset *parent; /* attribute set */
+ char *name; /* symbolic name of this tag */
+ int value; /* tag value */
+ int local; /* local index value */
+ struct data1_att *next;
+} data1_att;
+
+typedef struct data1_attset
+{
+ char *name; /* symbolic name */
+ oid_value reference; /* external ID of attset */
+ int ordinal; /* attset identification in index */
+ data1_att *atts; /* attributes */
+ struct data1_attset *children; /* included attset */
+ struct data1_attset *next; /* sibling */
+} data1_attset;
+
+data1_att *data1_getattbyname(data1_attset *s, char *name);
+data1_attset *data1_read_attset(char *file);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 1995, Index Data.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef D1_MAP_H
+#define D1_MAP_H
+
+typedef struct data1_maptag
+{
+ int new_field;
+ int type;
+ enum
+ {
+ D1_MAPTAG_numeric,
+ D1_MAPTAG_string
+ } which;
+ union
+ {
+ int numeric;
+ char *string;
+ } value;
+ struct data1_maptag *next;
+} data1_maptag;
+
+typedef struct data1_mapunit
+{
+ int no_data;
+ char *source_element_name;
+ data1_maptag *target_path;
+ struct data1_mapunit *next;
+} data1_mapunit;
+
+typedef struct data1_maptab
+{
+ char *name;
+ oid_value target_absyn_ref;
+ char *target_absyn_name;
+ data1_mapunit *map;
+ struct data1_maptab *next;
+} data1_maptab;
+
+#endif
/*
- * Copyright (C) 1994, Index Data I/S
- * All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
+ * Copyright (c) 1995, Index Data.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
*
* $Log: data1.h,v $
- * Revision 1.1 1995-11-01 13:07:18 quinn
+ * Revision 1.2 1995-11-01 13:54:35 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 13:07:18 quinn
* Data1 module now lives in YAZ.
*
* Revision 1.13 1995/10/25 16:00:49 quinn
#include <proto.h>
#include <d1_attset.h>
-#include "d1_map.h"
+#include <d1_map.h>
#define DATA1_MAX_SYMBOL 31
* OF THIS SOFTWARE.
*
* $Log: odr.h,v $
- * Revision 1.15 1995-10-18 16:12:36 quinn
+ * Revision 1.16 1995-11-01 13:54:36 quinn
+ * Minor adjustments
+ *
+ * Revision 1.15 1995/10/18 16:12:36 quinn
* Better diagnostics.
*
* Revision 1.14 1995/09/29 17:12:04 quinn
#define ODR_MAXNAME 256
#include <prt.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#endif
--- /dev/null
+
+#ifndef READCONF_H
+#define READCONF_H
+
+#include <stdio.h>
+
+int readconf(char *name, void *private,
+ int (*fun)(char *name, void *private, int argc, char *argv[]));
+
+int readconf_line(FILE *f, char *line, int len, char *argv[], int num);
+
+#endif
#ifndef YCONFIG_H
#define YCONFIG_H
-#include <dmalloc.h>
+#include <xmalloc.h>
#ifdef WINDOWS
#define MDF
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.6 1995-04-10 10:22:57 quinn Exp $
+# $Id: Makefile,v 1.7 1995-11-01 13:54:38 quinn Exp $
#CC=
SHELL=/bin/sh
MAKE=make
LIBDIR=../lib
LIBS=$(LIBDIR)/libodr.a $(LIBDIR)/libasn.a $(LIBDIR)/libcomstack.a \
- $(LIBDIR)/libserver.a $(LIBDIR)/libutil.a
+ $(LIBDIR)/libserver.a $(LIBDIR)/libutil.a $(LIBDIR)/libret.a
LIB=$(LIBDIR)/libyaz.a
all: $(LIB)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr.c,v $
- * Revision 1.18 1995-09-29 17:12:22 quinn
+ * Revision 1.19 1995-11-01 13:54:41 quinn
+ * Minor adjustments
+ *
+ * Revision 1.18 1995/09/29 17:12:22 quinn
* Smallish
*
* Revision 1.17 1995/09/29 17:01:50 quinn
#include <stdio.h>
#include <stdlib.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#include <odr.h>
Odr_null *ODR_NULLVAL = "NULL"; /* the presence of a null value */
{
struct odr *r;
- if (!(r = malloc(sizeof(*r))))
+ if (!(r = xmalloc(sizeof(*r))))
return 0;
r->direction = direction;
r->print = stderr;
{
odr_release_mem(o->mem);
if (o->ecb.buf && o->ecb.can_grow)
- free(o->ecb.buf);
+ xfree(o->ecb.buf);
if (o->print != stderr)
fclose(o->print);
- free(o);
+ xfree(o);
}
void odr_setbuf(ODR o, char *buf, int len, int can_grow)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_mem.c,v $
- * Revision 1.10 1995-10-25 16:58:19 quinn
+ * Revision 1.11 1995-11-01 13:54:43 quinn
+ * Minor adjustments
+ *
+ * Revision 1.10 1995/10/25 16:58:19 quinn
* Stupid bug in odr_malloc
*
* Revision 1.9 1995/10/13 16:08:08 quinn
#include <stdlib.h>
#include <odr.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
/* ------------------------ NIBBLE MEMORY ---------------------- */
if (get < size)
get = size;
- if (!(r = malloc(sizeof(*r))))
+ if (!(r = xmalloc(sizeof(*r))))
abort();
- if (!(r->buf = malloc(r->size = get)))
+ if (!(r->buf = xmalloc(r->size = get)))
abort();
}
r->top = 0;
if (!o)
{
- if (!(r = malloc(size)))
+ if (!(r = xmalloc(size)))
abort();
return r;
}
togrow = b->size;
if (togrow < min_bytes)
togrow = min_bytes;
- if (b->size && !(b->buf = realloc(b->buf, b->size += togrow)))
+ if (b->size && !(b->buf =xrealloc(b->buf, b->size += togrow)))
abort();
- else if (!b->size && !(b->buf = malloc(b->size = togrow)))
+ else if (!b->size && !(b->buf = xmalloc(b->size = togrow)))
abort();
#ifdef ODR_DEBUG
fprintf(stderr, "New size for encode_buffer: %d\n", b->size);
-# $Id: Makefile,v 1.1 1995-11-01 11:56:06 quinn Exp $
+# $Id: Makefile,v 1.2 1995-11-01 13:54:43 quinn Exp $
SHELL=/bin/sh
RANLIB=ranlib
INCLUDE=-I../include -I.
CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
-LIB=../lib/data1.a
-PO = d1_read.o d1_attset.o d1_tagset.o d1_absyn.o d1_grs.o d1_grs_key.o \
- attribute.o d1_matchstr.o d1_sutrs.o d1_varset.o d1_espec.o \
+LIB=../lib/libret.a
+PO = d1_read.o d1_attset.o d1_tagset.o d1_absyn.o d1_grs.o \
+ d1_matchstr.o d1_sutrs.o d1_varset.o d1_espec.o \
d1_doespec.o d1_map.o d1_marc.o
CPP=$(CC) -E
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_absyn.c,v $
- * Revision 1.1 1995-11-01 11:56:06 quinn
+ * Revision 1.2 1995-11-01 13:54:44 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:06 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <oid.h>
#include <log.h>
-#include "data1.h"
+#include <data1.h>
#define D1_MAX_NESTING 128
#define DATA1_MAX_SYNTAXES 30 /* max no of syntaxes to handle in one session */
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_doespec.c,v $
- * Revision 1.1 1995-11-01 11:56:07 quinn
+ * Revision 1.2 1995-11-01 13:54:45 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:07 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <assert.h>
#include <log.h>
#include <proto.h>
-#include "data1.h"
+#include <data1.h>
static int match_children(data1_node *n, Z_ETagUnit **t, int num);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_grs.c,v $
- * Revision 1.1 1995-11-01 11:56:07 quinn
+ * Revision 1.2 1995-11-01 13:54:46 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:07 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <proto.h>
#include <log.h>
-#include "data1.h"
+#include <data1.h>
#define D1_VARIANTARRAY 20 /* fixed max length on sup'd variant-list. Lazy me */
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_map.c,v $
- * Revision 1.1 1995-11-01 11:56:08 quinn
+ * Revision 1.2 1995-11-01 13:54:46 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:08 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <log.h>
#include <readconf.h>
-#include "data1.h"
+#include <data1.h>
#include "d1_map.h"
data1_maptab *data1_read_maptab(char *file)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_marc.c,v $
- * Revision 1.1 1995-11-01 11:56:08 quinn
+ * Revision 1.2 1995-11-01 13:54:48 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:08 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <log.h>
#include <readconf.h>
#include <xmalloc.h>
-#include "data1.h"
+#include <data1.h>
#define ISO2709_RS 035
#define ISO2709_FS 036
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_read.c,v $
- * Revision 1.1 1995-11-01 11:56:09 quinn
+ * Revision 1.2 1995-11-01 13:54:48 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:09 quinn
* Added Retrieval (data management) functions en masse.
*
* Revision 1.14 1995/10/30 12:40:55 quinn
#include <xmalloc.h>
#include <log.h>
-#include "data1.h"
+#include <data1.h>
static data1_node *freelist = 0;
abort();
for (;;)
{
- if (rd + 4096 > size && !(buf = realloc(buf, size *= 2)))
+ if (rd + 4096 > size && !(buf =xrealloc(buf, size *= 2)))
abort();
if ((res = (*rf)(fd, buf + rd, 4096)) <= 0)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_sutrs.c,v $
- * Revision 1.1 1995-11-01 11:56:09 quinn
+ * Revision 1.2 1995-11-01 13:54:49 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:09 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <wrbuf.h>
-#include "data1.h"
+#include <data1.h>
#define NTOBUF_INDENT 2
#define NTOBUF_MARGIN 75
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_tagset.c,v $
- * Revision 1.1 1995-11-01 11:56:09 quinn
+ * Revision 1.2 1995-11-01 13:54:49 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:09 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <xmalloc.h>
#include <log.h>
-#include "data1.h"
+#include <data1.h>
/*
* We'll probably want to add some sort of hashed index to these lookup-
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_varset.c,v $
- * Revision 1.1 1995-11-01 11:56:09 quinn
+ * Revision 1.2 1995-11-01 13:54:50 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/11/01 11:56:09 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <readconf.h>
#include <oid.h>
-#include <alexutil.h>
#include <log.h>
-#include "data1.h"
+#include <data1.h>
data1_vartype *data1_getvartypebyct(data1_varset *set, char *class, char *type)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rfct.c,v $
- * Revision 1.7 1995-06-16 10:46:48 quinn
+ * Revision 1.8 1995-11-01 13:54:52 quinn
+ * Minor adjustments
+ *
+ * Revision 1.7 1995/06/16 10:46:48 quinn
* *** empty log message ***
*
* Revision 1.6 1995/06/15 07:45:11 quinn
#ifdef __linux__
#include <linux/limits.h>
#endif
-#include <dmalloc.h> /* project memory debugging - delete if you don't have it */
#ifdef TRACE_TRANSPORT
#define TRC(x) x
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: eventl.c,v $
- * Revision 1.15 1995-09-15 14:44:15 quinn
+ * Revision 1.16 1995-11-01 13:54:56 quinn
+ * Minor adjustments
+ *
+ * Revision 1.15 1995/09/15 14:44:15 quinn
* *** empty log message ***
*
* Revision 1.14 1995/08/29 14:44:50 quinn
#include <eventl.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
static IOCHAN iochans = 0;
{
IOCHAN new;
- if (!(new = malloc(sizeof(*new))))
+ if (!(new = xmalloc(sizeof(*new))))
return 0;
new->destroyed = 0;
new->fd = fd;
}
if (nextp == p)
nextp = p->next;
- free(tmp);
+ xfree(tmp);
}
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: requestq.c,v $
- * Revision 1.1 1995-05-15 12:12:22 quinn
+ * Revision 1.2 1995-11-01 13:54:57 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/05/15 12:12:22 quinn
* Request queue.
*
*
* Simple queue management.
*
* We also use the request-freelist to store encoding buffers, rather than
- * freeing and malloc'ing them on each cycle.
+ * freeing and xmalloc'ing them on each cycle.
*/
#include <stdlib.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#include <session.h>
static request *request_list = 0; /* global freelist for requests */
request_list = r->next;
else
{
- if (!(r = malloc(sizeof(*r))))
+ if (!(r = xmalloc(sizeof(*r))))
abort();
r->response = 0;
r->size_response = 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.52 1995-11-01 12:19:13 quinn
+ * Revision 1.53 1995-11-01 13:54:58 quinn
+ * Minor adjustments
+ *
+ * Revision 1.52 1995/11/01 12:19:13 quinn
* Second attempt to fix same bug.
*
* Revision 1.50 1995/10/25 16:58:32 quinn
#include <assert.h>
#include <sys/time.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#include <comstack.h>
#include <eventl.h>
#include <session.h>
if (!control_block)
control_block = statserv_getcontrol();
- if (!(new = malloc(sizeof(*new))))
+ if (!(new = xmalloc(sizeof(*new))))
return 0;
new->client_chan = channel;
new->client_link = link;
if (h->print)
odr_destroy(h->print);
if (h->input_buffer)
- free(h->input_buffer);
+ xfree(h->input_buffer);
if (h->backend)
bend_close(h->backend);
while (request_deq(&h->incoming));
while (request_deq(&h->outgoing));
- free(h);
+ xfree(h);
}
static void do_close(association *a, int reason, char *message)
}
req->response = odr_getbuf(assoc->encode, &req->len_response,
&req->size_response);
- odr_setbuf(assoc->encode, 0, 0, 0); /* don't free if we abort later */
+ odr_setbuf(assoc->encode, 0, 0, 0); /* don'txfree if we abort later */
odr_reset(assoc->encode);
if (assoc->print && !z_APDU(assoc->print, &res, 0))
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: statserv.c,v $
- * Revision 1.29 1995-10-30 12:41:29 quinn
+ * Revision 1.30 1995-11-01 13:54:59 quinn
+ * Minor adjustments
+ *
+ * Revision 1.29 1995/10/30 12:41:29 quinn
* Added hostname lookup for server.
*
* Revision 1.28 1995/09/29 17:12:30 quinn
#ifdef USE_XTIMOSI
#include <xmosi.h>
#endif
-#include <dmalloc.h>
#include <log.h>
#include <statserv.h>
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.14 1995-10-06 08:51:24 quinn Exp $
+# $Id: Makefile,v 1.15 1995-11-01 13:55:04 quinn Exp $
SHELL=/bin/sh
INCLUDE=-I../include -I.
DEFS=$(INCLUDE)
LIB=$(LIBDIR)/libutil.a
LIBS=
-PO = options.o log.o marcdisp.o yaz-ccl.o pquery.o oid.o wrbuf.o # dmalloc.o
+PO = options.o log.o marcdisp.o yaz-ccl.o pquery.o oid.o wrbuf.o \
+ xmalloc.o readconf.o # dmalloc.o
CPP=$(CC) -E
RANLIB=ranlib
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: marcdump.c,v $
- * Revision 1.3 1995-05-16 08:51:12 quinn
+ * Revision 1.4 1995-11-01 13:55:05 quinn
+ * Minor adjustments
+ *
+ * Revision 1.3 1995/05/16 08:51:12 quinn
* License, documentation, and memory fixes
*
* Revision 1.2 1995/05/15 11:56:56 quinn
#include <stdlib.h>
#include <errno.h>
#include <marcdisp.h>
-#include <dmalloc.h>
+#include <xmalloc.h>
#ifndef SEEK_SET
#define SEEK_SET 0
*argv, argv[1], strerror (errno));
exit (1);
}
- buf = malloc (file_size);
+ buf = xmalloc (file_size);
if (!buf)
{
- fprintf (stderr, "%s: cannot malloc: %s\n",
+ fprintf (stderr, "%s: cannot xmalloc: %s\n",
*argv, strerror (errno));
exit (1);
}
--- /dev/null
+/*
+ * Copyright (C) 1994, Index Data I/S
+ * All rights reserved.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: readconf.c,v $
+ * Revision 1.1 1995-11-01 13:55:06 quinn
+ * Minor adjustments
+ *
+ * Revision 1.2 1995/10/30 13:54:27 quinn
+ * iRemoved fclose().
+ *
+ * Revision 1.1 1995/10/10 16:28:18 quinn
+ * Initial revision
+ *
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+
+#include <log.h>
+
+int readconf_line(FILE *f, char *line, int len, char *argv[], int num)
+{
+ char *p;
+ int argc;
+
+ while ((p = fgets(line, len, f)))
+ {
+ while (*p && isspace(*p))
+ p++;
+ if (*p && *p != '#')
+ break;
+ }
+ if (!p)
+ return 0;
+
+ for (argc = 0; *p ; argc++)
+ {
+ if (*p == '#') /* trailing comment */
+ break;
+ argv[argc] = p;
+ while (*p && !isspace(*p))
+ p++;
+ if (*p)
+ {
+ *(p++) = '\0';
+ while (*p && isspace(*p))
+ p++;
+ }
+ }
+ return argc;
+}
+
+/*
+ * Read lines of a configuration file.
+ */
+int readconf(char *name, void *private,
+ int (*fun)(char *name, void *private, int argc, char *argv[]))
+{
+ FILE *f;
+ char line[512], *m_argv[50];
+ int m_argc;
+
+ if (!(f = fopen(name, "r")))
+ {
+ logf(LOG_WARN|LOG_ERRNO, "readconf: %s", name);
+ return -1;
+ }
+ for (;;)
+ {
+ int res;
+
+ if (!(m_argc = readconf_line(f, line, 512, m_argv, 50)))
+ {
+ fclose(f);
+ return 0;
+ }
+
+ if ((res = (*fun)(name, private, m_argc, m_argv)))
+ {
+ fclose(f);
+ return res;
+ }
+ }
+}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: wrbuf.c,v $
- * Revision 1.1 1995-10-06 08:51:25 quinn
+ * Revision 1.2 1995-11-01 13:55:06 quinn
+ * Minor adjustments
+ *
+ * Revision 1.1 1995/10/06 08:51:25 quinn
* Added Write-buffer.
*
*
{
WRBUF n;
- if (!(n = malloc(sizeof(*n))))
+ if (!(n = xmalloc(sizeof(*n))))
abort();
n->buf = 0;
n->size = 0;
void wrbuf_free(WRBUF b, int free_buf)
{
if (free_buf && b->buf)
- free(b->buf);
- free(b);
+ xfree(b->buf);
+ xfree(b);
}
void wrbuf_rewind(WRBUF b)
togrow = b->size;
if (togrow < minsize)
togrow = minsize;
- if (b->size && !(b->buf = realloc(b->buf, b->size += togrow)))
+ if (b->size && !(b->buf =xrealloc(b->buf, b->size += togrow)))
abort();
- else if (!b->size && !(b->buf = malloc(b->size = togrow)))
+ else if (!b->size && !(b->buf = xmalloc(b->size = togrow)))
abort();
return 0;
}
Odr_oct *term_octet;
Z_Term *term;
- zapt = malloc (sizeof(*zapt));
+ zapt = xmalloc (sizeof(*zapt));
assert (zapt);
- term_octet = malloc (sizeof(*term_octet));
+ term_octet = xmalloc (sizeof(*term_octet));
assert (term_octet);
- term = malloc(sizeof(*term));
+ term = xmalloc(sizeof(*term));
assert(term);
for (attr = p->u.t.attr_list; attr; attr = attr->next)
if (num)
{
int i = 0;
- zapt->attributeList = malloc (num*sizeof(*zapt->attributeList));
+ zapt->attributeList = xmalloc (num*sizeof(*zapt->attributeList));
assert (zapt->attributeList);
for (attr = p->u.t.attr_list; attr; attr = attr->next, i++)
{
- zapt->attributeList[i] = malloc (sizeof(**zapt->attributeList));
+ zapt->attributeList[i] = xmalloc (sizeof(**zapt->attributeList));
assert (zapt->attributeList[i]);
zapt->attributeList[i]->attributeType =
&attr->type;
{
Z_Operand *zo;
- zo = malloc (sizeof(*zo));
+ zo = xmalloc (sizeof(*zo));
assert (zo);
switch (p->kind)
Z_Complex *zc;
Z_Operator *zo;
- zc = malloc (sizeof(*zc));
+ zc = xmalloc (sizeof(*zc));
assert (zc);
- zo = malloc (sizeof(*zo));
+ zo = xmalloc (sizeof(*zo));
assert (zo);
zc->operator = zo;
{
Z_RPNStructure *zs;
- zs = malloc (sizeof(*zs));
+ zs = xmalloc (sizeof(*zs));
assert (zs);
switch (p->kind)
{
{
Z_RPNQuery *zq;
- zq = malloc (sizeof(*zq));
+ zq = xmalloc (sizeof(*zq));
assert (zq);
zq->attributeSetId = NULL;
zq->RPNStructure = ccl_rpn_structure (p);