+# Copyright (C) 1994, Index Data I/S
+# All rights reserved.
+# Sebastian Hammer, Adam Dickmeiss
+# $Id: Makefile,v 1.12 1995-09-04 12:33:21 adam Exp $
+
SHELL=/bin/sh
-INCLUDE=-I../include
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
+#CFLAGS=-g -Wall -pedantic -ansi
+DEFS=$(INCLUDE)
TPROG=btest
CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
all: $(LIB)
-$(TPROG): $(TPROG).o $(LIB)
- $(CC) -o $(TPROG) $(TPROG).o $(LIB)
+$(TPROG): $(TPROG).o $(LIB) $(YAZLIB)
+ $(CC) -o $(TPROG) $(TPROG).o $(LIB) $(YAZLIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
clean:
rm -f *.[oa] $(TPROG) core mon.out gmon.out errlist
+
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.c,v $
- * Revision 1.10 1994-08-25 10:15:54 quinn
+ * Revision 1.11 1995-09-04 12:33:21 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.10 1994/08/25 10:15:54 quinn
* Trivial
*
* Revision 1.9 1994/08/24 08:45:48 quinn
*
*/
-#include <util.h>
-#include <bfile.h>
+#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
+#include <alexutil.h>
+#include <bfile.h>
+
int bf_close (BFile bf)
{
mf_close(bf->mf);
if (!(tmp->mf = mf_open(0, name, block_size, wflag)))
{
- log(LOG_FATAL, "Mfopen failed for %s", name);
+ logf (LOG_FATAL, "Mfopen failed for %s", name);
return(0);
}
return(tmp);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mfile.c,v $
- * Revision 1.9 1994-11-04 14:26:39 quinn
+ * Revision 1.10 1995-09-04 12:33:22 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.9 1994/11/04 14:26:39 quinn
* bug-fix.
*
* Revision 1.8 1994/10/05 16:56:42 quinn
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
+#include <stdio.h>
#include <assert.h>
-#include <util.h>
+#include <alexutil.h>
#include <mfile.h>
static MFile_area_struct *open_areas = 0;
if (!ad)
{
- log(LOG_FATAL, "Could not find resource '%s'", name);
+ logf (LOG_FATAL, "Could not find resource '%s'", name);
return -1;
}
for (;;)
break;
if (rs != 3)
{
- log(LOG_FATAL, "Illegal directory description: %s", ad + offset);
+ logf (LOG_FATAL, "Illegal directory description: %s", ad + offset);
return -1;
}
switch (unit)
case 'K': case 'k': multi = 1024; break;
case 'M': case 'm': multi = 1048576; break;
default:
- log(LOG_FATAL, "Illegal unit: %c in %s", unit, ad + offset);
+ logf (LOG_FATAL, "Illegal unit: %c in %s", unit, ad + offset);
return -1;
}
*dp = dir = xmalloc(sizeof(mf_dir));
if (mf->files[c].fd < 0 && (mf->files[c].fd = open(mf->files[c].path,
mf->wr ? O_RDWR|O_CREAT : O_RDONLY, 0666)) < 0)
{
- log(LOG_FATAL|LOG_ERRNO, "Failed to open %s", mf->files[c].path);
+ logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", mf->files[c].path);
return -1;
}
if (lseek(mf->files[c].fd, (ps = pos - off) * mf->blocksize + offset,
SEEK_SET) < 0)
{
- log(LOG_FATAL|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path);
+ logf (LOG_FATAL|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path);
return -1;
}
mf->cur_file = c;
int fd, number;
char metaname[FILENAME_MAX+1], tmpnam[FILENAME_MAX+1];
- log(LOG_DEBUG, "mf_init(%s)", name);
+ logf (LOG_DEBUG, "mf_init(%s)", name);
for (mp = open_areas; mp; mp = mp->next)
if (!strcmp(name, mp->name))
abort();
ma->dirs = 0;
if (scan_areadef(ma, name) < 0)
{
- log(LOG_FATAL, "Failed to access description of '%s'", name);
+ logf (LOG_FATAL, "Failed to access description of '%s'", name);
return 0;
}
/* look at each directory */
{
if (!(dd = opendir(dirp->name)))
{
- log(LOG_FATAL|LOG_ERRNO, "Failed to open %s", dirp->name);
+ logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", dirp->name);
return 0;
}
/* look at each file */
continue;
if (sscanf(dent->d_name, "%[^.].%d", metaname, &number) != 2)
{
- log(LOG_FATAL, "Failed to resolve part-name %s", dent->d_name);
+ logf (LOG_FATAL, "Failed to resolve part-name %s",
+ dent->d_name);
return 0;
}
for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next)
/* get size */
if ((fd = open(part_f->path, O_RDONLY)) < 0)
{
- log(LOG_FATAL|LOG_ERRNO, "Failed to access %s", dent->d_name);
+ logf (LOG_FATAL|LOG_ERRNO, "Failed to access %s",
+ dent->d_name);
return 0;
}
if ((part_f->bytes = lseek(fd, 0, SEEK_END)) < 0)
{
- log(LOG_FATAL|LOG_ERRNO, "Failed to seek in %s", dent->d_name);
+ logf (LOG_FATAL|LOG_ERRNO, "Failed to seek in %s",
+ dent->d_name);
return 0;
}
close(fd);
}
for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next)
{
- log(LOG_DEBUG, "mf_init: %s consists of %d part(s)", meta_f->name,
- meta_f->no_files);
+ logf (LOG_DEBUG, "mf_init: %s consists of %d part(s)", meta_f->name,
+ meta_f->no_files);
qsort(meta_f->files, meta_f->no_files, sizeof(part_file),
- cmp_part_file);
+ cmp_part_file);
}
return ma;
}
char tmp[FILENAME_MAX+1];
mf_dir *dp;
- log(LOG_LOG, "mf_open(%s bs=%d, %s)", name, block_size,
- wflag ? "RW" : "RDONLY");
+ logf(LOG_LOG, "mf_open(%s bs=%d, %s)", name, block_size,
+ wflag ? "RW" : "RDONLY");
if (!ma)
{
if (!default_area && !(default_area = mf_init(MF_DEFAULT_AREA)))
{
- log(LOG_FATAL, "Failed to open default area.");
+ logf (LOG_FATAL, "Failed to open default area.");
return 0;
}
ma = default_area;
dp = dp->next);
if (!dp)
{
- log(LOG_FATAL, "Insufficient space for new mfile.");
+ logf (LOG_FATAL, "Insufficient space for new mfile.");
return 0;
}
new->files[0].dir = dp;
{
int i;
- log(LOG_DEBUG, "mf_close(%s)", mf->name);
+ logf (LOG_DEBUG, "mf_close(%s)", mf->name);
assert(mf->open);
for (i = 0; i < mf->no_files; i++)
if (mf->files[i].fd >= 0)
toread = num ? num : mf->blocksize;
if ((rd = read(mf->files[mf->cur_file].fd, buf, toread)) < 0)
{
- log(LOG_FATAL|LOG_ERRNO, "mf_read: Read failed (%s)",
- mf->files[mf->cur_file].path);
+ logf (LOG_FATAL|LOG_ERRNO, "mf_read: Read failed (%s)",
+ mf->files[mf->cur_file].path);
exit(1);
}
else if (rd < toread)
/* file needs to grow */
while (ps >= mf->files[mf->cur_file].blocks)
{
- log(LOG_DEBUG, "File grows");
+ logf (LOG_DEBUG, "File grows");
/* file overflow - allocate new file */
if ((ps - mf->files[mf->cur_file].blocks + 1) * mf->blocksize >
mf->files[mf->cur_file].dir->avail_bytes)
if ((nblocks = mf->files[mf->cur_file].dir->avail_bytes /
mf->blocksize) > 0)
{
- log(LOG_DEBUG, "Capping off file %s at pos %d",
+ logf (LOG_DEBUG, "Capping off file %s at pos %d",
mf->files[mf->cur_file].path, nblocks);
if ((ps = file_position(mf,
(mf->cur_file ? mf->files[mf->cur_file-1].top : 0) +
exit(1);
if (write(mf->files[mf->cur_file].fd, &dummych, 1) < 1)
{
- log(LOG_ERRNO|LOG_FATAL, "write dummy");
+ logf (LOG_ERRNO|LOG_FATAL, "write dummy");
exit(1);
}
mf->files[mf->cur_file].blocks += nblocks;
mf->blocksize;
}
/* get other bit */
- log(LOG_DEBUG, "Creating new file.");
+ logf (LOG_DEBUG, "Creating new file.");
for (dp = mf->ma->dirs; dp && dp->avail_bytes < mf->min_bytes_creat;
dp = dp->next);
if (!dp)
{
- log(LOG_FATAL, "Cannot allocate more space for %s", mf->name);
+ logf (LOG_FATAL, "Cannot allocate more space for %s",
+ mf->name);
exit(1);
}
mf->files[mf->cur_file].top = (mf->cur_file ?
towrite = num ? num : mf->blocksize;
if (write(mf->files[mf->cur_file].fd, buf, towrite) < towrite)
{
- log(LOG_FATAL|LOG_ERRNO, "Write failed");
+ logf (LOG_FATAL|LOG_ERRNO, "Write failed");
exit(1);
}
return 0;
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.7 1995-02-06 10:12:55 adam Exp $
+# $Id: Makefile,v 1.8 1995-09-04 12:33:25 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
TPROG1=agrep
TPROG2=lexer
TPROG3=grepper
-CFLAGS=-g -Wall -pedantic -ansi
+#CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE) -DYACC -DYYDEBUG=1 -DMEMDEBUG=1
LIB=../lib/dfa.a
PO = dfa.o imalloc.o states.o set.o bset.o
alll: $(LIB) $(TPROG1) $(TPROG2) $(TPROG3)
-$(TPROG1): $(TPROG1).o $(LIB) ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) ../lib/util.a
+$(TPROG1): $(TPROG1).o $(LIB) ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) \
+ ../lib/alexutil.a $(YAZLIB)
-$(TPROG2): $(TPROG2).o readfile.o $(LIB) ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG2) $(TPROG2).o readfile.o $(LIB) ../lib/util.a
+$(TPROG2): $(TPROG2).o readfile.o $(LIB) ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG2) $(TPROG2).o readfile.o $(LIB) \
+ ../lib/alexutil.a $(YAZLIB)
-$(TPROG3): $(TPROG3).o $(LIB)
- $(CC) $(CFLAGS) -o $(TPROG3) $(TPROG3).o $(LIB) ../lib/util.a
+$(TPROG3): $(TPROG3).o $(LIB) ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG3) $(TPROG3).o $(LIB) $(YAZLIB) \
+ ../lib/alexutil.a $(YAZLIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
depend: depend2
depend1:
- mv Makefile Makefile.tmp
$(YACC) $(YFLAGS) regexp.y
mv y.tab.c regexp.c
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) -M $(DEFS) *.c |sed 's/regexp\.c/regexp.y/g' >>Makefile
- rm -f Makefile.tmp regexp.c
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) -M $(DEFS) *.c |sed 's/regexp\.c/regexp.y/g' >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
+ rm -f regexp.c
depend2:
$(YACC) $(YFLAGS) regexp.y
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: agrep.c,v $
- * Revision 1.4 1995-01-24 16:00:21 adam
+ * Revision 1.5 1995-09-04 12:33:25 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1995/01/24 16:00:21 adam
* Added -ansi to CFLAGS.
* Some changes to the dfa module.
*
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
#include <dfa.h>
#include "imalloc.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bset.c,v $
- * Revision 1.2 1995-01-24 16:00:21 adam
+ * Revision 1.3 1995-09-04 12:33:25 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.2 1995/01/24 16:00:21 adam
* Added -ansi to CFLAGS.
* Some changes to the dfa module.
*
#include <stdlib.h>
#include <string.h>
-#include <util.h>
+#include <alexutil.h>
#include <bset.h>
#include "imalloc.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dfa.c,v $
- * Revision 1.2 1995-01-25 11:30:50 adam
+ * Revision 1.3 1995-09-04 12:33:26 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.2 1995/01/25 11:30:50 adam
* Simple error reporting when parsing regular expressions.
* Memory usage reduced.
*
#include <string.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include "dfap.h"
#include "imalloc.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: grepper.c,v $
- * Revision 1.4 1995-01-24 16:00:21 adam
+ * Revision 1.5 1995-09-04 12:33:26 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1995/01/24 16:00:21 adam
* Added -ansi to CFLAGS.
* Some changes to the dfa module.
*
#include <ctype.h>
#include <assert.h>
-#include <util.h>
+#include <alexutil.h>
#include <dfa.h>
#include "imalloc.h"
inf = fopen (fname, "r");
if (!inf)
{
- log (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", fname);
+ logf (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", fname);
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: imalloc.c,v $
- * Revision 1.3 1994-09-27 16:31:19 adam
+ * Revision 1.4 1995-09-04 12:33:26 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.3 1994/09/27 16:31:19 adam
* First version of grepper: grep with error correction.
*
* Revision 1.2 1994/09/26 16:30:56 adam
#include <assert.h>
#include <stdlib.h>
-#include <util.h>
+#include <alexutil.h>
#include "imalloc.h"
#ifdef MEMDEBUG
size_t words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
char *p = (char *)xmalloc( words*sizeof(unsigned) );
if( !p )
- log (LOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld",
+ logf (LOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
*((unsigned *)p) = size;
((unsigned *)p)[1] = MAG1;
#else
void *p = (void *)xmalloc( size );
if( !p )
- log (LOG_FATAL, "Out of memory (imalloc)" );
+ logf (LOG_FATAL, "Out of memory (imalloc)" );
return p;
#endif
}
unsigned words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
char *p = (char *) xcalloc( words*sizeof(unsigned), 1 );
if( !p )
- log (LOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld",
+ logf (LOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
((unsigned *)p)[0] = size;
((unsigned *)p)[1] = MAG1;
#else
void *p = (void) xcalloc( size, 1 );
if( !p )
- log (LOG_FATAL, "Out of memory (icalloc)" );
+ logf (LOG_FATAL, "Out of memory (icalloc)" );
return p;
#endif
}
++free_calls;
size = (-2)[(unsigned *) p];
if( (-1)[(unsigned *) p] != MAG1 )
- log (LOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size );
+ logf (LOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size );
if( size[(unsigned char *) p] != MAG2 )
- log (LOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size );
+ logf (LOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size );
if( (size+1)[(unsigned char *) p] != MAG3 )
- log (LOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size );
+ logf (LOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size );
alloc -= size;
if( alloc < 0L )
- log (LOG_FATAL,"Internal: ifree(%u) negative alloc.", size );
+ logf (LOG_FATAL,"Internal: ifree(%u) negative alloc.", size );
xfree( (unsigned *) p-2 );
}
#else
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lexer.c,v $
- * Revision 1.6 1995-01-25 11:30:51 adam
+ * Revision 1.7 1995-09-04 12:33:27 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.6 1995/01/25 11:30:51 adam
* Simple error reporting when parsing regular expressions.
* Memory usage reduced.
*
#include <string.h>
#include <stdarg.h>
-#include <util.h>
+#include <alexutil.h>
#include <dfa.h>
#include "imalloc.h"
#include "lexer.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: readfile.c,v $
- * Revision 1.4 1995-01-25 11:30:51 adam
+ * Revision 1.5 1995-09-04 12:33:27 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1995/01/25 11:30:51 adam
* Simple error reporting when parsing regular expressions.
* Memory usage reduced.
*
#include <string.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include <dfa.h>
#include "lexer.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: set.c,v $
- * Revision 1.3 1995-02-06 10:12:55 adam
+ * Revision 1.4 1995-09-04 12:33:27 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.3 1995/02/06 10:12:55 adam
* Unused static function rm_SetElement was removed.
*
* Revision 1.2 1995/01/24 16:00:22 adam
#include <stdlib.h>
#include <string.h>
-#include <util.h>
+#include <alexutil.h>
#include <set.h>
#include "imalloc.h"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: states.c,v $
- * Revision 1.3 1995-01-25 11:30:51 adam
+ * Revision 1.4 1995-09-04 12:33:28 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.3 1995/01/25 11:30:51 adam
* Simple error reporting when parsing regular expressions.
* Memory usage reduced.
*
#include <stdlib.h>
#include <string.h>
-#include <util.h>
+#include <alexutil.h>
#include "dfap.h"
#include "imalloc.h"
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.14 1995-02-06 10:13:17 adam Exp $
+# $Id: Makefile,v 1.15 1995-09-04 12:33:31 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
TPROG1=dicttest
TPROG2=dictext
-CFLAGS=-g -Wall -pedantic -ansi
+#CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
LIB=../lib/dict.a
PO = dopen.o dclose.o drdwr.o open.o close.o insert.o lookup.o \
alll: $(LIB) $(TPROG1) $(TPROG2)
-$(TPROG1): $(TPROG1).o $(LIB) ../lib/bfile.a ../lib/util.a ../lib/dfa.a
- $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) ../lib/bfile.a ../lib/dfa.a ../lib/util.a
+$(TPROG1): $(TPROG1).o $(LIB) ../lib/bfile.a ../lib/alexutil.a ../lib/dfa.a
+ $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) \
+ ../lib/bfile.a ../lib/dfa.a ../lib/alexutil.a $(YAZLIB)
-$(TPROG2): $(TPROG2).o $(LIB) ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG2) $(TPROG2).o ../lib/util.a
+$(TPROG2): $(TPROG2).o $(LIB) ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG2) $(TPROG2).o ../lib/alexutil.a $(YAZLIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dictext.c,v $
- * Revision 1.3 1994-10-04 17:46:54 adam
+ * Revision 1.4 1995-09-04 12:33:31 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.3 1994/10/04 17:46:54 adam
* Function options now returns arg with error option.
*
* Revision 1.2 1994/09/28 13:07:08 adam
#include <assert.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
char *prog;
inputfile = arg;
else
{
- log (LOG_FATAL, "too many files specified\n");
+ logf (LOG_FATAL, "too many files specified\n");
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
ipf = fopen (inputfile, "r");
if (!ipf)
{
- log (LOG_FATAL|LOG_ERRNO, "cannot open '%s'", inputfile);
+ logf (LOG_FATAL|LOG_ERRNO, "cannot open '%s'", inputfile);
exit (1);
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dicttest.c,v $
- * Revision 1.14 1994-10-04 17:46:55 adam
+ * Revision 1.15 1995-09-04 12:33:31 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.14 1994/10/04 17:46:55 adam
* Function options now returns arg with error option.
*
* Revision 1.13 1994/10/04 12:08:05 adam
name = arg;
else
{
- log (LOG_FATAL, "too many files specified\n");
+ logf (LOG_FATAL, "too many files specified\n");
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
if (!base || !name)
{
- log (LOG_FATAL, "no base and/or dictionary specified");
+ logf (LOG_FATAL, "no base and/or dictionary specified");
exit (1);
}
common_resource = res_open (base);
if (!common_resource)
{
- log (LOG_FATAL, "cannot open resource `%s'", base);
+ logf (LOG_FATAL, "cannot open resource `%s'", base);
exit (1);
}
dict = dict_open (name, cache, rw);
if (!dict)
{
- log (LOG_FATAL, "dict_open fail of `%s'", name);
+ logf (LOG_FATAL, "dict_open fail of `%s'", name);
exit (1);
}
if (inputfile)
if (!(ipf = fopen(inputfile, "r")))
{
- log (LOG_FATAL|LOG_ERRNO, "cannot open %s", inputfile);
+ logf (LOG_FATAL|LOG_ERRNO, "cannot open %s", inputfile);
exit (1);
}
case 1:
no_of_change++;
if (unique)
- log (LOG_LOG, "%s change\n", ipf_ptr);
+ logf (LOG_LOG, "%s change\n", ipf_ptr);
break;
case 2:
if (unique)
- log (LOG_LOG, "%s duplicate\n", ipf_ptr);
+ logf (LOG_LOG, "%s duplicate\n", ipf_ptr);
no_of_same++;
break;
}
{
if (range < 0)
range = 0;
- log (LOG_LOG, "Grepping '%s'", grep_pattern);
+ logf (LOG_LOG, "Grepping '%s'", grep_pattern);
dict_lookup_grep (dict, grep_pattern, range, grep_handle);
}
if (rw)
{
- log (LOG_LOG, "Insertions.... %d", no_of_iterations);
- log (LOG_LOG, "No of new..... %d", no_of_new);
- log (LOG_LOG, "No of change.. %d", no_of_change);
- log (LOG_LOG, "No of same.... %d", no_of_same);
+ logf (LOG_LOG, "Insertions.... %d", no_of_iterations);
+ logf (LOG_LOG, "No of new..... %d", no_of_new);
+ logf (LOG_LOG, "No of change.. %d", no_of_change);
+ logf (LOG_LOG, "No of same.... %d", no_of_same);
}
else
{
- log (LOG_LOG, "Lookups....... %d", no_of_iterations);
- log (LOG_LOG, "No of hits.... %d", no_of_hits);
- log (LOG_LOG, "No of misses.. %d", no_of_misses);
+ logf (LOG_LOG, "Lookups....... %d", no_of_iterations);
+ logf (LOG_LOG, "No of hits.... %d", no_of_hits);
+ logf (LOG_LOG, "No of misses.. %d", no_of_misses);
}
dict_close (dict);
res_close (common_resource);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: insert.c,v $
- * Revision 1.10 1994-10-05 12:16:48 adam
+ * Revision 1.11 1995-09-04 12:33:31 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.10 1994/10/05 12:16:48 adam
* Pagesize is a resource now.
*
* Revision 1.9 1994/09/16 15:39:13 adam
}
if (split_page (dict, ptr, p))
{
- log (LOG_FATAL, "Unable to split page %d\n", ptr);
+ logf (LOG_FATAL, "Unable to split page %d\n", ptr);
abort ();
}
return dict_ins (dict, str-1, ptr, userlen, userinfo);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: open.c,v $
- * Revision 1.6 1994-10-05 12:16:52 adam
+ * Revision 1.7 1995-09-04 12:33:32 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.6 1994/10/05 12:16:52 adam
* Pagesize is a resource now.
*
* Revision 1.5 1994/09/01 17:49:39 adam
DICT_DEFAULT_PAGESIZE));
if (page_size < 1024)
{
- log (LOG_WARN, "Resource %s was too small. Set to 1024", resource_str);
+ logf (LOG_WARN, "Resource %s was too small. Set to 1024",
+ resource_str);
page_size = 1024;
}
dict->dbf = dict_bf_open (name, page_size, cache, rw);
if(!dict->dbf)
{
- log (LOG_WARN, "Cannot open `%s'", name);
+ logf (LOG_WARN, "Cannot open `%s'", name);
xfree (dict);
return NULL;
}
dh = (struct Dict_head *) head_buf;
if (strcmp (dh->magic_str, DICT_MAGIC))
{
- log (LOG_WARN, "Bad magic of `%s'", name);
+ logf (LOG_WARN, "Bad magic of `%s'", name);
dict_bf_close (dict->dbf);
xfree (dict);
return NULL;
}
if (dh->page_size != page_size)
{
- log (LOG_WARN, "Resource %s is %d and pagesize of `%s' is %d",
- resource_str, page_size, name, dh->page_size);
+ logf (LOG_WARN, "Resource %s is %d and pagesize of `%s' is %d",
+ resource_str, page_size, name, dh->page_size);
dict_bf_close (dict->dbf);
xfree (dict);
return NULL;
* Sebastian Hammer, Adam Dickmeiss
*
$Log: bfile.h,v $
- Revision 1.6 1994-09-14 13:10:35 quinn
- Small changes
+ Revision 1.7 1995-09-04 12:33:35 adam
+ Various cleanup. YAZ util used instead.
+ * Revision 1.6 1994/09/14 13:10:35 quinn
+ * Small changes
+ *
* Revision 1.5 1994/08/24 08:45:52 quinn
* Using mfile.
*
#ifndef BFILE_H
#define BFILE_H
-#include <util.h>
+#include <alexutil.h>
#include <mfile.h>
#define bf_blocksize(bf) mf_blocksize(bf->mf)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mfile.h,v $
- * Revision 1.2 1994-09-14 13:10:36 quinn
+ * Revision 1.3 1995-09-04 12:33:35 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.2 1994/09/14 13:10:36 quinn
* Small changes
*
* Revision 1.1 1994/08/23 14:41:46 quinn
#include <stdio.h>
-#include <util.h>
+#include <alexutil.h>
#define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
#define MF_DEFAULT_AREA "register" /* Use if no mf_init */
# Copyright (C) 1995, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.4 1995-09-04 09:10:34 adam Exp $
+# $Id: Makefile,v 1.5 1995-09-04 12:33:40 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include -I../../yaz/include
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
TPROG1=index
TPROG2=kdump
TPROG3=zserver
all: $(TPROG1) $(TPROG2) $(TPROG3)
-$(TPROG1): $(O1) ../lib/dict.a ../lib/isam.a ../lib/bfile.a ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG1) $(O1) ../lib/dict.a ../lib/isam.a ../lib/bfile.a ../lib/util.a
+$(TPROG1): $(O1) ../lib/dict.a \
+ ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG1) $(O1) ../lib/dict.a \
+ ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB)
-$(TPROG2): $(O2) ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG2) $(O2) ../lib/util.a
-
-$(TPROG3): $(O3) ../lib/dict.a ../lib/isam.a ../lib/bfile.a ../lib/rset.a ../lib/util.a
- $(CC) $(CFLAGS) -o $(TPROG3) $(O3) ../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/bfile.a ../lib/util.a
+$(TPROG2): $(O2) $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG2) $(O2) $(YAZLIB)
+$(TPROG3): $(O3) ../lib/rset.a \
+ ../lib/dict.a ../lib/isam.a ../lib/bfile.a \
+ ../lib/dfa.a ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG3) $(O3) ../lib/rset.a \
+ ../lib/dict.a ../lib/isam.a ../lib/bfile.a \
+ ../lib/dfa.a ../lib/alexutil.a $(YAZLIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
clean:
- rm -f *.[oa] $(TPROG1) $(TPROG2) core mon.out gmon.out errlist
-
-$(O1) $(O2) $(O3): index.h
+ rm -f *.[oa] $(TPROG1) $(TPROG2) $(TPROG3)
+ rm -f core mon.out gmon.out errlist
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dir.c,v $
- * Revision 1.3 1995-09-01 14:06:35 adam
+ * Revision 1.4 1995-09-04 12:33:41 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.3 1995/09/01 14:06:35 adam
* Split of work into more files.
*
* Revision 1.2 1995/09/01 10:57:07 adam
#include <fcntl.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
struct dir_entry *dir_open (const char *rep)
size_t idx = 0;
struct dir_entry *entry;
- log (LOG_DEBUG, "dir_open %s", rep);
+ logf (LOG_DEBUG, "dir_open %s", rep);
if (!(dir = opendir(rep)))
{
- log (LOG_WARN|LOG_ERRNO, "opendir %s", rep);
+ logf (LOG_WARN|LOG_ERRNO, "opendir %s", rep);
if (errno != ENOENT)
exit (1);
return NULL;
}
if (!(entry = malloc (sizeof(*entry) * entry_max)))
{
- log (LOG_FATAL|LOG_ERRNO, "malloc");
+ logf (LOG_FATAL|LOG_ERRNO, "malloc");
exit (1);
}
while ((dent = readdir (dir)))
if (!(entry_n = malloc (sizeof(*entry) * (entry_max + 100))))
{
- log (LOG_FATAL|LOG_ERRNO, "malloc");
+ logf (LOG_FATAL|LOG_ERRNO, "malloc");
exit (1);
}
memcpy (entry_n, entry, idx * sizeof(*entry));
}
if (!(entry[idx].name = malloc (strlen(dent->d_name)+1)))
{
- log (LOG_FATAL|LOG_ERRNO, "malloc");
+ logf (LOG_FATAL|LOG_ERRNO, "malloc");
exit (1);
}
strcpy (entry[idx].name, dent->d_name);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.2 1995-09-04 09:10:34 adam
+ * Revision 1.3 1995-09-04 12:33:41 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.2 1995/09/04 09:10:34 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
#include <fcntl.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
#define KEY_BUF_SIZE 100000
return;
if ((key_fd = open (fname, O_RDWR|O_CREAT, 0666)) == -1)
{
- log (LOG_FATAL|LOG_ERRNO, "Creat %s", fname);
+ logf (LOG_FATAL|LOG_ERRNO, "Creat %s", fname);
exit (1);
}
- log (LOG_DEBUG, "key_open of %s", fname);
+ logf (LOG_DEBUG, "key_open of %s", fname);
if (!(key_buf = malloc (KEY_BUF_SIZE)))
{
- log (LOG_FATAL|LOG_ERRNO, "malloc");
+ logf (LOG_FATAL|LOG_ERRNO, "malloc");
exit (1);
}
key_offset = 0;
if (!(file_idx = dict_open ("fileidx", 10, 1)))
{
- log (LOG_FATAL, "dict_open fail of %s", "fileidx");
+ logf (LOG_FATAL, "dict_open fail of %s", "fileidx");
exit (1);
}
file_key = dict_lookup (file_idx, ".");
{
if (key_fd == -1)
{
- log (LOG_DEBUG, "key_close - but no file");
+ logf (LOG_DEBUG, "key_close - but no file");
return 0;
}
close (key_fd);
dict_insert (file_idx, ".", sizeof(sysno_next), &sysno_next);
dict_close (file_idx);
key_fd = -1;
- log (LOG_DEBUG, "key close - key file exist");
+ logf (LOG_DEBUG, "key close - key file exist");
return 1;
}
w = write (key_fd, key_buf + i, key_offset - i);
if (w == -1)
{
- log (LOG_FATAL|LOG_ERRNO, "Write key fail");
+ logf (LOG_FATAL|LOG_ERRNO, "Write key fail");
exit (1);
}
i += w;
int c;
char w[256];
- log (LOG_DEBUG, "Text extract of %d", sysno);
+ logf (LOG_DEBUG, "Text extract of %d", sysno);
k.sysno = sysno;
inf = fopen (fname, "r");
if (!inf)
{
- log (LOG_WARN|LOG_ERRNO, "open %s", fname);
+ logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
return;
}
while ((c=getc (inf)) != EOF)
const char *file_type;
void *file_info;
- log (LOG_DEBUG, "%c %s k=%s", cmd, fname, kname);
+ logf (LOG_DEBUG, "%c %s k=%s", cmd, fname, kname);
for (i = strlen(fname); --i >= 0; )
if (fname[i] == '/')
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.4 1995-09-04 09:10:35 adam
+ * Revision 1.5 1995-09-04 12:33:42 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1995/09/04 09:10:35 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
*
*/
-#include <util.h>
+#include <alexutil.h>
#include <dict.h>
#include <isam.h>
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kdump.c,v $
- * Revision 1.1 1995-09-04 09:10:36 adam
+ * Revision 1.2 1995-09-04 12:33:42 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1995/09/04 09:10:36 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
#include <assert.h>
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
char *prog;
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
}
if (!(inf = fopen (key_fname, "r")))
{
- log (LOG_FATAL|LOG_ERRNO, "fopen %s", key_fname);
+ logf (LOG_FATAL|LOG_ERRNO, "fopen %s", key_fname);
exit (1);
}
while (read_one (inf, key_string, key_info))
}
if (fclose (inf))
{
- log (LOG_FATAL|LOG_ERRNO, "fclose %s", key_fname);
+ logf (LOG_FATAL|LOG_ERRNO, "fclose %s", key_fname);
exit (1);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kinput.c,v $
- * Revision 1.1 1995-09-04 09:10:37 adam
+ * Revision 1.2 1995-09-04 12:33:42 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1995/09/04 09:10:37 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
key_buf = xmalloc (key_buf_size * (KEY_SIZE));
if (!(inf = fopen (name, "r")))
{
- log (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", name);
+ logf (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", name);
exit (1);
}
read_one (inf, cur_name, key_buf);
if ((info = dict_lookup (dict, cur_name)))
{
ISAM_P isam_p, isam_p2;
- log (LOG_DEBUG, "updating %s", cur_name);
+ logf (LOG_DEBUG, "updating %s", cur_name);
no_updates++;
memcpy (&isam_p, info+1, sizeof(ISAM_P));
isam_p2 = is_merge (isam, isam_p, nmemb, key_buf);
else
{
ISAM_P isam_p;
- log (LOG_DEBUG, "inserting %s", cur_name);
+ logf (LOG_DEBUG, "inserting %s", cur_name);
no_insertions++;
isam_p = is_merge (isam, 0, nmemb, key_buf);
dict_insert (dict, cur_name, sizeof(ISAM_P), &isam_p);
dict = dict_open (dict_fname, cache, 1);
if (!dict)
{
- log (LOG_FATAL, "dict_open fail of `%s'", dict_fname);
+ logf (LOG_FATAL, "dict_open fail of `%s'", dict_fname);
exit (1);
}
isam = is_open (isam_fname, key_compare, 1);
if (!isam)
{
- log (LOG_FATAL, "is_open fail of `%s'", isam_fname);
+ logf (LOG_FATAL, "is_open fail of `%s'", isam_fname);
exit (1);
}
inp (dict, isam, key_fname);
dict_close (dict);
is_close (isam);
- log (LOG_LOG, "Iterations . . .%7d", no_iterations);
- log (LOG_LOG, "Distinct words .%7d", no_diffs);
- log (LOG_LOG, "Updates. . . . .%7d", no_updates);
- log (LOG_LOG, "Insertions . . .%7d", no_insertions);
+ logf (LOG_LOG, "Iterations . . .%7d", no_iterations);
+ logf (LOG_LOG, "Distinct words .%7d", no_diffs);
+ logf (LOG_LOG, "Updates. . . . .%7d", no_updates);
+ logf (LOG_LOG, "Insertions . . .%7d", no_insertions);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.5 1995-09-04 09:10:39 adam
+ * Revision 1.6 1995-09-04 12:33:43 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.5 1995/09/04 09:10:39 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
#include <assert.h>
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
char *prog;
common_resource = res_open (base_name);
if (!common_resource)
{
- log (LOG_FATAL, "Cannot open resource `%s'", base_name);
+ logf (LOG_FATAL, "Cannot open resource `%s'", base_name);
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown command: %s", arg);
+ logf (LOG_FATAL, "Unknown command: %s", arg);
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
key_flush ();
if (!key_close ())
exit (0);
- log (LOG_DEBUG, "Sorting");
+ logf (LOG_DEBUG, "Sorting");
if (!key_sort ("keys.tmp", 1000000))
exit (0);
- log (LOG_DEBUG, "Input");
+ logf (LOG_DEBUG, "Input");
key_input ("dictinv", "isaminv", "keys.tmp", 50);
exit (0);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: trav.c,v $
- * Revision 1.1 1995-09-01 14:06:36 adam
+ * Revision 1.2 1995-09-04 12:33:43 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1995/09/01 14:06:36 adam
* Split of work into more files.
*
*/
#include <fcntl.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
static void repository_extract_r (int cmd, char *rep)
if (d_fd == -1)
{
- log (LOG_FATAL|LOG_ERRNO, "Cannot create %s", dst);
+ logf (LOG_FATAL|LOG_ERRNO, "Cannot create %s", dst);
exit (1);
}
if (s_fd == -1)
{
- log (LOG_FATAL|LOG_ERRNO, "Cannot open %s", src);
+ logf (LOG_FATAL|LOG_ERRNO, "Cannot open %s", src);
exit (1);
}
if (!(buf = malloc (4096)))
{
- log (LOG_FATAL|LOG_ERRNO, "malloc");
+ logf (LOG_FATAL|LOG_ERRNO, "malloc");
exit (1);
}
while ((r=read (s_fd, buf, 4096))>0)
i = write (d_fd, buf + w, r - w);
if (i == -1)
{
- log (LOG_FATAL|LOG_ERRNO, "write");
+ logf (LOG_FATAL|LOG_ERRNO, "write");
exit (1);
}
}
if (r)
{
- log (LOG_FATAL|LOG_ERRNO, "read");
+ logf (LOG_FATAL|LOG_ERRNO, "read");
exit (1);
}
free (buf);
void del_dir (const char *dst)
{
- log (LOG_DEBUG, "rmdir of %s", dst);
+ logf (LOG_DEBUG, "rmdir of %s", dst);
if (rmdir (dst) == -1)
- log (LOG_ERRNO|LOG_WARN, "rmdir");
+ logf (LOG_ERRNO|LOG_WARN, "rmdir");
}
void repository_update_r (int cmd, char *dst, char *src);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.1 1995-09-04 09:10:40 adam
+ * Revision 1.2 1995-09-04 12:33:43 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1995/09/04 09:10:40 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
#include <assert.h>
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
#include <dict.h>
#include <isam.h>
#include <rsisam.h>
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.1 1995-09-04 09:10:41 adam
+ * Revision 1.2 1995-09-04 12:33:43 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1995/09/04 09:10:41 adam
* More work on index add/del/update.
* Merge sort implemented.
* Initial work on z39 server.
#include <assert.h>
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
#include "index.h"
char *prog;
common_resource = res_open (base_name);
if (!common_resource)
{
- log (LOG_FATAL, "Cannot open resource `%s'", base_name);
+ logf (LOG_FATAL, "Cannot open resource `%s'", base_name);
exit (1);
}
}
}
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
}
if (!base_name)
{
- fprintf (stderr, "search [-v log] base ...\n");
+ fprintf (stderr, "zserver [-v log] base ...\n");
exit (1);
}
exit (0);
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.12 1995-01-24 16:01:34 adam Exp $
+# $Id: Makefile,v 1.13 1995-09-04 12:33:46 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include
-CFLAGS=-g -Wall -pedantic -ansi
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
+#CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
LIB=../lib/isam.a
PO = isam.o isutil.o rootblk.o memory.o physical.o
test: test.c $(LIB)
$(CC) -g -o test -I../include test.c \
- ../lib/isam.a ../lib/bfile.a ../lib/util.a
+ ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB)
isam-test: isam-test.c $(LIB)
$(CC) -g -o isam-test -I../include isam-test.c \
- ../lib/isam.a ../lib/bfile.a ../lib/util.a
+ ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB)
issh: issh.c $(LIB)
$(CC) -g -o issh -I../include issh.c \
- ../lib/isam.a ../lib/bfile.a ../lib/util.a
+ ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB)
#$(TPROG): $(TPROG).o $(LIB)
# $(CC) -o $(TPROG) $(TPROG).o $(LIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isam.c,v $
- * Revision 1.10 1994-09-28 16:58:32 quinn
+ * Revision 1.11 1995-09-04 12:33:46 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.10 1994/09/28 16:58:32 quinn
* Small mod.
*
* Revision 1.9 1994/09/28 12:56:15 quinn
*
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <util.h>
+#include <alexutil.h>
#include <bfile.h>
#include <isam.h>
#include <common.h>
ct++;
if (ct > max)
{
- log(LOG_WARN, "Ignoring extra args to is resource");
+ logf (LOG_WARN, "Ignoring extra args to is resource");
bf[ct] = '\0';
return(ct - 1);
}
int num, size, rs, tmp, i;
is_type_header th;
- log(LOG_DEBUG, "is_open(%s, %s)", name, writeflag ? "RW" : "RDONLY");
+ logf (LOG_DEBUG, "is_open(%s, %s)", name, writeflag ? "RW" : "RDONLY");
new = xmalloc(sizeof(*new));
new->writeflag = writeflag;
for (i = 0; i < IS_MAX_BLOCKTYPES; i++)
if (!(r = res_get(common_resource, nm = strconcat(name, ".",
"blocktypes", 0))) || !(num = splitargs(r, pp, IS_MAX_BLOCKTYPES)))
{
- log(LOG_FATAL, "Failed to locate resource %s", nm);
+ logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
new->num_types = num;
{
if ((rs = sscanf(pp[i], "%d%1[bBkKmM]", &size, m)) < 1)
{
- log(LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
+ logf (LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
return 0;
}
if (rs == 1)
case 'm': case 'M':
new->types[i].blocksize = size * 1048576; break;
default:
- log(LOG_FATAL, "Illegal size suffix: %c", *m);
+ logf (LOG_FATAL, "Illegal size suffix: %c", *m);
return 0;
}
new->types[i].dbuf = xmalloc(new->types[i].blocksize);
if (!(new->types[i].bf = bf_open(strconcat(name, m, 0),
new->types[i].blocksize, writeflag)))
{
- log(LOG_FATAL, "bf_open failed");
+ logf (LOG_FATAL, "bf_open failed");
return 0;
}
if ((rs = is_rb_read(&new->types[i], &th)) > 0)
{
if (th.blocksize != new->types[i].blocksize)
{
- log(LOG_FATAL, "File blocksize mismatch in %s", name);
+ logf (LOG_FATAL, "File blocksize mismatch in %s", name);
exit(1);
}
new->types[i].freelist = th.freelist;
{
if ((rs = is_rb_write(&new->types[i], &th)) <=0) /* dummy */
{
- log(LOG_FATAL, "Failed to write initial superblock.");
+ logf (LOG_FATAL, "Failed to write initial superblock.");
exit(1);
}
new->types[i].freelist = -1;
if (!(r = res_get_def(common_resource, nm = strconcat(name, ".", "keysize",
0), "4")))
{
- log(LOG_FATAL, "Failed to locate resource %s", nm);
+ logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
if ((new->keysize = atoi(r)) <= 0)
{
- log(LOG_FATAL, "Must specify positive keysize.");
+ logf (LOG_FATAL, "Must specify positive keysize.");
return 0;
}
if (!(r = res_get_def(common_resource, nm = strconcat(name, ".", "repack",
0), IS_DEF_REPACK_PERCENT)))
{
- log(LOG_FATAL, "Failed to locate resource %s", nm);
+ logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
new->repack = atoi(r);
if (!(r = res_get(common_resource, nm = strconcat(name, ".",
"maxkeys", 0))) || !(num = splitargs(r, pp, IS_MAX_BLOCKTYPES)))
{
- log(LOG_FATAL, "Failed to locate resource %s", nm);
+ logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
if (num < new->num_types -1)
{
- log(LOG_FATAL, "Not enough elements in %s", nm);
+ logf (LOG_FATAL, "Not enough elements in %s", nm);
return 0;
}
for (i = 0; i < num; i++)
{
if ((rs = sscanf(pp[i], "%d", &tmp)) < 1)
{
- log(LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
+ logf (LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
return 0;
}
new->types[i].max_keys = tmp;
new->keysize;
if (new->types[i].max_keys_block0 < 1)
{
- log(LOG_FATAL, "Blocksize too small in %s", name);
+ logf (LOG_FATAL, "Blocksize too small in %s", name);
exit(1);
}
}
if (!(r = res_get(common_resource, nm = strconcat(name, ".",
"nicefill", 0))) || !(num = splitargs(r, pp, IS_MAX_BLOCKTYPES)))
{
- log(LOG_FATAL, "Failed to locate resource %s", nm);
+ logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
if (num < new->num_types)
{
- log(LOG_FATAL, "Not enough elements in %s", nm);
+ logf (LOG_FATAL, "Not enough elements in %s", nm);
return 0;
}
for (i = 0; i < num; i++)
{
if ((rs = sscanf(pp[i], "%d", &tmp)) < 1)
{
- log(LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
+ logf (LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
return 0;
}
new->types[i].nice_keys_block = (new->types[i].max_keys_block0 * tmp) /
int i;
is_type_header th;
- log(LOG_DEBUG, "is_close()");
+ logf (LOG_DEBUG, "is_close()");
for (i = 0; i < is->num_types; i++)
{
if (is->types[i].bf)
th.top = is->types[i].top;
if (is_rb_write(&is->types[i], &th) < 0)
{
- log(LOG_FATAL, "Failed to write headerblock");
+ logf (LOG_FATAL, "Failed to write headerblock");
exit(1);
}
}
if (pos)
if (is_m_read_full(&tab, tab.data) < 0)
{
- log(LOG_FATAL, "read_full failed");
+ logf (LOG_FATAL, "read_full failed");
exit(1);
}
oldnum = tab.num_records;
{
if (operation == KEYOP_INSERT)
{
- log(LOG_DEBUG, "XXInserting new record.");
+ logf (LOG_DEBUG, "XXInserting new record.");
is_m_write_record(&tab, record);
}
else
- log(LOG_DEBUG, "XXDeletion failed to find match.");
+ logf (LOG_DEBUG, "XXDeletion failed to find match.");
}
else /* match found */
{
if (operation == KEYOP_INSERT)
{
- log(LOG_DEBUG, "XXSkipping insertion - match found.");
+ logf (LOG_DEBUG, "XXSkipping insertion - match found.");
continue;
}
else if (operation == KEYOP_DELETE)
/* next key is identical insert? - NOOP - skip it */
if (!memcmp(record, data + 1, is_keysize(is)))
{
- log(LOG_DEBUG, "XXNoop delete. skipping.");
+ logf (LOG_DEBUG, "XXNoop delete. skipping.");
data += 1 + is_keysize(is);
num--;
continue;
res = (*is->cmp)(data + 1, keybuf);
if (res < 0)
{
- log(LOG_DEBUG, "XXReplacing record.");
+ logf (LOG_DEBUG, "XXReplacing record.");
is_m_replace_record(&tab, data + 1);
data += 1 + is_keysize(is);
num--;
continue;
}
}
- log(LOG_DEBUG, "Deleting record.");
+ logf (LOG_DEBUG, "Deleting record.");
is_m_delete_record(&tab);
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isutil.c,v $
- * Revision 1.1 1994-09-12 08:02:13 quinn
+ * Revision 1.2 1995-09-04 12:33:46 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1994/09/12 08:02:13 quinn
* Not functional yet
*
*/
* may move to util/ along the way.
*/
+#include <stdio.h>
#include <string.h>
#include <stdarg.h>
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: memory.c,v $
- * Revision 1.5 1994-09-28 16:58:33 quinn
+ * Revision 1.6 1995-09-04 12:33:47 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.5 1994/09/28 16:58:33 quinn
* Small mod.
*
* Revision 1.4 1994/09/27 20:03:52 quinn
*/
#include <assert.h>
+#include <stdio.h>
-#include <util.h>
+#include <alexutil.h>
#include <isam.h>
int is_mbuf_size[3] = { 0, 1024, 4096 };
mbuf = tab->cur_mblock->cur_mbuf = mbuf->next;
mbuf->cur_record = 0;
}
- log(LOG_DEBUG, "is_m_write_rec(rec == %d)", mbuf->cur_record);
+ logf (LOG_DEBUG, "is_m_write_rec(rec == %d)", mbuf->cur_record);
memcpy(mbuf->data + mbuf->offset + mbuf->cur_record * is_keysize(tab->is),
rec, is_keysize(tab->is));
mbuf->num++;
if (tab->data->state < IS_MBSTATE_PARTIAL)
if (read_current_full(tab, tab->data) < 0)
{
- log(LOG_FATAL, "read full failed");
+ logf (LOG_FATAL, "read full failed");
exit(1);
}
return tab->num_records;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: physical.c,v $
- * Revision 1.5 1994-09-28 11:29:33 quinn
+ * Revision 1.6 1995-09-04 12:33:47 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.5 1994/09/28 11:29:33 quinn
* Added cmp parameter.
*
* Revision 1.4 1994/09/27 20:03:53 quinn
*/
#include <assert.h>
+#include <stdio.h>
#include <isam.h>
if (bf_read(is->types[type].bf, tmp, 0, sizeof(tmp),
&is->types[type].freelist) <=0)
{
- log(LOG_FATAL, "Failed to allocate block");
+ logf (LOG_FATAL, "Failed to allocate block");
exit(1);
}
}
else
tmp = is->types[type].top++;
- log(LOG_DEBUG, "Allocating block #%d", tmp);
+ logf (LOG_DEBUG, "Allocating block #%d", tmp);
return tmp;
}
{
int tmp;
- log(LOG_DEBUG, "Releasing block #%d", block);
+ logf (LOG_DEBUG, "Releasing block #%d", block);
tmp = is->types[type].freelist;
is->types[type].freelist = block;
if (bf_write(is->types[type].bf, block, 0, sizeof(tmp), &tmp) < 0)
{
- log(LOG_FATAL, "Failed to deallocate block.");
+ logf (LOG_FATAL, "Failed to deallocate block.");
exit(1);
}
}
if (bf_read(tab->is->types[tab->pos_type].bf, block->diskpos, 0, toread,
buf->data) < 0)
{
- log(LOG_FATAL, "bfread failed.");
+ logf (LOG_FATAL, "bfread failed.");
return -1;
}
/* extract header info */
if (block->state == IS_MBSTATE_UNREAD && is_p_read_partial(tab, block) < 0)
{
- log(LOG_FATAL, "partial read failed.");
+ logf (LOG_FATAL, "partial read failed.");
return -1;
}
if (block->state == IS_MBSTATE_PARTIAL)
if (bf_read(tab->is->types[tab->pos_type].bf, block->diskpos, block->bread, toread *
is_keysize(tab->is), buf->data) < 0)
{
- log(LOG_FATAL, "bfread failed.");
+ logf (LOG_FATAL, "bfread failed.");
return -1;
}
buf->offset = 0;
block->bread += toread * is_keysize(tab->is);
}
}
- log(LOG_DEBUG, "R: Block #%d contains %d records.", block->diskpos, block->num_records);
+ logf (LOG_DEBUG, "R: Block #%d contains %d records.", block->diskpos, block->num_records);
return 0;
}
}
if (bf_write(type->bf, p->diskpos, 0, sum, type->dbuf) < 0)
{
- log(LOG_FATAL, "Failed to write block.");
+ logf (LOG_FATAL, "Failed to write block.");
exit(1);
}
- log(LOG_DEBUG, "W: Block #%d contains %d records.", p->diskpos, p->num_records);
+ logf (LOG_DEBUG, "W: Block #%d contains %d records.", p->diskpos, p->num_records);
}
}
is_mbuf *mbufs, *mbp;
int blocks, recsblock;
- log(LOG_DEBUG, "Realigning table.");
+ logf (LOG_DEBUG, "Realigning table.");
for (mblock = tab->data; mblock; mblock = next)
{
next = mblock->next;
is_mblock *blockp, **blockpp;
int recsblock, blocks;
- log(LOG_DEBUG, "Remapping table.");
+ logf (LOG_DEBUG, "Remapping table.");
/* collect all data */
bufpp = &mbufs;
for (blockp = tab->data; blockp; blockp = blockp->next)
{
if (blockp->state < IS_MBSTATE_CLEAN && is_m_read_full(tab, blockp) < 0)
{
- log(LOG_FATAL, "Read-full failed in remap.");
+ logf (LOG_FATAL, "Read-full failed in remap.");
exit(1);
}
*bufpp = blockp->data;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rootblk.c,v $
- * Revision 1.1 1994-09-26 16:08:00 quinn
+ * Revision 1.2 1995-09-04 12:33:47 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1994/09/26 16:08:00 quinn
* Most of the functionality in place.
*
*/
* Read and write the blocktype header.
*/
+#include <stdio.h>
#include <isam.h>
#include "rootblk.h"
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.3 1995-01-24 16:01:44 adam Exp $
+# $Id: Makefile,v 1.4 1995-09-04 12:33:55 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include
-CFLAGS=-g -Wall -pedantic -ansi
+RANLIB=ranlib
+YAZ=../../yaz
+INCLUDE=-I../include -I$(YAZ)/include
+#CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
LIB=../lib/rset.a
PROG=
PO=rset.o rstemp.o rsisam.o
CPP=cc -E
-all: $(PROG) $(LIB)
-
-$(PROG): $(PROG).o
- $(CC) -o $(PROG) $(INCLUDE) $(CFLAGS) $(PROG).o $(LIB)
-
+all: $(LIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rset.c,v $
- * Revision 1.1 1994-11-04 13:21:28 quinn
+ * Revision 1.2 1995-09-04 12:33:56 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.1 1994/11/04 13:21:28 quinn
* Working.
*
*/
/* TODO: mem management */
-#include <util.h>
+#include <stdio.h>
+#include <alexutil.h>
#include <rset.h>
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsisam.c,v $
- * Revision 1.4 1995-09-04 09:10:55 adam
+ * Revision 1.5 1995-09-04 12:33:56 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1995/09/04 09:10:55 adam
* Minor changes.
*
* Revision 1.3 1994/11/22 13:15:37 quinn
/* TODO: Memory management
LINK DELETE TO CLOSE! */
+#include <stdio.h>
#include <rsisam.h>
-#include <util.h>
+#include <alexutil.h>
static rset_control *r_create(const struct rset_control *sel, void *parms);
static int r_open(rset_control *ct, int wflag);
rset_control *newct;
rset_isam_parms *pt = parms;
- log(LOG_DEBUG, "risam_create(%s)", sel->desc);
+ logf (LOG_DEBUG, "risam_create(%s)", sel->desc);
newct = xmalloc(sizeof(*newct));
memcpy(newct, sel, sizeof(*sel));
if (!(newct->buf = (char*) is_position(pt->is, pt->pos)))
static int r_open(rset_control *ct, int wflag)
{
- log(LOG_DEBUG, "risam_open");
+ logf (LOG_DEBUG, "risam_open");
if (wflag)
{
- log(LOG_FATAL, "ISAM set type is read-only");
+ logf (LOG_FATAL, "ISAM set type is read-only");
return -1;
}
r_rewind(ct);
static void r_delete(rset_control *ct)
{
- log(LOG_DEBUG, "risam_delete");
+ logf (LOG_DEBUG, "risam_delete");
is_pt_free((ISPT) ct->buf);
xfree(ct);
}
static void r_rewind(rset_control *ct)
{
- log(LOG_DEBUG, "risam_rewind");
+ logf (LOG_DEBUG, "risam_rewind");
is_rewind((ISPT) ct->buf);
}
static int r_write()
{
- log(LOG_FATAL, "ISAM set type is read-only");
+ logf (LOG_FATAL, "ISAM set type is read-only");
return -1;
}
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.16 1995-01-24 16:01:50 adam Exp $
+# $Id: Makefile,v 1.17 1995-09-04 12:34:05 adam Exp $
SHELL=/bin/sh
-INCLUDE=-I../include
+RANLIB=ranlib
+YAZ=../../yaz
+YAZLIB=$(YAZ)/lib/libyaz.a
+INCLUDE=-I../include -I$(YAZ)/include
TPROG=opt-test
-CFLAGS=-g -Wall -pedantic -ansi
+#CFLAGS=-g -Wall -pedantic -ansi
DEFS=$(INCLUDE)
-LIB=../lib/util.a
-PO = options.o xmalloc.o log.o res.o alexpath.o common.o
CPP=cc -E
+LIB=../lib/alexutil.a
+PO = xmalloc.o res.o alexpath.o common.o
all: $(LIB)
-alll: opt-test res-test all
+alll: res-test all
-opt-test: opt-test.o $(LIB)
- $(CC) -o opt-test opt-test.o $(LIB)
-
-res-test: res-test.o $(LIB)
- $(CC) -o res-test res-test.o $(LIB)
+res-test: res-test.o $(LIB) $(YAZLIB)
+ $(CC) -o res-test res-test.o $(LIB) $(YAZLIB)
$(LIB): $(PO)
rm -f $(LIB)
ar qc $(LIB) $(PO)
- ranlib $(LIB)
+ $(RANLIB) $(LIB)
.c.o:
$(CC) -c $(DEFS) $(CFLAGS) $<
clean:
- rm -f *.[oa] opt-test res-test core mon.out gmon.out errlist
+ rm -f *.[oa] res-test core mon.out gmon.out errlist
depend: depend2
depend1:
- mv Makefile Makefile.tmp
- sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) $(INCLUDE) -M *.c >>Makefile
- -rm Makefile.tmp
+ sed '/^#Depend/q' <Makefile >Makefile.tmp
+ $(CPP) $(DEFS) -M *.c >>Makefile.tmp
+ mv -f Makefile.tmp Makefile
depend2:
- $(CPP) $(INCLUDE) -M *.c >.depend
+ $(CPP) $(DEFS) -M *.c >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: res-test.c,v $
- * Revision 1.4 1994-10-04 17:47:11 adam
+ * Revision 1.5 1995-09-04 12:34:05 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.4 1994/10/04 17:47:11 adam
* Function options now returns arg with error option.
*
* Revision 1.3 1994/08/18 11:02:27 adam
*/
#include <stdio.h>
-#include <util.h>
+#include <alexutil.h>
static void res_print (const char *name, const char *value)
{
- log (LOG_LOG, "%s=%s", name, value);
+ logf (LOG_LOG, "%s=%s", name, value);
}
int main(int argc, char **argv)
write_flag = 1;
else
{
- log (LOG_FATAL, "Unknown option '-%s'", arg);
+ logf (LOG_FATAL, "Unknown option '-%s'", arg);
exit (1);
}
if (!resfile)
{
- log (LOG_FATAL, "No resource file given.");
+ logf (LOG_FATAL, "No resource file given.");
exit (1);
}
res = res_open (resfile);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: res.c,v $
- * Revision 1.12 1995-01-24 16:40:32 adam
+ * Revision 1.13 1995-09-04 12:34:05 adam
+ * Various cleanup. YAZ util used instead.
+ *
+ * Revision 1.12 1995/01/24 16:40:32 adam
* Bug fix.
*
* Revision 1.11 1994/10/05 16:54:52 adam
#include <string.h>
#include <assert.h>
#include <unistd.h>
-#include <util.h>
+#include <alexutil.h>
static struct res_entry *add_entry (Res r)
{
fr = fopen (path, "r");
if (!fr)
{
- log (LOG_FATAL|LOG_ERRNO, "Cannot open %s", path);
+ logf (LOG_FATAL|LOG_ERRNO, "Cannot open %s", path);
exit (1);
}
while (1)
val_buf[val_size++] = '\0';
resp->value = xmalloc (val_size);
strcpy (resp->value, val_buf);
- log (LOG_DEBUG, "(name=%s,value=%s)",
+ logf (LOG_DEBUG, "(name=%s,value=%s)",
resp->name, resp->value);
break;
}
{
Res r;
if (access (name, R_OK))
- log (LOG_LOG|LOG_ERRNO, "Cannot access `%s'", name);
+ logf (LOG_LOG|LOG_ERRNO, "Cannot access `%s'", name);
r = xmalloc (sizeof(*r));
r->init = 0;
r->first = r->last = NULL;
if (!(t = res_get (r, name)))
{
- log(LOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
+ logf (LOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
return def;
}
else
fr = fopen (path, "w");
if (!fr)
{
- log (LOG_FATAL|LOG_ERRNO, "Cannot create %s", path);
+ logf (LOG_FATAL|LOG_ERRNO, "Cannot create %s", path);
exit (1);
}