From 5437b50633032595afe6f87dc0f989bc92a5aea8 Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Fri, 19 Nov 2004 10:26:52 +0000 Subject: [PATCH] Using the new ylog.h everywhere, and fixing what that breaks! --- bfile/bfile.c | 12 +-- bfile/cfile.c | 28 +++--- bfile/commit.c | 16 ++-- bfile/mfile.c | 58 ++++++------- configure.in | 4 +- data1/d1_absyn.c | 80 ++++++++--------- data1/d1_attset.c | 20 ++--- data1/d1_doespec.c | 6 +- data1/d1_espec.c | 26 +++--- data1/d1_expout.c | 12 +-- data1/d1_grs.c | 14 +-- data1/d1_handle.c | 8 +- data1/d1_if.c | 16 ++-- data1/d1_map.c | 22 ++--- data1/d1_marc.c | 30 +++---- data1/d1_prtree.c | 4 +- data1/d1_read.c | 14 +-- data1/d1_sumout.c | 10 +-- data1/d1_tagset.c | 24 +++--- data1/d1_varset.c | 26 +++--- dfa/dfa.c | 4 +- dfa/grepper.c | 6 +- dfa/imalloc.c | 18 ++-- dict/dcompact.c | 12 +-- dict/dictext.c | 8 +- dict/dicttest.c | 42 ++++----- dict/drdwr.c | 8 +- dict/insert.c | 4 +- dict/lookgrep.c | 10 +-- dict/open.c | 10 +-- dict/scan.c | 6 +- include/dict.h | 4 +- include/zebrautl.h | 7 +- index/apitest.c | 6 +- index/attribute.c | 4 +- index/dir.c | 8 +- index/dirs.c | 18 ++-- index/extract.c | 138 +++++++++++++++--------------- index/invstat.c | 4 +- index/kcompare.c | 6 +- index/kdump.c | 10 +-- index/kinput.c | 36 ++++---- index/lockidx.c | 52 +++++------ index/locksrv.c | 18 ++-- index/lockutil.c | 4 +- index/main.c | 16 ++-- index/recindex.c | 32 +++---- index/recstat.c | 12 +-- index/retrieve.c | 12 +-- index/sortidx.c | 6 +- index/trav.c | 30 +++---- index/trunc.c | 8 +- index/zebraapi.c | 223 +++++++++++++++++++++++++----------------------- index/zebrash.c | 29 ++++--- index/zinfo.c | 32 +++---- index/zrpn.c | 118 ++++++++++++------------- index/zserver.c | 96 ++++++++++----------- index/zsets.c | 34 ++++---- isamb/isamb.c | 94 ++++++++++---------- isamb/tstisamb.c | 24 +++--- isamc/isamc.c | 38 ++++----- isamc/merge.c | 40 ++++----- isamg/isamg.c | 9 +- isams/isams.c | 12 +-- perl/zebra_perl.c | 22 ++--- recctrl/danbibr.c | 4 +- recctrl/marcread.c | 32 +++---- recctrl/recctrl.c | 12 +-- recctrl/recgrs.c | 68 +++++++-------- recctrl/rectext.c | 4 +- recctrl/regxread.c | 108 +++++++++++------------ recctrl/sgmlread.c | 4 +- recctrl/xmlread.c | 30 +++---- rset/rsbetween.c | 40 ++++----- rset/rsbool.c | 52 +++++------ rset/rset.c | 22 ++--- rset/rsisamb.c | 6 +- rset/rsisamc.c | 6 +- rset/rsisams.c | 10 +-- rset/rsmultiandor.c | 16 ++-- rset/rsnull.c | 6 +- rset/rsprox.c | 12 +-- rset/rstemp.c | 26 +++--- test/Makefile.am | 2 +- test/api/t10.c | 4 +- test/api/testlib.c | 24 +++--- test/api/testlib.h | 5 +- test/api/xpath1.c | 3 +- test/xpath/Makefile.am | 9 +- test/xpath/dummy.sh | 1 + util/charmap.c | 66 +++++++------- util/passwddb.c | 6 +- util/res-test.c | 12 +-- util/res.c | 12 +-- util/zebramap.c | 18 ++-- 95 files changed, 1204 insertions(+), 1176 deletions(-) create mode 100755 test/xpath/dummy.sh diff --git a/bfile/bfile.c b/bfile/bfile.c index 681c050..3ba061e 100644 --- a/bfile/bfile.c +++ b/bfile/bfile.c @@ -1,4 +1,4 @@ -/* $Id: bfile.c,v 1.36 2004-08-04 08:35:22 adam Exp $ +/* $Id: bfile.c,v 1.37 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -89,7 +89,7 @@ void bf_cache (BFiles bfs, const char *spec) { if (spec) { - yaz_log (LOG_LOG, "enabling cache spec=%s", spec); + yaz_log (YLOG_LOG, "enabling cache spec=%s", spec); if (!bfs->commit_area) bfs->commit_area = mf_init ("shadow", spec, bfs->base); if (bfs->commit_area) @@ -98,7 +98,7 @@ void bf_cache (BFiles bfs, const char *spec) 8); strcpy (bfs->cache_fname, bfs->commit_area->dirs->name); strcat (bfs->cache_fname, "/cache"); - yaz_log (LOG_LOG, "cache_fname = %s", bfs->cache_fname); + yaz_log (YLOG_LOG, "cache_fname = %s", bfs->cache_fname); } } else @@ -133,7 +133,7 @@ BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag) outf = open_cache (bfs, "ab"); if (!outf) { - logf (LOG_FATAL|LOG_ERRNO, "open %s", bfs->cache_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", bfs->cache_fname); exit (1); } fprintf (outf, "%s %d\n", name, block_size); @@ -147,7 +147,7 @@ BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag) } if (!tmp->mf) { - logf (LOG_FATAL, "mf_open failed for %s", name); + yaz_log (YLOG_FATAL, "mf_open failed for %s", name); xfree (tmp); return 0; } @@ -216,7 +216,7 @@ void bf_commitExec (BFiles bfs) assert (bfs->commit_area); if (!(inf = open_cache (bfs, "rb"))) { - logf (LOG_LOG, "No commit file"); + yaz_log (YLOG_LOG, "No commit file"); return ; } while (fscanf (inf, "%s %d", path, &block_size) == 2) diff --git a/bfile/cfile.c b/bfile/cfile.c index 82f84f4..6d460c1 100644 --- a/bfile/cfile.c +++ b/bfile/cfile.c @@ -1,4 +1,4 @@ -/* $Id: cfile.c,v 1.30 2004-08-06 12:55:01 adam Exp $ +/* $Id: cfile.c,v 1.31 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -78,17 +78,17 @@ CFile cf_open (MFile mf, MFile_area area, const char *fname, int hash_bytes; cf->rmf = mf; - logf (LOG_DEBUG, "cf: open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd"); + yaz_log (YLOG_DEBUG, "cf: open %s %s", cf->rmf->name, wflag ? "rdwr" : "rd"); sprintf (path, "%s-b", fname); if (!(cf->block_mf = mf_open (area, path, block_size, wflag))) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to open %s", path); exit (1); } sprintf (path, "%s-i", fname); if (!(cf->hash_mf = mf_open (area, path, HASH_BSIZE, wflag))) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to open %s", path); exit (1); } assert (firstp); @@ -223,7 +223,7 @@ static struct CFile_hash_bucket *get_bucket (CFile cf, zint block_no, int hno) p = alloc_bucket (cf, block_no, hno); if (!mf_read (cf->hash_mf, block_no, 0, 0, &p->ph)) { - logf (LOG_FATAL|LOG_ERRNO, "read get_bucket"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read get_bucket"); exit (1); } assert (p->ph.this_bucket == block_no); @@ -292,13 +292,13 @@ static zint cf_lookup_hash (CFile cf, zint no) { if (hb->ph.this_bucket == block_no) { - logf (LOG_FATAL, "Found hash bucket on other chain (1)"); + yaz_log (YLOG_FATAL, "Found hash bucket on other chain (1)"); abort (); } for (i = 0; iph.vno[i]; i++) if (hb->ph.no[i] == no) { - logf (LOG_FATAL, "Found hash bucket on other chain (2)"); + yaz_log (YLOG_FATAL, "Found hash bucket on other chain (2)"); abort (); } } @@ -330,8 +330,8 @@ static void cf_moveto_flat (CFile cf) int j; zint i; - logf (LOG_DEBUG, "cf: Moving to flat shadow: %s", cf->rmf->name); - logf (LOG_DEBUG, "cf: hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT " total=" + yaz_log (YLOG_DEBUG, "cf: Moving to flat shadow: %s", cf->rmf->name); + yaz_log (YLOG_DEBUG, "cf: hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT " total=" ZINT_FORMAT, cf->no_hits, cf->no_miss, cf->bucket_in_memory, cf->head.next_bucket - cf->head.first_bucket); @@ -343,7 +343,7 @@ static void cf_moveto_flat (CFile cf) { if (!mf_read (cf->hash_mf, i, 0, 0, &p->ph)) { - logf (LOG_FATAL|LOG_ERRNO, "read bucket moveto flat"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read bucket moveto flat"); exit (1); } for (j = 0; j < HASH_BUCKET && p->ph.vno[j]; j++) @@ -411,7 +411,7 @@ static zint cf_new_hash (CFile cf, zint no) { if (hb->ph.this_bucket == *bucketpp) { - logf (LOG_FATAL, "Found hash bucket on other chain"); + yaz_log (YLOG_FATAL, "Found hash bucket on other chain"); abort (); } } @@ -466,7 +466,7 @@ int cf_read (CFile cf, zint no, int offset, int nbytes, void *buf) zebra_mutex_unlock (&cf->mutex); if (!mf_read (cf->block_mf, block, offset, nbytes, buf)) { - logf (LOG_FATAL|LOG_ERRNO, "cf_read no=" ZINT_FORMAT " block=" ZINT_FORMAT, no, block); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "cf_read no=" ZINT_FORMAT " block=" ZINT_FORMAT, no, block); exit (1); } return 1; @@ -493,7 +493,7 @@ int cf_write (CFile cf, zint no, int offset, int nbytes, const void *buf) zebra_mutex_unlock (&cf->mutex); if (mf_write (cf->block_mf, block, offset, nbytes, buf)) { - logf (LOG_FATAL|LOG_ERRNO, "cf_write no=" ZINT_FORMAT + yaz_log (YLOG_FATAL|YLOG_ERRNO, "cf_write no=" ZINT_FORMAT " block=" ZINT_FORMAT, no, block); exit (1); } @@ -502,7 +502,7 @@ int cf_write (CFile cf, zint no, int offset, int nbytes, const void *buf) int cf_close (CFile cf) { - logf (LOG_DEBUG, "cf: close hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT + yaz_log (YLOG_DEBUG, "cf: close hits=%d miss=%d bucket_in_memory=" ZINT_FORMAT " total=" ZINT_FORMAT, cf->no_hits, cf->no_miss, cf->bucket_in_memory, cf->head.next_bucket - cf->head.first_bucket); diff --git a/bfile/commit.c b/bfile/commit.c index 9182537..83d54a9 100644 --- a/bfile/commit.c +++ b/bfile/commit.c @@ -1,4 +1,4 @@ -/* $Id: commit.c,v 1.20 2004-09-13 08:43:28 adam Exp $ +/* $Id: commit.c,v 1.21 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -35,7 +35,7 @@ void cf_unlink (CFile cf) { if (cf->bucket_in_memory) { - logf (LOG_FATAL, "Cannot unlink potential dirty cache"); + yaz_log (YLOG_FATAL, "Cannot unlink potential dirty cache"); exit (1); } cf->head.state = 0; @@ -97,7 +97,7 @@ static void map_cache_flush (struct map_cache *m_p) if (!mf_read (m_p->cf->block_mf, m_p->map[i].from, 0, 0, m_p->buf + i * m_p->cf->head.block_size)) { - logf (LOG_FATAL, "read commit block at position %d", + yaz_log (YLOG_FATAL, "read commit block at position %d", m_p->map[i].from); exit (1); } @@ -156,7 +156,7 @@ static void cf_commit_hash (CFile cf) { if (!mf_read (cf->hash_mf, bucket_no, 0, 0, p)) { - logf (LOG_FATAL, "read commit hash"); + yaz_log (YLOG_FATAL, "read commit hash"); exit (1); } for (i = 0; ivno[i]; i++) @@ -166,7 +166,7 @@ static void cf_commit_hash (CFile cf) #else if (!mf_read (cf->block_mf, p->vno[i], 0, 0, cf->iobuf)) { - logf (LOG_FATAL, "read commit block"); + yaz_log (YLOG_FATAL, "read commit block"); exit (1); } mf_write (cf->rmf, p->no[i], 0, 0, cf->iobuf); @@ -202,7 +202,7 @@ static void cf_commit_flat (CFile cf) if (!mf_read (cf->hash_mf, hno, 0, 0, fp) && hno != cf->head.flat_bucket-1) { - logf (LOG_FATAL, "read index block hno=" ZINT_FORMAT + yaz_log (YLOG_FATAL, "read index block hno=" ZINT_FORMAT " (" ZINT_FORMAT "-" ZINT_FORMAT ") commit", hno, cf->head.next_bucket, cf->head.flat_bucket-1); } @@ -215,7 +215,7 @@ static void cf_commit_flat (CFile cf) #else if (!mf_read (cf->block_mf, fp[i], 0, 0, cf->iobuf)) { - logf (LOG_FATAL, "read data block hno=" ZINT_FORMAT " (" ZINT_FORMAT "-" ZINT_FORMAT ") " + yaz_log (YLOG_FATAL, "read data block hno=" ZINT_FORMAT " (" ZINT_FORMAT "-" ZINT_FORMAT ") " "i=%d commit block at " ZINT_FORMAT " (->" ZINT_FORMAT")", hno, cf->head.next_bucket, cf->head.flat_bucket-1, i, fp[i], vno); @@ -239,7 +239,7 @@ void cf_commit (CFile cf) if (cf->bucket_in_memory) { - logf (LOG_FATAL, "Cannot commit potential dirty cache"); + yaz_log (YLOG_FATAL, "Cannot commit potential dirty cache"); exit (1); } if (cf->head.state == 1) diff --git a/bfile/mfile.c b/bfile/mfile.c index 3993e34..bbbc1cf 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -1,4 +1,4 @@ -/* $Id: mfile.c,v 1.55 2004-08-06 12:55:01 adam Exp $ +/* $Id: mfile.c,v 1.56 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -83,12 +83,12 @@ static int scan_areadef(MFile_area ma, const char *ad, const char *base) dirname[i] = '\0'; if (*ad++ != ':') { - logf (LOG_WARN, "Missing colon after path: %s", ad0); + yaz_log (YLOG_WARN, "Missing colon after path: %s", ad0); return -1; } if (i == 0) { - logf (LOG_WARN, "Empty path: %s", ad0); + yaz_log (YLOG_WARN, "Empty path: %s", ad0); return -1; } while (*ad == ' ' || *ad == '\t') @@ -103,7 +103,7 @@ static int scan_areadef(MFile_area ma, const char *ad, const char *base) size = 0; if (*ad < '0' || *ad > '9') { - logf (LOG_FATAL, "Missing size after path: %s", ad0); + yaz_log (YLOG_FATAL, "Missing size after path: %s", ad0); return -1; } size = 0; @@ -116,10 +116,10 @@ static int scan_areadef(MFile_area ma, const char *ad, const char *base) case 'M': case 'm': multi = 1048576; break; case 'G': case 'g': multi = 1073741824; break; case '\0': - logf (LOG_FATAL, "Missing unit: %s", ad0); + yaz_log (YLOG_FATAL, "Missing unit: %s", ad0); return -1; default: - logf (LOG_FATAL, "Illegal unit: %c in %s", *ad, ad0); + yaz_log (YLOG_FATAL, "Illegal unit: %c in %s", *ad, ad0); return -1; } ad++; @@ -159,7 +159,7 @@ static zint file_position(MFile mf, zint pos, int offset) { if (!mf->wr && errno == ENOENT && off == 0) return -2; - logf (LOG_WARN|LOG_ERRNO, "Failed to open %s", mf->files[c].path); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to open %s", mf->files[c].path); return -1; } } @@ -167,8 +167,8 @@ static zint file_position(MFile mf, zint pos, int offset) if (mfile_seek(mf->files[c].fd, ps * (mfile_off_t) mf->blocksize + offset, SEEK_SET) < 0) { - logf (LOG_WARN|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path); - logf(LOG_WARN, "pos=" ZINT_FORMAT " off=" ZINT_FORMAT " blocksize=%d offset=%d", + yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to seek in %s", mf->files[c].path); + yaz_log(YLOG_WARN, "pos=" ZINT_FORMAT " off=" ZINT_FORMAT " blocksize=%d offset=%d", pos, off, mf->blocksize, offset); return -1; } @@ -201,13 +201,13 @@ MFile_area mf_init(const char *name, const char *spec, const char *base) int fd, number; char metaname[FILENAME_MAX+1], tmpnam[FILENAME_MAX+1]; - logf (LOG_DEBUG, "mf_init(%s)", name); + yaz_log (YLOG_DEBUG, "mf_init(%s)", name); strcpy(ma->name, name); ma->mfiles = 0; ma->dirs = 0; if (scan_areadef(ma, spec, base) < 0) { - logf (LOG_WARN, "Failed to access description of '%s'", name); + yaz_log (YLOG_WARN, "Failed to access description of '%s'", name); return 0; } /* look at each directory */ @@ -215,7 +215,7 @@ MFile_area mf_init(const char *name, const char *spec, const char *base) { if (!(dd = opendir(dirp->name))) { - logf (LOG_WARN|LOG_ERRNO, "Failed to open directory %s", + yaz_log (YLOG_WARN|YLOG_ERRNO, "Failed to open directory %s", dirp->name); return 0; } @@ -264,13 +264,13 @@ MFile_area mf_init(const char *name, const char *spec, const char *base) /* get size */ if ((fd = open(part_f->path, O_BINARY|O_RDONLY)) < 0) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to access %s", + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to access %s", dent->d_name); return 0; } if ((part_f->bytes = mfile_seek(fd, 0, SEEK_END)) < 0) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to seek in %s", + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Failed to seek in %s", dent->d_name); return 0; } @@ -285,7 +285,7 @@ MFile_area mf_init(const char *name, const char *spec, const char *base) } for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next) { - logf (LOG_DEBUG, "mf_init: %s consists of %d part(s)", meta_f->name, + yaz_log (YLOG_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); @@ -359,7 +359,7 @@ MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag) char tmp[FILENAME_MAX+1]; mf_dir *dp; - logf(LOG_DEBUG, "mf_open(%s bs=%d, %s)", name, block_size, + yaz_log(YLOG_DEBUG, "mf_open(%s bs=%d, %s)", name, block_size, wflag ? "RW" : "RDONLY"); assert (ma); for (mnew = ma->mfiles; mnew; mnew = mnew->next) @@ -388,7 +388,7 @@ MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag) mnew->min_bytes_creat; dp = dp->next); if (!dp) { - logf (LOG_FATAL, "Insufficient space for new mfile."); + yaz_log (YLOG_FATAL, "Insufficient space for new mfile."); return 0; } mnew->files[0].dir = dp; @@ -435,7 +435,7 @@ int mf_close(MFile mf) { int i; - logf (LOG_DEBUG, "mf_close(%s)", mf->name); + yaz_log (YLOG_DEBUG, "mf_close(%s)", mf->name); assert(mf->open); for (i = 0; i < mf->no_files; i++) { @@ -472,14 +472,14 @@ int mf_read(MFile mf, zint no, int offset, int nbytes, void *buf) } else { - yaz_log (LOG_FATAL, "mf_read %s internal error", mf->name); + yaz_log (YLOG_FATAL, "mf_read %s internal error", mf->name); exit(1); } } toread = nbytes ? nbytes : mf->blocksize; if ((rd = read(mf->files[mf->cur_file].fd, buf, toread)) < 0) { - logf (LOG_FATAL|LOG_ERRNO, "mf_read: Read failed (%s)", + yaz_log (YLOG_FATAL|YLOG_ERRNO, "mf_read: Read failed (%s)", mf->files[mf->cur_file].path); exit(1); } @@ -505,7 +505,7 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) zebra_mutex_lock (&mf->mutex); if ((ps = file_position(mf, no, offset)) < 0) { - yaz_log (LOG_FATAL, "mf_write %s internal error (1)", mf->name); + yaz_log (YLOG_FATAL, "mf_write %s internal error (1)", mf->name); exit(1); } /* file needs to grow */ @@ -521,20 +521,20 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) if ((nblocks = (int) (mf->files[mf->cur_file].dir->avail_bytes / mf->blocksize)) > 0) { - logf (LOG_DEBUG, "Capping off file %s at pos " ZINT_FORMAT, + yaz_log (YLOG_DEBUG, "Capping off file %s at pos " ZINT_FORMAT, mf->files[mf->cur_file].path, nblocks); if ((ps = file_position(mf, (mf->cur_file ? mf->files[mf->cur_file-1].top : 0) + mf->files[mf->cur_file].blocks + nblocks - 1, 0)) < 0) { - yaz_log (LOG_FATAL, "mf_write %s internal error (2)", + yaz_log (YLOG_FATAL, "mf_write %s internal error (2)", mf->name); exit(1); } - logf (LOG_DEBUG, "ps = " ZINT_FORMAT, ps); + yaz_log (YLOG_DEBUG, "ps = " ZINT_FORMAT, ps); if (write(mf->files[mf->cur_file].fd, &dummych, 1) < 1) { - logf (LOG_ERRNO|LOG_FATAL, "mf_write %s internal error (3)", + yaz_log (YLOG_ERRNO|YLOG_FATAL, "mf_write %s internal error (3)", mf->name); exit(1); } @@ -544,12 +544,12 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) mf->blocksize; } /* get other bit */ - logf (LOG_DEBUG, "Creating new file."); + yaz_log (YLOG_DEBUG, "Creating new file."); for (dp = mf->ma->dirs; dp && dp->max_bytes >= 0 && dp->avail_bytes < needed; dp = dp->next); if (!dp) { - logf (LOG_FATAL, "Cannot allocate more space for %s", + yaz_log (YLOG_FATAL, "Cannot allocate more space for %s", mf->name); exit(1); } @@ -570,7 +570,7 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) /* open new file and position at beginning */ if ((ps = file_position(mf, no, offset)) < 0) { - yaz_log (LOG_FATAL, "mf_write %s internal error (4)", + yaz_log (YLOG_FATAL, "mf_write %s internal error (4)", mf->name); exit(1); } @@ -588,7 +588,7 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) towrite = nbytes ? nbytes : mf->blocksize; if (write(mf->files[mf->cur_file].fd, buf, towrite) < towrite) { - logf (LOG_FATAL|LOG_ERRNO, "Write failed for file %s part %d", + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Write failed for file %s part %d", mf->name, mf->cur_file); exit(1); } diff --git a/configure.in b/configure.in index 936e574..b9314b3 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1995-2004 -dnl $Id: configure.in,v 1.104 2004-11-09 12:02:36 adam Exp $ +dnl $Id: configure.in,v 1.105 2004-11-19 10:26:52 heikki Exp $ dnl AC_INIT(include/idzebra/version.h) AM_INIT_AUTOMAKE(idzebra,1.4.0) @@ -294,7 +294,7 @@ AC_OUTPUT([ test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile test/config/Makefile test/sort2/Makefile test/xelm/Makefile - test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile + test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile examples/Makefile examples/gils/Makefile examples/zthes/Makefile idzebra.spec diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index 216f60a..3dca2f7 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,4 +1,4 @@ -/* $Id: d1_absyn.c,v 1.14 2004-09-30 18:31:14 adam Exp $ +/* $Id: d1_absyn.c,v 1.15 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include #include @@ -183,7 +183,7 @@ void data1_absyn_destroy (data1_handle dh) { data1_xpelement *xpe = abs->xp_elements; while (xpe) { - logf (LOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr); + yaz_log (YLOG_DEBUG,"Destroy xp element %s",xpe->xpath_expr); if (xpe->dfa) { dfa_delete (&xpe->dfa); } xpe = xpe->next; } @@ -273,7 +273,7 @@ data1_attset *data1_attset_add (data1_handle dh, const char *name) *cp = '\0'; } if (!attset) - yaz_log (LOG_WARN|LOG_ERRNO, "Couldn't load attribute set %s", name); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Couldn't load attribute set %s", name); else { data1_attset_cache p = (data1_attset_cache) @@ -413,7 +413,7 @@ void fix_element_ref (data1_handle dh, data1_absyn *absyn, data1_element *e) if (sub_e) e->children = sub_e->elements; else - yaz_log (LOG_WARN, "Unresolved reference to sub-elements %s", + yaz_log (YLOG_WARN, "Unresolved reference to sub-elements %s", e->sub_name); } } @@ -496,7 +496,7 @@ const char * mk_xpath_regexp (data1_handle dh, char *expr) if (!abs) { sprintf (p, ".*"); p+=2; } sprintf (p, "$"); p++; r = nmem_strdup (data1_nmem_get (dh), res); - yaz_log(LOG_DEBUG,"Got regexp: %s",r); + yaz_log(YLOG_DEBUG,"Got regexp: %s",r); return (r); } @@ -528,7 +528,7 @@ static int parse_termlists (data1_handle dh, data1_termlist ***tpp, if (i == 0) { if (*cp) - yaz_log(LOG_WARN, + yaz_log(YLOG_WARN, "%s:%d: Syntax error in termlistspec '%s'", file, lineno, cp); break; @@ -568,7 +568,7 @@ static int parse_termlists (data1_handle dh, data1_termlist ***tpp, if (!((*tp)->att = data1_getattbyname(dh, res->attset, attname))) { if ((!xpelement) || (*attname != '!')) { - yaz_log(LOG_WARN, + yaz_log(YLOG_WARN, "%s:%d: Couldn't find att '%s' in attset", file, lineno, attname); return -1; @@ -681,7 +681,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "Couldn't open %s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "Couldn't open %s", file); if (file_must_exist) return 0; } @@ -723,7 +723,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc < 4) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to elm", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to elm", file, lineno); continue; } path = argv[1]; @@ -754,7 +754,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, } if (i > level+1) { - yaz_log(LOG_WARN, "%s:%d: Bad level increase", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad level increase", file, lineno); fclose(f); return 0; } @@ -777,14 +777,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, { if (!res->tagset) { - yaz_log(LOG_WARN, "%s:%d: No tagset loaded", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: No tagset loaded", file, lineno); fclose(f); return 0; } if (!(new_element->tag = data1_gettagbynum (dh, res->tagset, type, value))) { - yaz_log(LOG_WARN, "%s:%d: Couldn't find tag %s in tagset", + yaz_log(YLOG_WARN, "%s:%d: Couldn't find tag %s in tagset", file, lineno, p); fclose(f); return 0; @@ -810,7 +810,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, } else { - yaz_log(LOG_WARN, "%s:%d: Bad element", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad element", file, lineno); fclose(f); return 0; } @@ -853,7 +853,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc < 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to xelm", file, lineno); continue; } xpath_expr = argv[1]; @@ -861,7 +861,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, regexp = mk_xpath_regexp(dh, xpath_expr); i = dfa_parse (dfa, ®exp); if (i || *regexp) { - yaz_log(LOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad xpath to xelm", file, lineno); dfa_delete (&dfa); continue; } @@ -917,7 +917,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc < 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to section", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to section", file, lineno); continue; } @@ -937,7 +937,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'xpath' directive", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'xpath' directive", file, lineno); continue; } @@ -947,7 +947,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, res->enable_xpath_indexing = 0; else { - yaz_log(LOG_WARN, "%s:%d: Expecting disable/enable " + yaz_log(YLOG_WARN, "%s:%d: Expecting disable/enable " "after 'xpath' directive", file, lineno); } } @@ -956,13 +956,13 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, data1_termlist **tp = &all; if (all) { - yaz_log(LOG_WARN, "%s:%d: Too many 'all' directives - ignored", + yaz_log(YLOG_WARN, "%s:%d: Too many 'all' directives - ignored", file, lineno); continue; } if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to 'all' directive", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to 'all' directive", file, lineno); continue; } @@ -976,7 +976,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to name directive", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name directive", file, lineno); continue; } @@ -988,14 +988,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to reference", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference", file, lineno); continue; } name = argv[1]; if ((res->reference = oid_getvalbyname(name)) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown tagset ref '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'", file, lineno, name); continue; } @@ -1007,14 +1007,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to attset", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to attset", file, lineno); continue; } name = argv[1]; if (!(attset = data1_get_attset (dh, name))) { - yaz_log(LOG_WARN, "%s:%d: Couldn't find attset %s", + yaz_log(YLOG_WARN, "%s:%d: Couldn't find attset %s", file, lineno, name); continue; } @@ -1030,7 +1030,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, int type = 0; if (argc < 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to tagset", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to tagset", file, lineno); continue; } @@ -1040,7 +1040,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, *tagset_childp = data1_read_tagset (dh, name, type); if (!(*tagset_childp)) { - yaz_log(LOG_WARN, "%s:%d: Couldn't load tagset %s", + yaz_log(YLOG_WARN, "%s:%d: Couldn't load tagset %s", file, lineno, name); continue; } @@ -1052,14 +1052,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args in varset", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args in varset", file, lineno); continue; } name = argv[1]; if (!(res->varset = data1_read_varset (dh, name))) { - yaz_log(LOG_WARN, "%s:%d: Couldn't load Varset %s", + yaz_log(YLOG_WARN, "%s:%d: Couldn't load Varset %s", file, lineno, name); continue; } @@ -1070,7 +1070,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args in esetname", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args in esetname", file, lineno); continue; } @@ -1085,7 +1085,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, (*esetpp)->spec = 0; else if (!((*esetpp)->spec = data1_read_espec1 (dh, fname))) { - yaz_log(LOG_WARN, "%s:%d: Espec-1 read failed for %s", + yaz_log(YLOG_WARN, "%s:%d: Espec-1 read failed for %s", file, lineno, fname); continue; } @@ -1097,14 +1097,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args for maptab", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args for maptab", file, lineno); continue; } name = argv[1]; if (!(*maptabp = data1_read_maptab (dh, name))) { - yaz_log(LOG_WARN, "%s:%d: Couldn't load maptab %s", + yaz_log(YLOG_WARN, "%s:%d: Couldn't load maptab %s", file, lineno, name); continue; } @@ -1116,14 +1116,14 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # or args for marc", + yaz_log(YLOG_WARN, "%s:%d: Bad # or args for marc", file, lineno); continue; } name = argv[1]; if (!(*marcp = data1_read_marctab (dh, name))) { - yaz_log(LOG_WARN, "%s:%d: Couldn't read marctab %s", + yaz_log(YLOG_WARN, "%s:%d: Couldn't read marctab %s", file, lineno, name); continue; } @@ -1133,7 +1133,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # or args for encoding", + yaz_log(YLOG_WARN, "%s:%d: Bad # or args for encoding", file, lineno); continue; } @@ -1143,7 +1143,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, { if (argc != 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # or args for systag", + yaz_log(YLOG_WARN, "%s:%d: Bad # or args for systag", file, lineno); continue; } @@ -1155,7 +1155,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, } else { - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file, + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, cmd); continue; } @@ -1171,6 +1171,6 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file, fix_element_ref (dh, res, cur_elements->elements); } *systagsp = 0; - yaz_log(LOG_DEBUG, "%s: data1_read_absyn end", file); + yaz_log(YLOG_DEBUG, "%s: data1_read_absyn end", file); return res; } diff --git a/data1/d1_attset.c b/data1/d1_attset.c index 904d25a..4e234fa 100644 --- a/data1/d1_attset.c +++ b/data1/d1_attset.c @@ -1,4 +1,4 @@ -/* $Id: d1_attset.c,v 1.4 2004-09-28 10:43:37 adam Exp $ +/* $Id: d1_attset.c,v 1.5 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include data1_att *data1_getattbyname(data1_handle dh, data1_attset *s, char *name) @@ -89,7 +89,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) if (argc < 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to att", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to att", file, lineno); continue; } num = atoi (argv[1]); @@ -128,7 +128,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to name", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to name", file, lineno); continue; } } @@ -138,14 +138,14 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to reference", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to reference", file, lineno); continue; } name = argv[1]; if ((res->reference = oid_getvalbyname(name)) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown reference oid '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown reference oid '%s'", file, lineno, name); fclose(f); return 0; @@ -153,7 +153,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) } else if (!strcmp(cmd, "ordinal")) { - yaz_log (LOG_WARN, "%s:%d: Directive ordinal ignored", + yaz_log (YLOG_WARN, "%s:%d: Directive ordinal ignored", file, lineno); } else if (!strcmp(cmd, "include")) @@ -163,7 +163,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args to include", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args to include", file, lineno); continue; } @@ -171,7 +171,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) if (!(attset = data1_get_attset (dh, name))) { - yaz_log(LOG_WARN, "%s:%d: Include of attset %s failed", + yaz_log(YLOG_WARN, "%s:%d: Include of attset %s failed", file, lineno, name); continue; @@ -184,7 +184,7 @@ data1_attset *data1_read_attset(data1_handle dh, const char *file) } else { - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, cmd); } } diff --git a/data1/d1_doespec.c b/data1/d1_doespec.c index 4553949..7a86264 100644 --- a/data1/d1_doespec.c +++ b/data1/d1_doespec.c @@ -1,4 +1,4 @@ -/* $Id: d1_doespec.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_doespec.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -23,7 +23,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include @@ -197,7 +197,7 @@ static int match_children_here (data1_handle dh, data1_node *n, counter++; if (occur && occur->which == Z_Occurrences_last) { - yaz_log(LOG_WARN, "Can't do occurrences=last (yet)"); + yaz_log(YLOG_WARN, "Can't do occurrences=last (yet)"); return 0; } if (!occur || occur->which == Z_Occurrences_all || diff --git a/data1/d1_espec.c b/data1/d1_espec.c index 1cad41c..34778a3 100644 --- a/data1/d1_espec.c +++ b/data1/d1_espec.c @@ -1,4 +1,4 @@ -/* $Id: d1_espec.c,v 1.4 2004-10-05 12:23:25 adam Exp $ +/* $Id: d1_espec.c,v 1.5 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include static Z_Variant *read_variant(int argc, char **argv, NMEM nmem, @@ -55,7 +55,7 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem, if (sscanf(argv[i], "(%d,%d,%511[^)])", &zclass, &type, value) < 3) { - yaz_log(LOG_WARN, "%s:%d: Syntax error in variant component '%s'", + yaz_log(YLOG_WARN, "%s:%d: Syntax error in variant component '%s'", file, lineno, argv[i]); return 0; } @@ -123,7 +123,7 @@ static Z_Occurrences *read_occurrences(char *occ, NMEM nmem, if (!d1_isdigit(*occ)) { - yaz_log(LOG_WARN, "%s:%d: Bad occurrences-spec %s", + yaz_log(YLOG_WARN, "%s:%d: Bad occurrences-spec %s", file, lineno, occ); return 0; } @@ -222,7 +222,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } @@ -241,7 +241,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) if (!nnames) { - yaz_log(LOG_WARN, "%s:%d: Empty elementsetnames directive", + yaz_log(YLOG_WARN, "%s:%d: Empty elementsetnames directive", file, lineno); continue; } @@ -260,14 +260,14 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s", file, lineno, argv[0]); continue; } if (!(res->defaultVariantSetId = odr_getoidbystr_nmem(nmem, argv[1]))) { - yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantsetid", + yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantsetid", file, lineno); continue; } @@ -276,7 +276,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s", file, lineno, argv[0]); continue; } @@ -288,7 +288,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) if (!(res->defaultVariantRequest = read_variant(argc-1, argv+1, nmem, file, lineno))) { - yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantrequest", + yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantrequest", file, lineno); continue; } @@ -315,7 +315,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) } if (argc < 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s", file, lineno, argv[0]); continue; } @@ -347,7 +347,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) tagunit = read_tagunit(path, nmem, file, lineno); if (!tagunit) { - yaz_log (LOG_WARN, "%s%d: Bad tag unit at %s", + yaz_log (YLOG_WARN, "%s%d: Bad tag unit at %s", file, lineno, path); break; } @@ -359,7 +359,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) read_variant(argc-3, argv+3, nmem, file, lineno); } else - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, argv[0]); fclose (f); return res; diff --git a/data1/d1_expout.c b/data1/d1_expout.c index ca6862f..8b9886c 100644 --- a/data1/d1_expout.c +++ b/data1/d1_expout.c @@ -1,4 +1,4 @@ -/* $Id: d1_expout.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_expout.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -28,7 +28,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include @@ -47,12 +47,12 @@ static int is_numeric_tag (ExpHandle *eh, data1_node *c) return 0; if (!c->u.tag.element) { - yaz_log(LOG_WARN, "Tag %s is local", c->u.tag.tag); + yaz_log(YLOG_WARN, "Tag %s is local", c->u.tag.tag); return 0; } if (c->u.tag.element->tag->which != DATA1T_numeric) { - yaz_log(LOG_WARN, "Tag %s is not numeric", c->u.tag.tag); + yaz_log(YLOG_WARN, "Tag %s is not numeric", c->u.tag.tag); return 0; } if (eh->select && !c->u.tag.node_selected) @@ -1381,7 +1381,7 @@ Z_ExplainRecord *data1_nodetoexplain (data1_handle dh, data1_node *n, assert(n->which == DATA1N_root); if (strcmp(n->u.root.type, "explain")) { - yaz_log(LOG_WARN, "Attempt to convert a non-Explain record"); + yaz_log(YLOG_WARN, "Attempt to convert a non-Explain record"); return 0; } for (n = n->child; n; n = n->next) @@ -1415,6 +1415,6 @@ Z_ExplainRecord *data1_nodetoexplain (data1_handle dh, data1_node *n, return res; } } - yaz_log(LOG_WARN, "No category in Explain record"); + yaz_log(YLOG_WARN, "No category in Explain record"); return 0; } diff --git a/data1/d1_grs.c b/data1/d1_grs.c index db9b5d0..2aeac01 100644 --- a/data1/d1_grs.c +++ b/data1/d1_grs.c @@ -1,4 +1,4 @@ -/* $Id: d1_grs.c,v 1.4 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_grs.c,v 1.5 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #define D1_VARIANTARRAY 20 /* fixed max length on sup'd variant-list. Lazy me */ @@ -94,7 +94,7 @@ static Z_Variant *make_variant(data1_node *n, int num, ODR o) odr_strdup(o, p->u.variant.value); break; default: - yaz_log(LOG_WARN, "Unable to handle value for variant %s", + yaz_log(YLOG_WARN, "Unable to handle value for variant %s", p->u.variant.type->name); return 0; } @@ -118,7 +118,7 @@ static int traverse_triples(data1_node *n, int level, Z_ElementMetaData *m, D1_VARIANTARRAY); else if (m->num_supportedVariants >= D1_VARIANTARRAY) { - yaz_log(LOG_WARN, "Too many variants (D1_VARIANTARRAY==%d)", + yaz_log(YLOG_WARN, "Too many variants (D1_VARIANTARRAY==%d)", D1_VARIANTARRAY); return -1; } @@ -218,7 +218,7 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n, *len += oid_oidlen(res->u.oid) * sizeof(int); break; default: - yaz_log(LOG_WARN, "Can't handle datatype."); + yaz_log(YLOG_WARN, "Can't handle datatype."); return 0; } } @@ -294,7 +294,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, } else { - yaz_log(LOG_WARN, "Bad data."); + yaz_log(YLOG_WARN, "Bad data."); return 0; } @@ -392,7 +392,7 @@ Z_GenericRecord *data1_nodetogr(data1_handle dh, data1_node *n, data1_gettagbyname (dh, n->root->u.root.absyn->tagset, "wellKnown"))) { - yaz_log(LOG_WARN, "Unable to locate tag for 'wellKnown'"); + yaz_log(YLOG_WARN, "Unable to locate tag for 'wellKnown'"); wellknown_tag = odr_malloc(o, sizeof(*wellknown_tag)); wellknown_tag->which = DATA1T_numeric; wellknown_tag->value.numeric = 19; diff --git a/data1/d1_handle.c b/data1/d1_handle.c index 6ae2041..c7a8825 100644 --- a/data1/d1_handle.c +++ b/data1/d1_handle.c @@ -1,4 +1,4 @@ -/* $Id: d1_handle.c,v 1.4 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_handle.c,v 1.5 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -23,7 +23,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include struct data1_handle_info { @@ -116,14 +116,14 @@ WRBUF data1_get_wrbuf (data1_handle dp) char **data1_get_read_buf (data1_handle dp, int **lenp) { *lenp = &dp->read_len; - yaz_log (LOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp); + yaz_log (YLOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp); return &dp->read_buf; } char **data1_get_map_buf (data1_handle dp, int **lenp) { *lenp = &dp->map_len; - yaz_log (LOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp); + yaz_log (YLOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp); return &dp->map_buf; } diff --git a/data1/d1_if.c b/data1/d1_if.c index a58ce5b..7e819a9 100644 --- a/data1/d1_if.c +++ b/data1/d1_if.c @@ -1,4 +1,4 @@ -/* $Id: d1_if.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_if.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include @@ -89,17 +89,17 @@ char *data1_getNodeValue(data1_node* node, char* pTagPath) } else { - yaz_log(LOG_WARN,"Attempting to lookup data for tagpath: Child node is not a data node"); + yaz_log(YLOG_WARN,"Attempting to lookup data for tagpath: Child node is not a data node"); } } else { - yaz_log(LOG_WARN,"Found a node matching the tagpath, but it has no child data nodes"); + yaz_log(YLOG_WARN,"Found a node matching the tagpath, but it has no child data nodes"); } } else { - yaz_log(LOG_WARN,"Unable to lookup a node on the specified tag path"); + yaz_log(YLOG_WARN,"Unable to lookup a node on the specified tag path"); } return ""; @@ -173,7 +173,7 @@ data1_node *data1_LookupNode(data1_node* node, char* pTagPath) } else { - yaz_log(LOG_FATAL,"Node does not end with a ]"); + yaz_log(YLOG_FATAL,"Node does not end with a ]"); /* Fatal Error */ return(NULL); } @@ -196,7 +196,7 @@ data1_node *data1_LookupNode(data1_node* node, char* pTagPath) } - yaz_log(LOG_DEBUG,"search node for child like [%d,%d,%s,%d]",iTagType,iTagValue,StringTagVal,iOccurences); + yaz_log(YLOG_DEBUG,"search node for child like [%d,%d,%s,%d]",iTagType,iTagValue,StringTagVal,iOccurences); /* OK.. We have extracted tagtype, Value and Occurence, see if we can find a node */ @@ -227,7 +227,7 @@ data1_node *data1_LookupNode(data1_node* node, char* pTagPath) } else /* Attempt to match real element */ { - yaz_log(LOG_WARN,"Non string tag matching not yet implemented"); + yaz_log(YLOG_WARN,"Non string tag matching not yet implemented"); } } current_child = current_child->next; diff --git a/data1/d1_map.c b/data1/d1_map.c index 151b3c4..1b746a1 100644 --- a/data1/d1_map.c +++ b/data1/d1_map.c @@ -1,4 +1,4 @@ -/* $Id: d1_map.c,v 1.5 2004-09-28 10:43:37 adam Exp $ +/* $Id: d1_map.c,v 1.6 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -25,7 +25,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } @@ -58,14 +58,14 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args for targetref", + yaz_log(YLOG_WARN, "%s:%d: Bad # args for targetref", file, lineno); continue; } if ((res->target_absyn_ref = oid_getvalbyname(argv[1])) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown reference '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'", file, lineno, argv[1]); continue; } @@ -74,7 +74,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args for targetname", + yaz_log(YLOG_WARN, "%s:%d: Bad # args for targetname", file, lineno); continue; } @@ -88,7 +88,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args for name", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # args for name", file, lineno); continue; } res->name = (char *)nmem_malloc(mem, strlen(argv[1])+1); @@ -101,7 +101,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) if (argc < 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # of args for map", + yaz_log(YLOG_WARN, "%s:%d: Bad # of args for map", file, lineno); continue; } @@ -128,7 +128,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) if ((np = sscanf(path, "(%d,%511[^)]):%511[^/]", &type, valstr, parm)) < 2) { - yaz_log(LOG_WARN, "%s:%d: Syntax error in map " + yaz_log(YLOG_WARN, "%s:%d: Syntax error in map " "directive: %s", file, lineno, argv[2]); fclose(f); return 0; @@ -157,7 +157,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) mapp = &(*mapp)->next; } else - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, argv[0]); fclose(f); @@ -331,7 +331,7 @@ data1_node *data1_map_record (data1_handle dh, data1_node *n, res->u.root.type = map->target_absyn_name; if (!(res->u.root.absyn = data1_get_absyn(dh, map->target_absyn_name))) { - yaz_log(LOG_WARN, "%s: Failed to load target absyn '%s'", + yaz_log(YLOG_WARN, "%s: Failed to load target absyn '%s'", map->name, map->target_absyn_name); } if (data1_is_xmlmode(dh)) diff --git a/data1/d1_marc.c b/data1/d1_marc.c index da28f8f..511de28 100644 --- a/data1/d1_marc.c +++ b/data1/d1_marc.c @@ -1,4 +1,4 @@ -/* $Id: d1_marc.c,v 1.7 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_marc.c,v 1.8 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -27,7 +27,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } @@ -70,7 +70,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d:Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d:Missing arg for %s", file, lineno, *argv); continue; } @@ -80,13 +80,13 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown tagset reference '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'", file, lineno, argv[1]); continue; } @@ -95,7 +95,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -105,7 +105,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -115,7 +115,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -125,7 +125,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -135,7 +135,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } @@ -145,14 +145,14 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Missing arg for %s", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Missing arg for %s", file, lineno, *argv); continue; } res->force_identifier_length = atoi(argv[1]); } else - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, *argv); fclose(f); @@ -234,7 +234,7 @@ static int nodetomarc(data1_handle dh, #if 0 data1_pr_tree(dh, n, stdout); #endif - yaz_log (LOG_DEBUG, "nodetomarc"); + yaz_log (YLOG_DEBUG, "nodetomarc"); memcpy (leader+5, p->record_status, 1); memcpy (leader+6, p->implementation_codes, 4); @@ -420,7 +420,7 @@ static int nodetomarc(data1_handle dh, } } else if (subf->which != DATA1N_tag) - yaz_log(LOG_WARN, "Malformed fields for marc output."); + yaz_log(YLOG_WARN, "Malformed fields for marc output."); else identifier = subf->u.tag.tag; op[data_p] = ISO2709_IDFS; diff --git a/data1/d1_prtree.c b/data1/d1_prtree.c index bea2c09..3986c3b 100644 --- a/data1/d1_prtree.c +++ b/data1/d1_prtree.c @@ -1,4 +1,4 @@ -/* $Id: d1_prtree.c,v 1.4 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_prtree.c,v 1.5 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -20,7 +20,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include #include static void pr_string (FILE *out, const char *str, int len) diff --git a/data1/d1_read.c b/data1/d1_read.c index 1cd46bf..763692c 100644 --- a/data1/d1_read.c +++ b/data1/d1_read.c @@ -1,4 +1,4 @@ -/* $Id: d1_read.c,v 1.10 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_read.c,v 1.11 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -31,7 +31,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include data1_node *data1_get_root_tag (data1_handle dh, data1_node *n) @@ -118,7 +118,7 @@ static void data1_init_node (data1_handle dh, data1_node *r, int type) r->u.preprocess.attributes = 0; break; default: - logf (LOG_WARN, "data_mk_node_type. bad type = %d\n", type); + yaz_log (YLOG_WARN, "data_mk_node_type. bad type = %d\n", type); } } @@ -194,7 +194,7 @@ data1_node *data1_mk_root (data1_handle dh, NMEM nmem, const char *name) data1_node *res; if (!absyn) { - yaz_log(LOG_WARN, "Unable to acquire abstract syntax " "for '%s'", + yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'", name); /* It's now OK for a record not to have an absyn */ } @@ -786,7 +786,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, } if (amp || c != '>') { - yaz_log(LOG_WARN, "d1: %d: Malformed tag", line); + yaz_log(YLOG_WARN, "d1: %d: Malformed tag", line); return 0; } else @@ -814,7 +814,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, } if (i != level) { - yaz_log (LOG_WARN, "%d: no begin tag for %s", + yaz_log (YLOG_WARN, "%d: no begin tag for %s", line, tag); break; } @@ -839,7 +839,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, if (sscanf(args, "%s %s %n", tclass, type, &val_offset) != 2) { - yaz_log(LOG_WARN, "Malformed variant triple at '%s'", tag); + yaz_log(YLOG_WARN, "Malformed variant triple at '%s'", tag); continue; } if (!(tp = diff --git a/data1/d1_sumout.c b/data1/d1_sumout.c index 4146d07..d66a22e 100644 --- a/data1/d1_sumout.c +++ b/data1/d1_sumout.c @@ -1,4 +1,4 @@ -/* $Id: d1_sumout.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_sumout.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include @@ -63,7 +63,7 @@ Z_BriefBib *data1_nodetosummary (data1_handle dh, data1_node *n, assert(n->which == DATA1N_root); if (strcmp(n->u.root.type, "summary")) { - yaz_log(LOG_WARN, "Attempt to convert a non-summary record"); + yaz_log(YLOG_WARN, "Attempt to convert a non-summary record"); return 0; } @@ -87,7 +87,7 @@ Z_BriefBib *data1_nodetosummary (data1_handle dh, data1_node *n, { if (c->which != DATA1N_tag || !c->u.tag.element) { - yaz_log(LOG_WARN, "Malformed element in Summary record"); + yaz_log(YLOG_WARN, "Malformed element in Summary record"); return 0; } if (select && !c->u.tag.node_selected) @@ -109,7 +109,7 @@ Z_BriefBib *data1_nodetosummary (data1_handle dh, data1_node *n, case 16: res->abstract = f_string(c, o); break; case 17: abort(); /* TODO */ default: - yaz_log(LOG_WARN, "Unknown element in Summary record."); + yaz_log(YLOG_WARN, "Unknown element in Summary record."); } } return res; diff --git a/data1/d1_tagset.c b/data1/d1_tagset.c index 89bf6bc..56bd25a 100644 --- a/data1/d1_tagset.c +++ b/data1/d1_tagset.c @@ -1,4 +1,4 @@ -/* $Id: d1_tagset.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_tagset.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include /* @@ -129,7 +129,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } res = data1_empty_tagset (dh); @@ -149,7 +149,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) if (argc != 4) { - yaz_log(LOG_WARN, "%s:%d: Bad # args to tag", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # args to tag", file, lineno); continue; } value = atoi(argv[1]); @@ -167,7 +167,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) if (!(rr->kind = data1_maptype(dh, type))) { - yaz_log(LOG_WARN, "%s:%d: Unknown datatype %s", + yaz_log(YLOG_WARN, "%s:%d: Unknown datatype %s", file, lineno, type); fclose(f); return 0; @@ -195,7 +195,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args to name", file, lineno); + yaz_log(YLOG_WARN, "%s:%d: Bad # args to name", file, lineno); continue; } res->name = nmem_strdup(mem, argv[1]); @@ -206,14 +206,14 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args to reference", + yaz_log(YLOG_WARN, "%s:%d: Bad # args to reference", file, lineno); continue; } name = argv[1]; if ((res->reference = oid_getvalbyname(name)) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown tagset ref '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'", file, lineno, name); continue; } @@ -222,7 +222,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) { if (argc != 2) { - yaz_log (LOG_WARN, "%s:%d: Bad # args to type", file, lineno); + yaz_log (YLOG_WARN, "%s:%d: Bad # args to type", file, lineno); continue; } if (!res->type) @@ -235,7 +235,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) if (argc < 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args to include", + yaz_log(YLOG_WARN, "%s:%d: Bad # args to include", file, lineno); continue; } @@ -245,7 +245,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) *childp = data1_read_tagset (dh, name, type); if (!(*childp)) { - yaz_log(LOG_WARN, "%s:%d: Inclusion failed for tagset %s", + yaz_log(YLOG_WARN, "%s:%d: Inclusion failed for tagset %s", file, lineno, name); continue; } @@ -253,7 +253,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, const char *file, int type) } else { - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, cmd); } } diff --git a/data1/d1_varset.c b/data1/d1_varset.c index 06c47d2..92c95a5 100644 --- a/data1/d1_varset.c +++ b/data1/d1_varset.c @@ -1,4 +1,4 @@ -/* $Id: d1_varset.c,v 1.3 2004-09-28 10:15:03 adam Exp $ +/* $Id: d1_varset.c,v 1.4 2004-11-19 10:26:53 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include data1_vartype *data1_getvartypebyct (data1_handle dh, data1_varset *set, @@ -39,11 +39,11 @@ data1_vartype *data1_getvartypebyct (data1_handle dh, data1_varset *set, for (t = c->types; t; t = t->next) if (!data1_matchstr(t->name, type)) return t; - yaz_log(LOG_WARN, "Unknown variant type %s in class %s", + yaz_log(YLOG_WARN, "Unknown variant type %s in class %s", type, zclass); return 0; } - yaz_log(LOG_WARN, "Unknown variant class %s", zclass); + yaz_log(YLOG_WARN, "Unknown variant class %s", zclass); return 0; } @@ -70,7 +70,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) if (!(f = data1_path_fopen(dh, file, "r"))) { - yaz_log(LOG_WARN|LOG_ERRNO, "%s", file); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file); return 0; } while ((argc = readconf_line(f, &lineno, line, 512, argv, 50))) @@ -80,7 +80,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) if (argc != 3) { - yaz_log(LOG_WARN, "%s:%d: Bad # or args to class", + yaz_log(YLOG_WARN, "%s:%d: Bad # or args to class", file, lineno); continue; } @@ -100,13 +100,13 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) if (!typep) { - yaz_log(LOG_WARN, "%s:%d: Directive class must precede type", + yaz_log(YLOG_WARN, "%s:%d: Directive class must precede type", file, lineno); continue; } if (argc != 4) { - yaz_log(LOG_WARN, "%s:%d: Bad # or args to type", + yaz_log(YLOG_WARN, "%s:%d: Bad # or args to type", file, lineno); continue; } @@ -116,7 +116,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) r->type = atoi(argv[1]); if (!(r->datatype = data1_maptype (dh, argv[3]))) { - yaz_log(LOG_WARN, "%s:%d: Unknown datatype '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown datatype '%s'", file, lineno, argv[3]); fclose(f); return 0; @@ -128,7 +128,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args for name", + yaz_log(YLOG_WARN, "%s:%d: Bad # args for name", file, lineno); continue; } @@ -138,19 +138,19 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) { if (argc != 2) { - yaz_log(LOG_WARN, "%s:%d: Bad # args for reference", + yaz_log(YLOG_WARN, "%s:%d: Bad # args for reference", file, lineno); continue; } if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE) { - yaz_log(LOG_WARN, "%s:%d: Unknown reference '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'", file, lineno, argv[1]); continue; } } else - yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", + yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'", file, lineno, argv[0]); fclose(f); diff --git a/dfa/dfa.c b/dfa/dfa.c index 50f0a1d..3f88fd4 100644 --- a/dfa/dfa.c +++ b/dfa/dfa.c @@ -1,4 +1,4 @@ -/* $Id: dfa.c,v 1.30 2003-06-18 21:32:44 adam Exp $ +/* $Id: dfa.c,v 1.31 2004-11-19 10:26:54 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -459,7 +459,7 @@ static int map_l_char (struct DFA_parse *parse_info) parse_info->expr_ptr = (const unsigned char *) cp0; parse_info->look_ch = ((unsigned char **) mapto)[i][0]; - logf (LOG_DEBUG, "map from %c to %d", parse_info->expr_ptr[-1], parse_info->look_ch); + yaz_log (YLOG_DEBUG, "map from %c to %d", parse_info->expr_ptr[-1], parse_info->look_ch); return L_CHAR; } diff --git a/dfa/grepper.c b/dfa/grepper.c index d8830a1..cdcb7c2 100644 --- a/dfa/grepper.c +++ b/dfa/grepper.c @@ -1,4 +1,4 @@ -/* $Id: grepper.c,v 1.10 2002-08-02 19:26:55 adam Exp $ +/* $Id: grepper.c,v 1.11 2004-11-19 10:26:54 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -329,7 +329,7 @@ static int grep_file (struct DFA *dfa, const char *fname, int range) inf = fopen (fname, "r"); if (!inf) { - logf (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open `%s'", fname); exit (1); } } @@ -401,7 +401,7 @@ int main (int argc, char **argv) } else { - logf (LOG_FATAL, "Unknown option '-%s'", arg); + yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg); exit (1); } } diff --git a/dfa/imalloc.c b/dfa/imalloc.c index f21b197..9145fcc 100644 --- a/dfa/imalloc.c +++ b/dfa/imalloc.c @@ -1,4 +1,4 @@ -/* $Id: imalloc.c,v 1.9 2002-08-02 19:26:55 adam Exp $ +/* $Id: imalloc.c,v 1.10 2004-11-19 10:26:54 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -45,7 +45,7 @@ void *imalloc (size_t size) size_t words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned); char *p = (char *)xmalloc( words*sizeof(unsigned) ); if( !p ) - logf (LOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld", + yaz_log (YLOG_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; @@ -59,7 +59,7 @@ void *imalloc (size_t size) #else void *p = (void *)xmalloc( size ); if( !p ) - logf (LOG_FATAL, "Out of memory (imalloc)" ); + yaz_log (YLOG_FATAL, "Out of memory (imalloc)" ); return p; #endif } @@ -70,7 +70,7 @@ void *icalloc (size_t size) unsigned words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned); char *p = (char *) xcalloc( words*sizeof(unsigned), 1 ); if( !p ) - logf (LOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld", + yaz_log (YLOG_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; @@ -84,7 +84,7 @@ void *icalloc (size_t size) #else void *p = (void *) xcalloc( size, 1 ); if( !p ) - logf (LOG_FATAL, "Out of memory (icalloc)" ); + yaz_log (YLOG_FATAL, "Out of memory (icalloc)" ); return p; #endif } @@ -98,14 +98,14 @@ void ifree (void *p) ++free_calls; size = (-2)[(unsigned *) p]; if( (-1)[(unsigned *) p] != MAG1 ) - logf (LOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size ); + yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 1 corrupted", size ); if( size[(unsigned char *) p] != MAG2 ) - logf (LOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size ); + yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 2 corrupted", size ); if( (size+1)[(unsigned char *) p] != MAG3 ) - logf (LOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size ); + yaz_log (YLOG_FATAL,"Internal: ifree(%u) magic 3 corrupted", size ); alloc -= size; if( alloc < 0L ) - logf (LOG_FATAL,"Internal: ifree(%u) negative alloc.", size ); + yaz_log (YLOG_FATAL,"Internal: ifree(%u) negative alloc.", size ); xfree( (unsigned *) p-2 ); #else xfree (p); diff --git a/dict/dcompact.c b/dict/dcompact.c index 489e79f..715b0a2 100644 --- a/dict/dcompact.c +++ b/dict/dcompact.c @@ -1,4 +1,4 @@ -/* $Id: dcompact.c,v 1.9 2004-09-09 09:07:12 adam Exp $ +/* $Id: dcompact.c,v 1.10 2004-11-19 10:26:54 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -27,7 +27,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include static void dict_copy_page(Dict dict, char *to_p, char *from_p, int *map) @@ -110,7 +110,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) void *buf; int size; #if 0 - logf (LOG_LOG, "map[%d] = %d", i, map[i]); + yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]); #endif dict_bf_readp (dict_from->dbf, i, &buf); size = ((DICT_size(buf)+sizeof(short)-1)/sizeof(short) + @@ -119,8 +119,8 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) no_dir += DICT_nodir(buf); } #if 0 - logf (LOG_LOG, "map[%d] = %d", i, map[i]); - logf (LOG_LOG, "nodir = %d", no_dir); + yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]); + yaz_log (YLOG_LOG, "nodir = %d", no_dir); #endif dict_to->head.root = map[1]; dict_to->head.last = map[i]; @@ -129,7 +129,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) void *old_p, *new_p; dict_bf_readp (dict_from->dbf, i, &old_p); - logf (LOG_LOG, "dict_bf_newp no=%d size=%d", map[i], + yaz_log (YLOG_LOG, "dict_bf_newp no=%d size=%d", map[i], map[i+1] - map[i]); dict_bf_newp (dict_to->dbf, map[i], &new_p, map[i+1] - map[i]); diff --git a/dict/dictext.c b/dict/dictext.c index 06f13e3..c4d3937 100644 --- a/dict/dictext.c +++ b/dict/dictext.c @@ -1,4 +1,4 @@ -/* $Id: dictext.c,v 1.9 2002-08-02 19:26:55 adam Exp $ +/* $Id: dictext.c,v 1.10 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -50,7 +50,7 @@ int main (int argc, char **argv) inputfile = arg; else { - logf (LOG_FATAL, "too many files specified\n"); + yaz_log (YLOG_FATAL, "too many files specified\n"); exit (1); } } @@ -68,7 +68,7 @@ int main (int argc, char **argv) use8 = 1; else { - logf (LOG_FATAL, "Unknown option '-%s'", arg); + yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg); exit (1); } } @@ -77,7 +77,7 @@ int main (int argc, char **argv) ipf = fopen (inputfile, "r"); if (!ipf) { - logf (LOG_FATAL|LOG_ERRNO, "cannot open '%s'", inputfile); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open '%s'", inputfile); exit (1); } } diff --git a/dict/dicttest.c b/dict/dicttest.c index dbe0aeb..c5fa828 100644 --- a/dict/dicttest.c +++ b/dict/dicttest.c @@ -1,4 +1,4 @@ -/* $Id: dicttest.c,v 1.29 2004-09-09 09:07:12 adam Exp $ +/* $Id: dicttest.c,v 1.30 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -103,7 +103,7 @@ int main (int argc, char **argv) name = arg; else { - logf (LOG_FATAL, "too many files specified\n"); + yaz_log (YLOG_FATAL, "too many files specified\n"); exit (1); } } @@ -151,31 +151,31 @@ int main (int argc, char **argv) } else { - logf (LOG_FATAL, "Unknown option '-%s'", arg); + yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg); exit (1); } } if (!config || !name) { - logf (LOG_FATAL, "no config and/or dictionary specified"); + yaz_log (YLOG_FATAL, "no config and/or dictionary specified"); exit (1); } my_resource = res_open (config, 0, 0); if (!my_resource) { - logf (LOG_FATAL, "cannot open resource `%s'", config); + yaz_log (YLOG_FATAL, "cannot open resource `%s'", config); exit (1); } bfs = bfs_create (res_get(my_resource, "register"), 0); if (!bfs) { - logf (LOG_FATAL, "bfs_create fail"); + yaz_log (YLOG_FATAL, "bfs_create fail"); exit (1); } dict = dict_open (bfs, name, cache, rw, 0, 4096); if (!dict) { - logf (LOG_FATAL, "dict_open fail of `%s'", name); + yaz_log (YLOG_FATAL, "dict_open fail of `%s'", name); exit (1); } if (inputfile) @@ -188,7 +188,7 @@ int main (int argc, char **argv) if (!(ipf = fopen(inputfile, "r"))) { - logf (LOG_FATAL|LOG_ERRNO, "cannot open %s", inputfile); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "cannot open %s", inputfile); exit (1); } @@ -227,11 +227,11 @@ int main (int argc, char **argv) case 1: no_of_change++; if (unique) - logf (LOG_LOG, "%s change\n", ipf_ptr); + yaz_log (YLOG_LOG, "%s change\n", ipf_ptr); break; case 2: if (unique) - logf (LOG_LOG, "%s duplicate\n", ipf_ptr); + yaz_log (YLOG_LOG, "%s duplicate\n", ipf_ptr); no_of_same++; break; } @@ -270,36 +270,36 @@ int main (int argc, char **argv) } if (rw && delete_term) { - logf (LOG_LOG, "dict_delete_subtree %s", delete_term); + yaz_log (YLOG_LOG, "dict_delete_subtree %s", delete_term); dict_delete_subtree (dict, delete_term, 0, 0); } if (grep_pattern) { if (range < 0) range = 0; - logf (LOG_LOG, "Grepping '%s'", grep_pattern); + yaz_log (YLOG_LOG, "Grepping '%s'", grep_pattern); dict_lookup_grep (dict, grep_pattern, range, NULL, &max_pos, srange, grep_handler); } if (rw) { - logf (LOG_LOG, "Iterations.... %d", no_of_iterations); + yaz_log (YLOG_LOG, "Iterations.... %d", no_of_iterations); if (do_delete) { - logf (LOG_LOG, "No of deleted. %d", no_of_deleted); - logf (LOG_LOG, "No not found.. %d", no_not_found); + yaz_log (YLOG_LOG, "No of deleted. %d", no_of_deleted); + yaz_log (YLOG_LOG, "No not found.. %d", no_not_found); } else { - logf (LOG_LOG, "No of new..... %d", no_of_new); - logf (LOG_LOG, "No of change.. %d", no_of_change); + yaz_log (YLOG_LOG, "No of new..... %d", no_of_new); + yaz_log (YLOG_LOG, "No of change.. %d", no_of_change); } } else { - 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); + yaz_log (YLOG_LOG, "Lookups....... %d", no_of_iterations); + yaz_log (YLOG_LOG, "No of hits.... %d", no_of_hits); + yaz_log (YLOG_LOG, "No of misses.. %d", no_of_misses); } if (scan_the_thing) { @@ -307,7 +307,7 @@ int main (int argc, char **argv) int before = 1000000; int after = 1000000; - logf (LOG_LOG, "dict_scan"); + yaz_log (YLOG_LOG, "dict_scan"); term_dict[0] = 1; term_dict[1] = 0; dict_scan (dict, term_dict, &before, &after, 0, scan_handler); diff --git a/dict/drdwr.c b/dict/drdwr.c index dc6499b..8350c3e 100644 --- a/dict/drdwr.c +++ b/dict/drdwr.c @@ -1,4 +1,4 @@ -/* $Id: drdwr.c,v 1.13 2002-08-02 19:26:55 adam Exp $ +/* $Id: drdwr.c,v 1.14 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -102,7 +102,7 @@ void dict_bf_flush_blocks (Dict_BFile bf, int no_to_flush) bf_write (bf->bf, effective_block, effective_offset, p->nbytes, p->data); #if 0 - logf (LOG_LOG, "bf_write no=%d offset=%d size=%d", + yaz_log (YLOG_LOG, "bf_write no=%d offset=%d size=%d", effective_block, effective_offset, p->nbytes); #endif @@ -111,14 +111,14 @@ void dict_bf_flush_blocks (Dict_BFile bf, int no_to_flush) else { #if 0 - logf (LOG_LOG, "bf_write1 no=%d offset=%d size=%d", + yaz_log (YLOG_LOG, "bf_write1 no=%d offset=%d size=%d", effective_block, effective_offset, remain); #endif bf_write (bf->bf, effective_block, effective_offset, remain, p->data); #if 0 - logf (LOG_LOG, "bf_write2 no=%d offset=%d size=%d", + yaz_log (YLOG_LOG, "bf_write2 no=%d offset=%d size=%d", effective_block+1, 0, p->nbytes - remain); #endif bf_write (bf->bf, effective_block+1, 0, diff --git a/dict/insert.c b/dict/insert.c index 955a2cd..2d4543a 100644 --- a/dict/insert.c +++ b/dict/insert.c @@ -1,4 +1,4 @@ -/* $Id: insert.c,v 1.22 2002-08-02 19:26:55 adam Exp $ +/* $Id: insert.c,v 1.23 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -343,7 +343,7 @@ static int dict_ins (Dict dict, const Dict_char *str, } if (split_page (dict, ptr, p)) { - logf (LOG_FATAL, "Unable to split page %d\n", ptr); + yaz_log (YLOG_FATAL, "Unable to split page %d\n", ptr); abort (); } return dict_ins (dict, str-1, ptr, userlen, userinfo); diff --git a/dict/lookgrep.c b/dict/lookgrep.c index 4d1c3d0..2fc27bf 100644 --- a/dict/lookgrep.c +++ b/dict/lookgrep.c @@ -1,4 +1,4 @@ -/* $Id: lookgrep.c,v 1.26 2002-09-18 21:01:15 adam Exp $ +/* $Id: lookgrep.c,v 1.27 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -373,10 +373,10 @@ int dict_lookup_grep (Dict dict, const char *pattern, int range, void *client, dfa_verbose = 1; #endif - logf (LOG_DEBUG, "dict_lookup_grep range=%d", range); + yaz_log (YLOG_DEBUG, "dict_lookup_grep range=%d", range); for (i = 0; pattern[i]; i++) { - logf (LOG_DEBUG, " %3d %c", pattern[i], + yaz_log (YLOG_DEBUG, " %3d %c", pattern[i], (pattern[i] > ' ' && pattern[i] < 127) ? pattern[i] : '?'); } @@ -385,7 +385,7 @@ int dict_lookup_grep (Dict dict, const char *pattern, int range, void *client, i = dfa_parse (dfa, &this_pattern); if (i || *this_pattern) { - yaz_log (LOG_WARN, "dfa_parse fail=%d", i); + yaz_log (YLOG_WARN, "dfa_parse fail=%d", i); dfa_delete (&dfa); return -1; } @@ -418,7 +418,7 @@ int dict_lookup_grep (Dict dict, const char *pattern, int range, void *client, dfa, max_pos, init_pos); else i = 0; - logf (LOG_DEBUG, "max_pos = %d", *max_pos); + yaz_log (YLOG_DEBUG, "max_pos = %d", *max_pos); dfa_delete (&dfa); xfree (Rj); rm_MatchContext (&mc); diff --git a/dict/open.c b/dict/open.c index d43476b..79ebe4c 100644 --- a/dict/open.c +++ b/dict/open.c @@ -1,4 +1,4 @@ -/* $Id: open.c,v 1.20 2004-09-09 09:07:12 adam Exp $ +/* $Id: open.c,v 1.21 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -43,7 +43,7 @@ Dict dict_open (BFiles bfs, const char *name, int cache, int rw, page_size = DICT_DEFAULT_PAGESIZE; if (page_size < 2048) { - logf (LOG_WARN, "Page size for dict %s %d<2048. Set to 2048", + yaz_log (YLOG_WARN, "Page size for dict %s %d<2048. Set to 2048", name, page_size); page_size = 2048; } @@ -52,7 +52,7 @@ Dict dict_open (BFiles bfs, const char *name, int cache, int rw, if(!dict->dbf) { - logf (LOG_WARN, "Cannot open `%s'", name); + yaz_log (YLOG_WARN, "Cannot open `%s'", name); xfree (dict); return NULL; } @@ -75,12 +75,12 @@ Dict dict_open (BFiles bfs, const char *name, int cache, int rw, memcpy (&dict->head, head_buf, sizeof(dict->head)); if (strcmp (dict->head.magic_str, DICT_MAGIC)) { - logf (LOG_WARN, "Bad magic of `%s'", name); + yaz_log (YLOG_WARN, "Bad magic of `%s'", name); exit (1); } if (dict->head.page_size != page_size) { - logf (LOG_WARN, "Page size for existing dict %s is %d. Current is %d", + yaz_log (YLOG_WARN, "Page size for existing dict %s is %d. Current is %d", name, dict->head.page_size, page_size); } } diff --git a/dict/scan.c b/dict/scan.c index ce56e64..7236cb0 100644 --- a/dict/scan.c +++ b/dict/scan.c @@ -1,4 +1,4 @@ -/* $Id: scan.c,v 1.15 2002-08-02 19:26:55 adam Exp $ +/* $Id: scan.c,v 1.16 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -206,10 +206,10 @@ int dict_scan (Dict dict, char *str, int *before, int *after, void *client, { int i; - logf (LOG_DEBUG, "dict_scan"); + yaz_log (YLOG_DEBUG, "dict_scan"); for (i = 0; str[i]; i++) { - logf (LOG_DEBUG, " %3d %c", str[i], + yaz_log (YLOG_DEBUG, " %3d %c", str[i], (str[i] > ' ' && str[i] < 127) ? str[i] : '?'); } if (!dict->head.root) diff --git a/include/dict.h b/include/dict.h index 993e97a..74761f4 100644 --- a/include/dict.h +++ b/include/dict.h @@ -1,4 +1,4 @@ -/* $Id: dict.h,v 1.33 2004-09-09 09:07:12 adam Exp $ +/* $Id: dict.h,v 1.34 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define DICT_H #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/zebrautl.h b/include/zebrautl.h index bd0402e..e54d1a7 100644 --- a/include/zebrautl.h +++ b/include/zebrautl.h @@ -1,4 +1,4 @@ -/* $Id: zebrautl.h,v 1.9 2004-08-25 09:23:36 adam Exp $ +/* $Id: zebrautl.h,v 1.10 2004-11-19 10:26:55 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -27,6 +27,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +/* check that we don't have all too old yaz */ +#ifndef YLOG_ERRNO +#error Need a modern yaz with ylog.h +#endif + YAZ_BEGIN_CDECL zint atoi_zn (const char *buf, zint len); YAZ_END_CDECL diff --git a/index/apitest.c b/index/apitest.c index 714f54d..b460b24 100644 --- a/index/apitest.c +++ b/index/apitest.c @@ -1,4 +1,4 @@ -/* $Id: apitest.c,v 1.17 2004-08-25 09:23:36 adam Exp $ +/* $Id: apitest.c,v 1.18 2004-11-19 10:26:56 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -#include +#include #include #include @@ -170,7 +170,7 @@ int main (int argc, char **argv) /* bad query? */ if (!query) { - logf (LOG_WARN, "bad query %s\n", argv[argno]); + yaz_log (YLOG_WARN, "bad query %s\n", argv[argno]); odr_reset (odr_input); continue; } diff --git a/index/attribute.c b/index/attribute.c index c076de9..5498347 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -1,4 +1,4 @@ -/* $Id: attribute.c,v 1.16 2004-08-25 09:23:36 adam Exp $ +/* $Id: attribute.c,v 1.17 2004-11-19 10:26:56 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -#include +#include #include #include #include "index.h" diff --git a/index/dir.c b/index/dir.c index 868740e..a987b07 100644 --- a/index/dir.c +++ b/index/dir.c @@ -1,4 +1,4 @@ -/* $Id: dir.c,v 1.28 2003-01-13 22:37:12 adam Exp $ +/* $Id: dir.c,v 1.29 2004-11-19 10:26:56 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -66,10 +66,10 @@ struct dir_entry *dir_open (const char *rep, const char *base, *full_rep = '\0'; strcat (full_rep, rep); - logf (LOG_DEBUG, "dir_open %s", full_rep); + yaz_log (YLOG_DEBUG, "dir_open %s", full_rep); if (!(dir = opendir(full_rep))) { - logf (LOG_WARN|LOG_ERRNO, "opendir %s", rep); + yaz_log (YLOG_WARN|YLOG_ERRNO, "opendir %s", rep); if (errno != ENOENT && errno != EACCES) exit (1); return NULL; @@ -127,7 +127,7 @@ struct dir_entry *dir_open (const char *rep, const char *base, } entry[idx].name = NULL; closedir (dir); - logf (LOG_DEBUG, "dir_close"); + yaz_log (YLOG_DEBUG, "dir_close"); return entry; } diff --git a/index/dirs.c b/index/dirs.c index 7ae040e..c2a992f 100644 --- a/index/dirs.c +++ b/index/dirs.c @@ -1,4 +1,4 @@ -/* $Id: dirs.c,v 1.20 2004-08-04 08:35:23 adam Exp $ +/* $Id: dirs.c,v 1.21 2004-11-19 10:26:56 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -84,7 +84,7 @@ struct dirs_info *dirs_open (Dict dict, const char *rep, int rw) struct dirs_info *p; int before = 0, after; - logf (LOG_DEBUG, "dirs_open %s", rep); + yaz_log (YLOG_DEBUG, "dirs_open %s", rep); p = (struct dirs_info *) xmalloc (sizeof (*p)); p->dict = dict; p->rw = rw; @@ -96,7 +96,7 @@ struct dirs_info *dirs_open (Dict dict, const char *rep, int rw) after = p->no_max = 100; p->entries = (struct dirs_entry *) xmalloc (sizeof(*p->entries) * (p->no_max)); - logf (LOG_DEBUG, "dirs_open first scan"); + yaz_log (YLOG_DEBUG, "dirs_open first scan"); dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc); return p; } @@ -135,7 +135,7 @@ struct dirs_entry *dirs_read (struct dirs_info *p) if (p->no_read < p->no_cur) { - logf (LOG_DEBUG, "dirs_read %d. returns %s", p->no_read, + yaz_log (YLOG_DEBUG, "dirs_read %d. returns %s", p->no_read, (p->entries + p->no_read)->path); return p->last_entry = p->entries + (p->no_read++); } @@ -153,7 +153,7 @@ struct dirs_entry *dirs_read (struct dirs_info *p) } p->no_read = 1; p->nextpath_deleted = 0; - logf (LOG_DEBUG, "dirs_read rescan %s", p->nextpath); + yaz_log (YLOG_DEBUG, "dirs_read rescan %s", p->nextpath); dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc); if (p->no_read <= p->no_cur) return p->last_entry = p->entries; @@ -170,7 +170,7 @@ void dirs_mkdir (struct dirs_info *p, const char *src, time_t mtime) char path[DIRS_MAX_PATH]; sprintf (path, "%s%s", p->prefix, src); - logf (LOG_DEBUG, "dirs_mkdir %s", path); + yaz_log (YLOG_DEBUG, "dirs_mkdir %s", path); if (p->rw) dict_insert (p->dict, path, sizeof(mtime), &mtime); } @@ -180,7 +180,7 @@ void dirs_rmdir (struct dirs_info *p, const char *src) char path[DIRS_MAX_PATH]; sprintf (path, "%s%s", p->prefix, src); - logf (LOG_DEBUG, "dirs_rmdir %s", path); + yaz_log (YLOG_DEBUG, "dirs_rmdir %s", path); if (p->rw) dict_delete (p->dict, path); } @@ -191,7 +191,7 @@ void dirs_add (struct dirs_info *p, const char *src, SYSNO sysno, time_t mtime) char info[16]; sprintf (path, "%s%s", p->prefix, src); - logf (LOG_DEBUG, "dirs_add %s", path); + yaz_log (YLOG_DEBUG, "dirs_add %s", path); memcpy (info, &sysno, sizeof(sysno)); memcpy (info+sizeof(sysno), &mtime, sizeof(mtime)); if (p->rw) @@ -203,7 +203,7 @@ void dirs_del (struct dirs_info *p, const char *src) char path[DIRS_MAX_PATH]; sprintf (path, "%s%s", p->prefix, src); - logf (LOG_DEBUG, "dirs_del %s", path); + yaz_log (YLOG_DEBUG, "dirs_del %s", path); if (p->rw) { if (!strcmp(path, p->nextpath)) diff --git a/index/extract.c b/index/extract.c index 8b4ae22..5c17db5 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.165 2004-10-04 09:27:48 adam Exp $ +/* $Id: extract.c,v 1.166 2004-11-19 10:26:56 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -72,7 +72,7 @@ static void logRecord (ZebraHandle zh) ++zh->records_processed; if (!(zh->records_processed % 1000)) { - logf (LOG_LOG, "Records: "ZINT_FORMAT" i/u/d " + yaz_log (YLOG_LOG, "Records: "ZINT_FORMAT" i/u/d " ZINT_FORMAT"/"ZINT_FORMAT"/"ZINT_FORMAT, zh->records_processed, zh->records_inserted, zh->records_updated, zh->records_deleted); @@ -282,7 +282,7 @@ static char *fileMatchStr (ZebraHandle zh, } else { - logf (LOG_WARN, "Missing ) in match criteria %s in group %s", + yaz_log (YLOG_WARN, "Missing ) in match criteria %s in group %s", spec, zh->m_group ? zh->m_group : "none"); return NULL; } @@ -301,7 +301,7 @@ static char *fileMatchStr (ZebraHandle zh, } if (first) { - logf (LOG_WARN, "Record didn't contain match" + yaz_log (YLOG_WARN, "Record didn't contain match" " fields in (%s,%s)", attset_str, attname_str); return NULL; } @@ -358,7 +358,7 @@ static char *fileMatchStr (ZebraHandle zh, } else { - logf (LOG_WARN, "Syntax error in match criteria %s in group %s", + yaz_log (YLOG_WARN, "Syntax error in match criteria %s in group %s", spec, zh->m_group ? zh->m_group : "none"); return NULL; } @@ -366,7 +366,7 @@ static char *fileMatchStr (ZebraHandle zh, } if (dst == dstBuf) { - logf (LOG_WARN, "No match criteria for record %s in group %s", + yaz_log (YLOG_WARN, "No match criteria for record %s in group %s", fname, zh->m_group ? zh->m_group : "none"); return NULL; } @@ -405,7 +405,7 @@ static int file_extract_record(ZebraHandle zh, recType_byName (zh->reg->recTypes, zh->res, zh->m_record_type, &clientData))) { - logf (LOG_WARN, "No such record type: %s", zh->m_record_type); + yaz_log (YLOG_WARN, "No such record type: %s", zh->m_record_type); return 0; } @@ -470,7 +470,7 @@ static int file_extract_record(ZebraHandle zh, if (zh->m_flag_rw && zh->records_processed < zh->m_file_verbose_limit) { - logf (LOG_WARN, "fail %s %s " PRINTF_OFF_T, zh->m_record_type, + yaz_log (YLOG_WARN, "fail %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); } return 0; @@ -481,7 +481,7 @@ static int file_extract_record(ZebraHandle zh, if (zh->m_flag_rw && zh->records_processed < zh->m_file_verbose_limit) { - logf (LOG_WARN, "no filter for %s %s " + yaz_log (YLOG_WARN, "no filter for %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); } @@ -495,7 +495,7 @@ static int file_extract_record(ZebraHandle zh, return 1; if (zh->records_processed < zh->m_file_verbose_limit) - logf (LOG_WARN, "empty %s %s " PRINTF_OFF_T, zh->m_record_type, + yaz_log (YLOG_WARN, "empty %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); return 1; } @@ -525,7 +525,7 @@ static int file_extract_record(ZebraHandle zh, } else { - logf (LOG_WARN, "Bad match criteria"); + yaz_log (YLOG_WARN, "Bad match criteria"); return 0; } } @@ -536,13 +536,13 @@ static int file_extract_record(ZebraHandle zh, /* new record */ if (deleteFlag) { - logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type, + yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); - logf (LOG_WARN, "cannot delete record above (seems new)"); + yaz_log (YLOG_WARN, "cannot delete record above (seems new)"); return 1; } if (zh->records_processed < zh->m_file_verbose_limit) - logf (LOG_LOG, "add %s %s " PRINTF_OFF_T, zh->m_record_type, + yaz_log (YLOG_LOG, "add %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); rec = rec_new (zh->reg->records); @@ -573,8 +573,8 @@ static int file_extract_record(ZebraHandle zh, if (!force_update && recordAttr->runNumber == zebraExplain_runNumberIncrement (zh->reg->zei, 0)) { - yaz_log (LOG_LOG, "run number = %d", recordAttr->runNumber); - yaz_log (LOG_LOG, "skipped %s %s " PRINTF_OFF_T, + yaz_log (YLOG_LOG, "run number = %d", recordAttr->runNumber); + yaz_log (YLOG_LOG, "skipped %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys); rec_rm (&rec); @@ -594,14 +594,14 @@ static int file_extract_record(ZebraHandle zh, /* record going to be deleted */ if (!delkeys.buf_used) { - logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T, + yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); - logf (LOG_WARN, "cannot delete file above, storeKeys false"); + yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false"); } else { if (zh->records_processed < zh->m_file_verbose_limit) - logf (LOG_LOG, "delete %s %s " PRINTF_OFF_T, + yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); zh->records_deleted++; if (matchStr) @@ -617,14 +617,14 @@ static int file_extract_record(ZebraHandle zh, /* record going to be updated */ if (!delkeys.buf_used) { - logf (LOG_LOG, "update %s %s " PRINTF_OFF_T, + yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); - logf (LOG_WARN, "cannot update file above, storeKeys false"); + yaz_log (YLOG_WARN, "cannot update file above, storeKeys false"); } else { if (zh->records_processed < zh->m_file_verbose_limit) - logf (LOG_LOG, "update %s %s " PRINTF_OFF_T, + yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys); @@ -687,14 +687,14 @@ static int file_extract_record(ZebraHandle zh, xmalloc (recordAttr->recordSize); if (lseek (fi->fd, recordOffset, SEEK_SET) < 0) { - logf (LOG_ERRNO|LOG_FATAL, "seek to " PRINTF_OFF_T " in %s", + yaz_log (YLOG_ERRNO|YLOG_FATAL, "seek to " PRINTF_OFF_T " in %s", recordOffset, fname); exit (1); } if (read (fi->fd, rec->info[recInfo_storeData], recordAttr->recordSize) < recordAttr->recordSize) { - logf (LOG_ERRNO|LOG_FATAL, "read %d bytes of %s", + yaz_log (YLOG_ERRNO|YLOG_FATAL, "read %d bytes of %s", recordAttr->recordSize, fname); exit (1); } @@ -733,7 +733,7 @@ int fileExtract (ZebraHandle zh, SYSNO *sysno, const char *fname, else sprintf (gprefix, "%s.", zh->m_group); - logf (LOG_DEBUG, "fileExtract %s", fname); + yaz_log (YLOG_DEBUG, "fileExtract %s", fname); /* determine file extension */ *ext = '\0'; @@ -755,7 +755,7 @@ int fileExtract (ZebraHandle zh, SYSNO *sysno, const char *fname, if (!zh->m_record_type) { if (zh->records_processed < zh->m_file_verbose_limit) - logf (LOG_LOG, "? %s", fname); + yaz_log (YLOG_LOG, "? %s", fname); return 0; } /* determine match criteria */ @@ -783,7 +783,7 @@ int fileExtract (ZebraHandle zh, SYSNO *sysno, const char *fname, if ((fd = open (full_rep, O_BINARY|O_RDONLY)) == -1) { - logf (LOG_WARN|LOG_ERRNO, "open %s", full_rep); + yaz_log (YLOG_WARN|YLOG_ERRNO, "open %s", full_rep); zh->m_record_type = original_record_type; return 0; } @@ -858,22 +858,22 @@ int buffer_extract_record (ZebraHandle zh, } if (recordType && *recordType) { - logf (LOG_DEBUG, "Record type explicitly specified: %s", recordType); + yaz_log (YLOG_DEBUG, "Record type explicitly specified: %s", recordType); recType = recType_byName (zh->reg->recTypes, zh->res, recordType, &clientData); } else { if (!(zh->m_record_type)) { - logf (LOG_WARN, "No such record type defined"); + yaz_log (YLOG_WARN, "No such record type defined"); return 0; } - logf (LOG_DEBUG, "Get record type from rgroup: %s",zh->m_record_type); + yaz_log (YLOG_DEBUG, "Get record type from rgroup: %s",zh->m_record_type); recType = recType_byName (zh->reg->recTypes, zh->res, zh->m_record_type, &clientData); recordType = zh->m_record_type; } if (!recType) { - logf (LOG_WARN, "No such record type: %s", zh->m_record_type); + yaz_log (YLOG_WARN, "No such record type: %s", zh->m_record_type); return 0; } @@ -899,13 +899,13 @@ int buffer_extract_record (ZebraHandle zh, else if (r == RECCTRL_EXTRACT_ERROR_GENERIC) { /* error occured during extraction ... */ - yaz_log (LOG_WARN, "extract error: generic"); + yaz_log (YLOG_WARN, "extract error: generic"); return 0; } else if (r == RECCTRL_EXTRACT_ERROR_NO_SUCH_FILTER) { /* error occured during extraction ... */ - yaz_log (LOG_WARN, "extract error: no such filter"); + yaz_log (YLOG_WARN, "extract error: no such filter"); return 0; } if (zh->reg->keys.buf_used == 0) @@ -914,8 +914,8 @@ int buffer_extract_record (ZebraHandle zh, is probably empty - unless flagShowRecords is in use */ if (test_mode) return 1; - logf (LOG_WARN, "No keys generated for record"); - logf (LOG_WARN, " The file is probably empty"); + yaz_log (YLOG_WARN, "No keys generated for record"); + yaz_log (YLOG_WARN, " The file is probably empty"); return 1; } /* match criteria */ @@ -931,7 +931,7 @@ int buffer_extract_record (ZebraHandle zh, zh->m_record_id); if (!matchStr) { - logf (LOG_WARN, "Bad match criteria (recordID)"); + yaz_log (YLOG_WARN, "Bad match criteria (recordID)"); return 1; } } @@ -951,12 +951,12 @@ int buffer_extract_record (ZebraHandle zh, /* new record */ if (delete_flag) { - logf (LOG_LOG, "delete %s %s %ld", recordType, + yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, pr_fname, (long) recordOffset); - logf (LOG_WARN, "cannot delete record above (seems new)"); + yaz_log (YLOG_WARN, "cannot delete record above (seems new)"); return 1; } - logf (LOG_LOG, "add %s %s %ld", recordType, pr_fname, + yaz_log (YLOG_LOG, "add %s %s %ld", recordType, pr_fname, (long) recordOffset); rec = rec_new (zh->reg->records); @@ -981,7 +981,7 @@ int buffer_extract_record (ZebraHandle zh, struct sortKeys sortKeys; if (!allow_update) { - logf (LOG_LOG, "skipped %s %s %ld", + yaz_log (YLOG_LOG, "skipped %s %s %ld", recordType, pr_fname, (long) recordOffset); logRecord(zh); return -1; @@ -996,7 +996,7 @@ int buffer_extract_record (ZebraHandle zh, if (recordAttr->runNumber == zebraExplain_runNumberIncrement (zh->reg->zei, 0)) { - logf (LOG_LOG, "skipped %s %s %ld", recordType, + yaz_log (YLOG_LOG, "skipped %s %s %ld", recordType, pr_fname, (long) recordOffset); extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys); rec_rm (&rec); @@ -1018,13 +1018,13 @@ int buffer_extract_record (ZebraHandle zh, /* record going to be deleted */ if (!delkeys.buf_used) { - logf (LOG_LOG, "delete %s %s %ld", recordType, + yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, pr_fname, (long) recordOffset); - logf (LOG_WARN, "cannot delete file above, storeKeys false"); + yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false"); } else { - logf (LOG_LOG, "delete %s %s %ld", recordType, + yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, pr_fname, (long) recordOffset); zh->records_deleted++; if (matchStr) @@ -1040,13 +1040,13 @@ int buffer_extract_record (ZebraHandle zh, /* record going to be updated */ if (!delkeys.buf_used) { - logf (LOG_LOG, "update %s %s %ld", recordType, + yaz_log (YLOG_LOG, "update %s %s %ld", recordType, pr_fname, (long) recordOffset); - logf (LOG_WARN, "cannot update file above, storeKeys false"); + yaz_log (YLOG_WARN, "cannot update file above, storeKeys false"); } else { - logf (LOG_LOG, "update %s %s %ld", recordType, + yaz_log (YLOG_LOG, "update %s %s %ld", recordType, pr_fname, (long) recordOffset); extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); extract_flushRecordKeys (zh, *sysno, 1, &zh->reg->keys); @@ -1209,7 +1209,7 @@ void extract_flushRecordKeys (ZebraHandle zh, SYSNO sysno, int mem= 1024*1024* atoi( res_get_def( zh->res, "memmax", "8")); if (mem <= 0) { - logf(LOG_WARN, "Invalid memory setting, using default 8 MB"); + yaz_log(YLOG_WARN, "Invalid memory setting, using default 8 MB"); mem= 1024*1024*8; } /* FIXME: That "8" should be in a default settings include */ @@ -1286,19 +1286,19 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) #endif if (!zh->reg->key_buf || ptr_i <= 0) { - logf (LOG_DEBUG, " nothing to flush section=%d buf=%p i=%d", + yaz_log (YLOG_DEBUG, " nothing to flush section=%d buf=%p i=%d", zh->reg->key_file_no, zh->reg->key_buf, ptr_i); - logf (LOG_DEBUG, " buf=%p ", + yaz_log (YLOG_DEBUG, " buf=%p ", zh->reg->key_buf); - logf (LOG_DEBUG, " ptr=%d ",zh->reg->ptr_i); - logf (LOG_DEBUG, " reg=%p ",zh->reg); + yaz_log (YLOG_DEBUG, " ptr=%d ",zh->reg->ptr_i); + yaz_log (YLOG_DEBUG, " reg=%p ",zh->reg); return; } (zh->reg->key_file_no)++; - logf (LOG_LOG, "sorting section %d", (zh->reg->key_file_no)); - logf (LOG_DEBUG, " sort_buff at %p n=%d", + yaz_log (YLOG_LOG, "sorting section %d", (zh->reg->key_file_no)); + yaz_log (YLOG_DEBUG, " sort_buff at %p n=%d", zh->reg->key_buf + zh->reg->ptr_top - ptr_i,ptr_i); #if !SORT_EXTRA qsort (zh->reg->key_buf + zh->reg->ptr_top - ptr_i, ptr_i, @@ -1312,7 +1312,7 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) temp_policy=toupper(res_get_def(zh->res,"tempfiles","auto")[0]); if (temp_policy != 'Y' && temp_policy != 'N' && temp_policy != 'A') { - logf (LOG_WARN, "Illegal tempfiles setting '%c'. using 'Auto' ", + yaz_log (YLOG_WARN, "Illegal tempfiles setting '%c'. using 'Auto' ", temp_policy); temp_policy='A'; } @@ -1334,10 +1334,10 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) if (!(outf = fopen (out_fname, "wb"))) { - logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", out_fname); exit (1); } - logf (LOG_LOG, "writing section %d", zh->reg->key_file_no); + yaz_log (YLOG_LOG, "writing section %d", zh->reg->key_file_no); prevcp = cp = (zh->reg->key_buf)[zh->reg->ptr_top - ptr_i]; encode_key_init (&encode_info); @@ -1363,10 +1363,10 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) if (!(outf = fopen (out_fname, "wb"))) { - logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", out_fname); exit (1); } - logf (LOG_LOG, "writing section %d", key_file_no); + yaz_log (YLOG_LOG, "writing section %d", key_file_no); i = ptr_i; prevcp = key_buf[ptr_top-i]; while (1) @@ -1374,7 +1374,7 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) { key_y_len = strlen(prevcp)+1; #if 0 - logf (LOG_LOG, "key_y_len: %2d %02x %02x %s", + yaz_log (YLOG_LOG, "key_y_len: %2d %02x %02x %s", key_y_len, prevcp[0], prevcp[1], 2+prevcp); #endif qsort (key_buf + ptr_top-ptr_i, ptr_i - i, @@ -1396,10 +1396,10 @@ void extract_flushWriteKeys (ZebraHandle zh, int final) #endif if (fclose (outf)) { - logf (LOG_FATAL|LOG_ERRNO, "fclose %s", out_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fclose %s", out_fname); exit (1); } - logf (LOG_LOG, "finished section %d", zh->reg->key_file_no); + yaz_log (YLOG_LOG, "finished section %d", zh->reg->key_file_no); zh->reg->ptr_i = 0; zh->reg->key_buf_used = 0; } @@ -1431,7 +1431,7 @@ void extract_add_index_string (RecWord *p, const char *str, int length) #if 0 /* just for debugging .. */ - yaz_log(LOG_LOG, "set=%d use=%d seqno=%d", p->attrSet, p->attrUse, + yaz_log(YLOG_LOG, "set=%d use=%d seqno=%d", p->attrSet, p->attrUse, p->seqno); #endif @@ -1543,7 +1543,7 @@ static void extract_add_complete_field (RecWord *p) int i = 0, remain = p->length; int first; /* first position */ -yaz_log(LOG_DEBUG, "Complete field, w='%.*s'", p->length, p->string); +yaz_log(YLOG_DEBUG, "Complete field, w='%.*s'", p->length, p->string); if (remain > 0) map = zebra_maps_input (p->zebra_maps, p->reg_type, &b, remain, 1); @@ -1579,7 +1579,7 @@ yaz_log(LOG_DEBUG, "Complete field, w='%.*s'", p->length, p->string); { if (i >= IT_MAX_WORD) break; - yaz_log(LOG_DEBUG, "Adding string to index '%d'", **map); + yaz_log(YLOG_DEBUG, "Adding string to index '%d'", **map); while (i < IT_MAX_WORD && *cp) buf[i++] = *(cp++); } @@ -1602,7 +1602,7 @@ void extract_token_add (RecWord *p) { WRBUF wrbuf; #if 0 - yaz_log (LOG_LOG, "token_add " + yaz_log (YLOG_LOG, "token_add " "reg_type=%c attrSet=%d attrUse=%d seqno=%d s=%.*s", p->reg_type, p->attrSet, p->attrUse, p->seqno, p->length, p->string); @@ -1686,7 +1686,7 @@ void encode_key_write (char *k, struct encode_info *i, FILE *outf) *bp0 = (*k * 128) + bp - bp0 - 1; /* length and insert/delete combined */ if (fwrite (i->buf, bp - i->buf, 1, outf) != 1) { - logf (LOG_FATAL|LOG_ERRNO, "fwrite"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite"); exit (1); } } @@ -1755,7 +1755,7 @@ void encode_key_write (char *k, struct encode_info *i, FILE *outf) i->cmd = i->prevcmd; if (fwrite (i->buf, bp - i->buf, 1, outf) != 1) { - logf (LOG_FATAL|LOG_ERRNO, "fwrite"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite"); exit (1); } i->keylen=0; /* ok, it's written, forget it */ @@ -1789,7 +1789,7 @@ void encode_key_flush (struct encode_info *i, FILE *outf) i->cmd = i->prevcmd; if (fwrite (i->buf, bp - i->buf, 1, outf) != 1) { - logf (LOG_FATAL|LOG_ERRNO, "fwrite"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fwrite"); exit (1); } i->keylen=0; /* ok, it's written, forget it */ diff --git a/index/invstat.c b/index/invstat.c index 83708e1..0a76d95 100644 --- a/index/invstat.c +++ b/index/invstat.c @@ -1,4 +1,4 @@ -/* $Id: invstat.c,v 1.41 2004-09-15 08:13:51 adam Exp $ +/* $Id: invstat.c,v 1.42 2004-11-19 10:26:57 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -63,7 +63,7 @@ static void print_dict_item (ZebraMaps zm, const char *s, zint count, *to++ = *res++; } *to = '\0'; - /* yaz_log (LOG_LOG, "%s", keybuf); */ + /* yaz_log (YLOG_LOG, "%s", keybuf); */ printf("%10" ZINT_FORMAT0 " %s %d.%d - %d.%d\n", count, keybuf, firstsys,firstseq, lastsys,lastseq); } diff --git a/index/kcompare.c b/index/kcompare.c index eaf4d33..1951681 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -1,4 +1,4 @@ -/* $Id: kcompare.c,v 1.53 2004-11-04 11:47:23 heikki Exp $ +/* $Id: kcompare.c,v 1.54 2004-11-19 10:26:57 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -50,10 +50,10 @@ void key_logdump_txt (int logmask, const void *p, const char *txt) strcat(formstr, "."); sprintf(formstr + strlen(formstr), ZINT_FORMAT, key.mem[i]); } - logf (logmask, "%s %s", formstr, txt); + yaz_log (logmask, "%s %s", formstr, txt); } else - logf(logmask, " (null) %s",txt); + yaz_log(logmask, " (null) %s",txt); } void key_logdump (int logmask, const void *p) diff --git a/index/kdump.c b/index/kdump.c index 85327eb..fbba2e3 100644 --- a/index/kdump.c +++ b/index/kdump.c @@ -1,4 +1,4 @@ -/* $Id: kdump.c,v 1.26 2004-09-15 08:13:51 adam Exp $ +/* $Id: kdump.c,v 1.27 2004-11-19 10:26:57 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -133,13 +133,13 @@ int main (int argc, char **argv) { if (!(res = res_open (arg, 0, 0))) { - logf(LOG_FATAL, "Failed to open resource file %s", arg); + yaz_log(YLOG_FATAL, "Failed to open resource file %s", arg); exit (1); } } else { - logf (LOG_FATAL, "Unknown option '-%s'", arg); + yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg); exit (1); } } @@ -153,7 +153,7 @@ int main (int argc, char **argv) zm = zebra_maps_open (res, 0); if (!(inf = fopen (key_fname, "r"))) { - logf (LOG_FATAL|LOG_ERRNO, "fopen %s", key_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fopen %s", key_fname); exit (1); } printf ("t rg op sysno seqno txt\n"); @@ -187,7 +187,7 @@ int main (int argc, char **argv) zebra_maps_close (zm); if (fclose (inf)) { - logf (LOG_FATAL|LOG_ERRNO, "fclose %s", key_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "fclose %s", key_fname); exit (1); } exit (0); diff --git a/index/kinput.c b/index/kinput.c index 06607ff..eeb610d 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -1,4 +1,4 @@ -/* $Id: kinput.c,v 1.62 2004-09-15 08:13:51 adam Exp $ +/* $Id: kinput.c,v 1.63 2004-11-19 10:26:57 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -82,21 +82,21 @@ void key_file_chunk_read (struct key_file *f) f->buf_size = 0; if (fd == -1) { - logf (LOG_WARN|LOG_ERRNO, "cannot open %s", fname); + yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot open %s", fname); return ; } if (!f->length) { if ((f->length = lseek (fd, 0L, SEEK_END)) == (off_t) -1) { - logf (LOG_WARN|LOG_ERRNO, "cannot seek %s", fname); + yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot seek %s", fname); close (fd); return ; } } if (lseek (fd, f->offset, SEEK_SET) == -1) { - logf (LOG_WARN|LOG_ERRNO, "cannot seek %s", fname); + yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot seek %s", fname); close(fd); return ; } @@ -109,7 +109,7 @@ void key_file_chunk_read (struct key_file *f) } if (r == -1) { - logf (LOG_WARN|LOG_ERRNO, "read of %s", fname); + yaz_log (YLOG_WARN|YLOG_ERRNO, "read of %s", fname); close (fd); return; } @@ -288,8 +288,8 @@ struct heap_info *key_heap_init_buff ( ZebraHandle zh, void key_heap_destroy (struct heap_info *hi, int nkeys) { int i; - yaz_log (LOG_DEBUG, "key_heap_destroy"); - yaz_log (LOG_DEBUG, "key_heap_destroy nk=%d",nkeys); + yaz_log (YLOG_DEBUG, "key_heap_destroy"); + yaz_log (YLOG_DEBUG, "key_heap_destroy nk=%d",nkeys); if (!hi->zh) for (i = 0; i<=nkeys; i++) xfree (hi->info.buf[i]); @@ -363,7 +363,7 @@ static int heap_read_one_raw (struct heap_info *hi, char *name, char *key) return 0; --(zh->reg->ptr_i); cp=(zh->reg->key_buf)[zh->reg->ptr_top - ptr_i]; - logf (LOG_DEBUG, " raw: i=%ld top=%ld cp=%p", (long) ptr_i, + yaz_log (YLOG_DEBUG, " raw: i=%ld top=%ld cp=%p", (long) ptr_i, (long) zh->reg->ptr_top, cp); strcpy(name, cp); memcpy(key, cp+strlen(name)+1, KEY_SIZE); @@ -603,7 +603,7 @@ static void print_dict_item (ZebraMaps zm, const char *s) *to++ = *res++; } *to = '\0'; - yaz_log (LOG_LOG, "%s", keybuf); + yaz_log (YLOG_LOG, "%s", keybuf); } #endif @@ -701,7 +701,7 @@ int heap_inps (struct heap_info *hi) } else { - logf (LOG_FATAL, "isams doesn't support this kind of update"); + yaz_log (YLOG_FATAL, "isams doesn't support this kind of update"); break; } } @@ -731,10 +731,10 @@ void progressFunc (struct key_file *keyp, void *info) remaining = (time_t) ((now - p->startTime)* ((double) p->totalBytes/p->totalOffset - 1.0)); if (remaining <= 130) - logf (LOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining", + yaz_log (YLOG_LOG, "Merge %2.1f%% completed; %ld seconds remaining", (100.0*p->totalOffset) / p->totalBytes, (long) remaining); else - logf (LOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining", + yaz_log (YLOG_LOG, "Merge %2.1f%% completed; %ld minutes remaining", (100.0*p->totalOffset) / p->totalBytes, (long) remaining/60); } p->totalOffset += keyp->buf_size; @@ -754,7 +754,7 @@ void zebra_index_merge (ZebraHandle zh) int nkeys = zh->reg->key_file_no; int usefile; - logf (LOG_DEBUG, " index_merge called with nk=%d b=%p", + yaz_log (YLOG_DEBUG, " index_merge called with nk=%d b=%p", nkeys, zh->reg->key_buf); if ( (nkeys==0) && (zh->reg->key_buf==0) ) return; /* nothing to merge - probably flush after end-trans */ @@ -822,11 +822,11 @@ void zebra_index_merge (ZebraHandle zh) } if (hi->no_iterations) { /* do not log if nothing happened */ - logf (LOG_LOG, "Iterations . . .%7d", hi->no_iterations); - logf (LOG_LOG, "Distinct words .%7d", hi->no_diffs); - logf (LOG_LOG, "Updates. . . . .%7d", hi->no_updates); - logf (LOG_LOG, "Deletions. . . .%7d", hi->no_deletions); - logf (LOG_LOG, "Insertions . . .%7d", hi->no_insertions); + yaz_log (YLOG_LOG, "Iterations . . .%7d", hi->no_iterations); + yaz_log (YLOG_LOG, "Distinct words .%7d", hi->no_diffs); + yaz_log (YLOG_LOG, "Updates. . . . .%7d", hi->no_updates); + yaz_log (YLOG_LOG, "Deletions. . . .%7d", hi->no_deletions); + yaz_log (YLOG_LOG, "Insertions . . .%7d", hi->no_insertions); } zh->reg->key_file_no = 0; diff --git a/index/lockidx.c b/index/lockidx.c index 994f495..219ae60 100644 --- a/index/lockidx.c +++ b/index/lockidx.c @@ -1,4 +1,4 @@ -/* $Id: lockidx.c,v 1.22 2002-08-02 19:26:55 adam Exp $ +/* $Id: lockidx.c,v 1.23 2004-11-19 10:26:58 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -54,7 +54,7 @@ int zebraIndexWait (ZebraHandle zh, int commitPhase) server_lock_cmt = zebra_lock_create (path, 1); if (!server_lock_cmt) { - logf (LOG_WARN|LOG_ERRNO, "cannot create lock %s", path); + yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot create lock %s", path); return -1; } } @@ -69,7 +69,7 @@ int zebraIndexWait (ZebraHandle zh, int commitPhase) server_lock_org = zebra_lock_create (path, 1); if (!server_lock_org) { - logf (LOG_WARN|LOG_ERRNO, "cannot create lock %s", path); + yaz_log (YLOG_WARN|YLOG_ERRNO, "cannot create lock %s", path); return -1; } } @@ -82,17 +82,17 @@ int zebraIndexWait (ZebraHandle zh, int commitPhase) #ifndef WIN32 if (errno != EWOULDBLOCK) { - logf (LOG_FATAL|LOG_ERRNO, "flock"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "flock"); exit (1); } #endif if (commitPhase) - logf (LOG_LOG, "Waiting for lock cmt"); + yaz_log (YLOG_LOG, "Waiting for lock cmt"); else - logf (LOG_LOG, "Waiting for lock org"); + yaz_log (YLOG_LOG, "Waiting for lock org"); if (zebra_lock (h) == -1) { - logf (LOG_FATAL, "flock"); + yaz_log (YLOG_FATAL, "flock"); exit (1); } } @@ -113,7 +113,7 @@ void zebraIndexLockMsg (ZebraHandle zh, const char *str) r = write (fd, str, l); if (r != l) { - logf (LOG_FATAL|LOG_ERRNO, "write lock file"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "write lock file"); exit (1); } zebra_lock_prefix (zh->service->res, path); @@ -131,10 +131,10 @@ void zebraIndexUnlock (ZebraHandle zh) #ifdef WIN32 zebra_lock_destroy (server_lock_main); if (unlink (path) && errno != ENOENT) - logf (LOG_WARN|LOG_ERRNO, "unlink %s failed", path); + yaz_log (YLOG_WARN|YLOG_ERRNO, "unlink %s failed", path); #else if (unlink (path) && errno != ENOENT) - logf (LOG_WARN|LOG_ERRNO, "unlink %s failed", path); + yaz_log (YLOG_WARN|YLOG_ERRNO, "unlink %s failed", path); zebra_lock_destroy (server_lock_main); #endif server_lock_main = 0; @@ -160,13 +160,13 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, server_lock_main = zebra_lock_create (path, 1); if (!server_lock_main) { - logf (LOG_FATAL, "couldn't obtain indexer lock"); + yaz_log (YLOG_FATAL, "couldn't obtain indexer lock"); exit (1); } if (zebra_lock_nb (server_lock_main) == -1) { #ifdef WIN32 - logf (LOG_LOG, "waiting for other index process"); + yaz_log (YLOG_LOG, "waiting for other index process"); zebra_lock (server_lock_main); zebra_unlock (server_lock_main); zebra_lock_destroy (server_lock_main); @@ -174,7 +174,7 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, #else if (errno == EWOULDBLOCK) { - logf (LOG_LOG, "waiting for other index process"); + yaz_log (YLOG_LOG, "waiting for other index process"); zebra_lock (server_lock_main); zebra_unlock (server_lock_main); zebra_lock_destroy (server_lock_main); @@ -182,7 +182,7 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, } else { - logf (LOG_FATAL|LOG_ERRNO, "flock %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "flock %s", path); exit (1); } #endif @@ -191,23 +191,23 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, { int fd = zebra_lock_fd (server_lock_main); - logf (LOG_WARN, "unlocked %s", path); + yaz_log (YLOG_WARN, "unlocked %s", path); r = read (fd, buf, 256); if (r == 0) { - logf (LOG_WARN, "zero length %s", path); + yaz_log (YLOG_WARN, "zero length %s", path); zebra_lock_destroy (server_lock_main); unlink (path); continue; } else if (r == -1) { - logf (LOG_FATAL|LOG_ERRNO, "read %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read %s", path); exit (1); } if (*buf == 'r') { - logf (LOG_WARN, "previous transaction didn't" + yaz_log (YLOG_WARN, "previous transaction didn't" " reach commit"); zebra_lock_destroy (server_lock_main); bf_commitClean (bfs, rval); @@ -216,7 +216,7 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, } else if (*buf == 'd') { - logf (LOG_WARN, "commit file wan't deleted after commit"); + yaz_log (YLOG_WARN, "commit file wan't deleted after commit"); zebra_lock_destroy (server_lock_main); bf_commitClean (bfs, rval); unlink (path); @@ -224,12 +224,12 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, } else if (*buf == 'w') { - logf (LOG_WARN, + yaz_log (YLOG_WARN, "The lock file indicates that your index is"); - logf (LOG_WARN, "inconsistent. Perhaps the indexer"); - logf (LOG_WARN, "terminated abnormally in the previous"); - logf (LOG_WARN, "run. You can try to proceed by"); - logf (LOG_WARN, "deleting the file %s", path); + yaz_log (YLOG_WARN, "inconsistent. Perhaps the indexer"); + yaz_log (YLOG_WARN, "terminated abnormally in the previous"); + yaz_log (YLOG_WARN, "run. You can try to proceed by"); + yaz_log (YLOG_WARN, "deleting the file %s", path); exit (1); } else if (*buf == 'c') @@ -240,13 +240,13 @@ int zebraIndexLock (BFiles bfs, ZebraHandle zh, int commitNow, zebra_lock_destroy (server_lock_main); continue; } - logf (LOG_FATAL, "previous transaction didn't" + yaz_log (YLOG_FATAL, "previous transaction didn't" " finish commit. Commit now!"); exit (1); } else { - logf (LOG_FATAL, "unknown id 0x%02x in %s", *buf, + yaz_log (YLOG_FATAL, "unknown id 0x%02x in %s", *buf, path); exit (1); } diff --git a/index/locksrv.c b/index/locksrv.c index ac79e27..ee69806 100644 --- a/index/locksrv.c +++ b/index/locksrv.c @@ -1,4 +1,4 @@ -/* $Id: locksrv.c,v 1.17 2002-08-02 19:26:55 adam Exp $ +/* $Id: locksrv.c,v 1.18 2004-11-19 10:26:58 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -46,7 +46,7 @@ int zebra_server_lock_init (ZebraService zi) zi->server_path_prefix = (char *) xmalloc (strlen(path_prefix)+1); strcpy (zi->server_path_prefix, path_prefix); - logf (LOG_DEBUG, "Locking system initialized"); + yaz_log (YLOG_DEBUG, "Locking system initialized"); return 0; } @@ -55,7 +55,7 @@ int zebra_server_lock_destroy (ZebraService zi) xfree (zi->server_path_prefix); zebra_lock_destroy (zi->server_lock_cmt); zebra_lock_destroy (zi->server_lock_org); - logf (LOG_DEBUG, "Locking system destroyed"); + yaz_log (YLOG_DEBUG, "Locking system destroyed"); return 0; } @@ -69,7 +69,7 @@ int zebra_server_lock (ZebraService zi, int commitPhase) strcat (path, FNAME_COMMIT_LOCK); if (!(zi->server_lock_cmt = zebra_lock_create (path, 0))) { - logf (LOG_FATAL|LOG_ERRNO, "create %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "create %s", path); return -1; } assert (zi->server_lock_org == NULL); @@ -78,18 +78,18 @@ int zebra_server_lock (ZebraService zi, int commitPhase) strcat (path, FNAME_ORG_LOCK); if (!(zi->server_lock_org = zebra_lock_create (path, 0))) { - logf (LOG_FATAL|LOG_ERRNO, "create %s", path); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "create %s", path); return -1; } } if (commitPhase) { - logf (LOG_DEBUG, "Server locks org"); + yaz_log (YLOG_DEBUG, "Server locks org"); zebra_lock (zi->server_lock_org); } else { - logf (LOG_DEBUG, "Server locks cmt"); + yaz_log (YLOG_DEBUG, "Server locks cmt"); zebra_lock (zi->server_lock_cmt); } return 0; @@ -99,9 +99,9 @@ void zebra_server_unlock (ZebraService zi, int commitPhase) { if (zi->server_lock_org == NULL) return; - logf (LOG_DEBUG, "Server unlocks org"); + yaz_log (YLOG_DEBUG, "Server unlocks org"); zebra_unlock (zi->server_lock_org); - logf (LOG_DEBUG, "Server unlocks cmt"); + yaz_log (YLOG_DEBUG, "Server unlocks cmt"); zebra_unlock (zi->server_lock_cmt); } diff --git a/index/lockutil.c b/index/lockutil.c index 2550322..13e20ff 100644 --- a/index/lockutil.c +++ b/index/lockutil.c @@ -1,4 +1,4 @@ -/* $Id: lockutil.c,v 1.18 2004-01-22 11:27:21 adam Exp $ +/* $Id: lockutil.c,v 1.19 2004-11-19 10:26:59 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -97,7 +97,7 @@ ZebraLockHandle zebra_lock_create (const char *dir, if (h->fd == -1) { if (h->excl_flag <= 1) - logf (LOG_WARN|LOG_ERRNO, "open %s", fname); + yaz_log (YLOG_WARN|YLOG_ERRNO, "open %s", fname); xfree (h); h = 0; } diff --git a/index/main.c b/index/main.c index 11844d1..b8ad1fb 100644 --- a/index/main.c +++ b/index/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.117 2004-09-28 20:09:13 adam Exp $ +/* $Id: main.c,v 1.118 2004-11-19 10:27:00 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -34,7 +34,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #endif -#include +#include #include #include @@ -122,12 +122,12 @@ int main (int argc, char **argv) if (!zs) { const char *config = configName ? configName : "zebra.cfg"; - logf (LOG_LOG, "Zebra version %s %s", + yaz_log (YLOG_LOG, "Zebra version %s %s", ZEBRAVER, ZEBRADATE); zs = zebra_start_res (config, 0, res); if (!zs) { - yaz_log (LOG_FATAL, "Cannot read config %s", config); + yaz_log (YLOG_FATAL, "Cannot read config %s", config); exit (1); } zh = zebra_open (zs); @@ -136,7 +136,7 @@ int main (int argc, char **argv) if (zebra_select_database (zh, database)) { - logf(LOG_FATAL, "Could not select database %s errCode=%d", + yaz_log(YLOG_FATAL, "Could not select database %s errCode=%d", database, zebra_errCode(zh) ); exit (1); } @@ -188,7 +188,7 @@ int main (int argc, char **argv) } else { - logf (LOG_FATAL, "unknown command: %s", arg); + yaz_log (YLOG_FATAL, "unknown command: %s", arg); exit (1); } } @@ -262,7 +262,7 @@ int main (int argc, char **argv) else if (ret == 'L') res_set(res, "followLinks", "0"); else - logf (LOG_WARN, "unknown option '-%s'", arg); + yaz_log (YLOG_WARN, "unknown option '-%s'", arg); } /* while arg */ if (trans_started) @@ -277,7 +277,7 @@ int main (int argc, char **argv) usec = (end_time.tv_sec - start_time.tv_sec) * 1000000.0 + end_time.tv_usec - start_time.tv_usec; times(&tms2); - yaz_log (LOG_LOG, "zebraidx times: %5.2f %5.2f %5.2f", + yaz_log (YLOG_LOG, "zebraidx times: %5.2f %5.2f %5.2f", usec / 1000000, (double) (tms2.tms_utime - tms1.tms_utime)/100, (double) (tms2.tms_stime - tms1.tms_stime)/100); diff --git a/index/recindex.c b/index/recindex.c index 10327c0..e12fc19 100644 --- a/index/recindex.c +++ b/index/recindex.c @@ -1,4 +1,4 @@ -/* $Id: recindex.c,v 1.38 2004-09-26 20:19:44 adam Exp $ +/* $Id: recindex.c,v 1.39 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -56,7 +56,7 @@ static void rec_write_head (Records p) r = bf_write (p->index_BFile, 0, 0, sizeof(p->head), &p->head); if (r) { - logf (LOG_FATAL|LOG_ERRNO, "write head of %s", p->index_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "write head of %s", p->index_fname); exit (1); } } @@ -88,7 +88,7 @@ static int read_indx (Records p, SYSNO sysno, void *buf, int itemsize, r = bf_read (p->index_BFile, 2+pos/RIDX_CHUNK, 0, itemsize - sz1, buf + sz1); if (r != 1 && !ignoreError) { - logf (LOG_FATAL|LOG_ERRNO, "read in %s at pos %ld", + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at pos %ld", p->index_fname, (long) pos); exit (1); } @@ -131,7 +131,7 @@ static void rec_release_blocks (Records p, SYSNO sysno) first ? sizeof(block_and_ref) : sizeof(zint), block_and_ref) != 1) { - logf (LOG_FATAL|LOG_ERRNO, "read in rec_del_single"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in rec_del_single"); exit (1); } if (first) @@ -145,7 +145,7 @@ static void rec_release_blocks (Records p, SYSNO sysno) if (bf_write (p->data_BFile[dst_type], freeblock, 0, sizeof(block_and_ref), block_and_ref)) { - logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single"); exit (1); } return; @@ -156,7 +156,7 @@ static void rec_release_blocks (Records p, SYSNO sysno) if (bf_write (p->data_BFile[dst_type], freeblock, 0, sizeof(freeblock), &p->head.block_free[dst_type])) { - logf (LOG_FATAL|LOG_ERRNO, "write in rec_del_single"); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "write in rec_del_single"); exit (1); } p->head.block_free[dst_type] = freeblock; @@ -200,7 +200,7 @@ static void rec_write_tmp_buf (Records p, int size, SYSNO *sysnos) block_free, 0, sizeof(*p->head.block_free), &p->head.block_free[dst_type]) != 1) { - logf (LOG_FATAL|LOG_ERRNO, "read in %s at free block " ZINT_FORMAT, + yaz_log (YLOG_FATAL|YLOG_ERRNO, "read in %s at free block " ZINT_FORMAT, p->data_fname[dst_type], block_free); exit (1); } @@ -250,7 +250,7 @@ Records rec_open (BFiles bfs, int rw, int compression_method) p->index_BFile = bf_open (bfs, p->index_fname, RIDX_CHUNK, rw); if (p->index_BFile == NULL) { - logf (LOG_FATAL|LOG_ERRNO, "open %s", p->index_fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", p->index_fname); exit (1); } r = bf_read (p->index_BFile, 0, 0, 0, p->tmp_buf); @@ -283,13 +283,13 @@ Records rec_open (BFiles bfs, int rw, int compression_method) memcpy (&p->head, p->tmp_buf, sizeof(p->head)); if (memcmp (p->head.magic, REC_HEAD_MAGIC, sizeof(p->head.magic))) { - logf (LOG_FATAL, "file %s has bad format", p->index_fname); + yaz_log (YLOG_FATAL, "file %s has bad format", p->index_fname); exit (1); } version = atoi (p->head.version); if (version != REC_VERSION) { - logf (LOG_FATAL, "file %s is version %d, but version" + yaz_log (YLOG_FATAL, "file %s is version %d, but version" " %d is required", p->index_fname, version, REC_VERSION); exit (1); } @@ -309,7 +309,7 @@ Records rec_open (BFiles bfs, int rw, int compression_method) p->head.block_size[i], rw))) { - logf (LOG_FATAL|LOG_ERRNO, "bf_open %s", p->data_fname[i]); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "bf_open %s", p->data_fname[i]); exit (1); } } @@ -490,10 +490,10 @@ static void rec_write_multiple (Records p, int saveCount) &csize, out_buf, out_offset, 1, 0, 30); if (i != BZ_OK) { - logf (LOG_WARN, "bzBuffToBuffCompress error code=%d", i); + yaz_log (YLOG_WARN, "bzBuffToBuffCompress error code=%d", i); csize = 0; } - logf (LOG_LOG, "compress %4d %5d %5d", ref_count, out_offset, + yaz_log (YLOG_LOG, "compress %4d %5d %5d", ref_count, out_offset, csize); #endif break; @@ -688,17 +688,17 @@ static Record rec_get_int (Records p, SYSNO sysno) i = bzBuffToBuffDecompress #endif (bz_buf, &bz_size, in_buf, in_size, 0, 0); - logf (LOG_LOG, "decompress %5d %5d", in_size, bz_size); + yaz_log (YLOG_LOG, "decompress %5d %5d", in_size, bz_size); if (i == BZ_OK) break; - logf (LOG_LOG, "failed"); + yaz_log (YLOG_LOG, "failed"); xfree (bz_buf); bz_size *= 2; } in_buf = bz_buf; in_size = bz_size; #else - logf (LOG_FATAL, "cannot decompress record(s) in BZIP2 format"); + yaz_log (YLOG_FATAL, "cannot decompress record(s) in BZIP2 format"); exit (1); #endif break; diff --git a/index/recstat.c b/index/recstat.c index 1ea05bc..df92f74 100644 --- a/index/recstat.c +++ b/index/recstat.c @@ -1,4 +1,4 @@ -/* $Id: recstat.c,v 1.11 2004-08-16 12:09:43 heikki Exp $ +/* $Id: recstat.c,v 1.12 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -35,15 +35,15 @@ void rec_prstat (Records records) int i; zint total_bytes = 0; - logf (LOG_LOG, + yaz_log (YLOG_LOG, "Total records %8" ZINT_FORMAT0, records->head.no_records); for (i = 0; i< REC_BLOCK_TYPES; i++) { - logf (LOG_LOG, "Record blocks of size "ZINT_FORMAT, + yaz_log (YLOG_LOG, "Record blocks of size "ZINT_FORMAT, records->head.block_size[i]); - logf (LOG_LOG, + yaz_log (YLOG_LOG, " Used/Total/Bytes used " ZINT_FORMAT "/" ZINT_FORMAT "/" ZINT_FORMAT, records->head.block_used[i], records->head.block_last[i]-1, @@ -51,10 +51,10 @@ void rec_prstat (Records records) total_bytes += records->head.block_used[i] * records->head.block_size[i]; } - logf (LOG_LOG, + yaz_log (YLOG_LOG, "Total size of record index in bytes %8" ZINT_FORMAT0, records->head.total_bytes); - logf (LOG_LOG, + yaz_log (YLOG_LOG, "Total size with overhead %8" ZINT_FORMAT0, total_bytes); } diff --git a/index/retrieve.c b/index/retrieve.c index dffb20c..b25a3ae 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -1,4 +1,4 @@ -/* $Id: retrieve.c,v 1.25 2004-09-27 10:44:49 adam Exp $ +/* $Id: retrieve.c,v 1.26 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -99,7 +99,7 @@ int zebra_record_fetch (ZebraHandle zh, SYSNO sysno, int score, ODR stream, rec = rec_get (zh->reg->records, sysno); if (!rec) { - logf (LOG_DEBUG, "rec_get fail on sysno=" ZINT_FORMAT, sysno); + yaz_log (YLOG_DEBUG, "rec_get fail on sysno=" ZINT_FORMAT, sysno); *basenamep = 0; return 14; } @@ -120,10 +120,10 @@ int zebra_record_fetch (ZebraHandle zh, SYSNO sysno, int score, ODR stream, if (!(rt = recType_byName (zh->reg->recTypes, zh->res, file_type, &clientData))) { - logf (LOG_WARN, "Retrieve: Cannot handle type %s", file_type); + yaz_log (YLOG_WARN, "Retrieve: Cannot handle type %s", file_type); return 14; } - logf (LOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d", sysno,score); + yaz_log (YLOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d", sysno,score); retrieveCtrl.fh = &fc; fc.fd = -1; retrieveCtrl.fname = fname; @@ -135,7 +135,7 @@ int zebra_record_fetch (ZebraHandle zh, SYSNO sysno, int score, ODR stream, fc.record_int_len = rec->size[recInfo_storeData]; fc.record_int_buf = rec->info[recInfo_storeData]; fc.record_int_pos = 0; - logf (LOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len); + yaz_log (YLOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len); if (raw_mode) { *output_format = VAL_SUTRS; @@ -161,7 +161,7 @@ int zebra_record_fetch (ZebraHandle zh, SYSNO sysno, int score, ODR stream, if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1) { - logf (LOG_WARN|LOG_ERRNO, "Retrieve fail; missing file: %s", + yaz_log (YLOG_WARN|YLOG_ERRNO, "Retrieve fail; missing file: %s", full_rep); rec_rm (&rec); return 14; diff --git a/index/sortidx.c b/index/sortidx.c index e5f2435..2f61fed 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -1,4 +1,4 @@ -/* $Id: sortidx.c,v 1.9 2004-08-04 08:35:23 adam Exp $ +/* $Id: sortidx.c,v 1.10 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -#include +#include #include #include @@ -92,7 +92,7 @@ int sortIdx_type (SortIdx si, int type) sf->type = type; sf->bf = NULL; sprintf (fname, "sort%d", type); - logf (LOG_DEBUG, "sort idx %s wr=%d", fname, si->write_flag); + yaz_log (YLOG_DEBUG, "sort idx %s wr=%d", fname, si->write_flag); sf->bf = bf_open (si->bfs, fname, SORT_IDX_BLOCKSIZE, si->write_flag); if (!sf->bf) { diff --git a/index/trav.c b/index/trav.c index 6b876b3..4c5d666 100644 --- a/index/trav.c +++ b/index/trav.c @@ -1,4 +1,4 @@ -/* $Id: trav.c,v 1.45 2004-09-09 09:07:12 adam Exp $ +/* $Id: trav.c,v 1.46 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -53,7 +53,7 @@ static void repositoryExtractR (ZebraHandle zh, int deleteFlag, char *rep, e = dir_open (rep, zh->path_reg, zh->m_follow_links); if (!e) return; - yaz_log (LOG_LOG, "dir %s", rep); + yaz_log (YLOG_LOG, "dir %s", rep); if (rep[rep_len-1] != '/') rep[rep_len] = '/'; else @@ -122,7 +122,7 @@ static void fileUpdateR (ZebraHandle zh, sprintf (tmppath, "%s%s", base, src); e_src = dir_open (tmppath, zh->path_reg, zh->m_follow_links); - yaz_log (LOG_LOG, "dir %s", tmppath); + yaz_log (YLOG_LOG, "dir %s", tmppath); #if 0 if (!dst || repComp (dst->path, src, src_len)) @@ -167,7 +167,7 @@ static void fileUpdateR (ZebraHandle zh, { if (e_src[i_src].name) { - yaz_log (LOG_DEBUG, "dst=%s src=%s", dst->path + src_len, + yaz_log (YLOG_DEBUG, "dst=%s src=%s", dst->path + src_len, e_src[i_src].name); sd = strcmp (dst->path + src_len, e_src[i_src].name); } @@ -178,7 +178,7 @@ static void fileUpdateR (ZebraHandle zh, sd = 1; else break; - yaz_log (LOG_DEBUG, "trav sd=%d", sd); + yaz_log (YLOG_DEBUG, "trav sd=%d", sd); if (sd == 0) { @@ -194,15 +194,15 @@ static void fileUpdateR (ZebraHandle zh, { dirs_add (di, src, dst->sysno, e_src[i_src].mtime); } - yaz_log (LOG_DEBUG, "old: %s", ctime (&dst->mtime)); - yaz_log (LOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime)); + yaz_log (YLOG_DEBUG, "old: %s", ctime (&dst->mtime)); + yaz_log (YLOG_DEBUG, "new: %s", ctime (&e_src[i_src].mtime)); } dst = dirs_read (di); break; case dirs_dir: fileUpdateR (zh, di, dst, base, src, level+1); dst = dirs_last (di); - yaz_log (LOG_DEBUG, "last is %s", dst ? dst->path : "null"); + yaz_log (YLOG_DEBUG, "last is %s", dst ? dst->path : "null"); break; default: dst = dirs_read (di); @@ -260,7 +260,7 @@ void repositoryShow (ZebraHandle zh, const char *path) if (!(dict = dict_open_res (zh->reg->bfs, FMATCH_DICT, 50, 0, 0, zh->res))) { - yaz_log (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT); + yaz_log (YLOG_FATAL, "dict_open fail of %s", FMATCH_DICT); return; } @@ -277,7 +277,7 @@ void repositoryShow (ZebraHandle zh, const char *path) di = dirs_open (dict, src, zh->m_flag_rw); while ( (dst = dirs_read (di)) ) - yaz_log (LOG_LOG, "%s", dst->path); + yaz_log (YLOG_LOG, "%s", dst->path); dirs_free (&di); dict_close (dict); } @@ -307,7 +307,7 @@ static void fileUpdate (ZebraHandle zh, Dict dict, const char *path) if (ret == -1) { - yaz_log (LOG_WARN|LOG_ERRNO, "Cannot access path %s", src); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src); } else if (S_ISREG(sbuf.st_mode)) { @@ -343,7 +343,7 @@ static void fileUpdate (ZebraHandle zh, Dict dict, const char *path) } else { - yaz_log (LOG_WARN, "Skipping path %s", src); + yaz_log (YLOG_WARN, "Skipping path %s", src); } } @@ -369,13 +369,13 @@ static void repositoryExtract (ZebraHandle zh, strcpy (src, path); if (ret == -1) - yaz_log (LOG_WARN|LOG_ERRNO, "Cannot access path %s", src); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src); else if (S_ISREG(sbuf.st_mode)) fileExtract (zh, NULL, src, deleteFlag); else if (S_ISDIR(sbuf.st_mode)) repositoryExtractR (zh, deleteFlag, src, 0); else - yaz_log (LOG_WARN, "Skipping path %s", src); + yaz_log (YLOG_WARN, "Skipping path %s", src); } static void repositoryExtractG (ZebraHandle zh, const char *path, @@ -401,7 +401,7 @@ void repositoryUpdate (ZebraHandle zh, const char *path) if (!(dict = dict_open_res (zh->reg->bfs, FMATCH_DICT, 50, zh->m_flag_rw, 0, zh->res))) { - yaz_log (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT); + yaz_log (YLOG_FATAL, "dict_open fail of %s", FMATCH_DICT); return ; } if (!strcmp(path, "") || !strcmp(path, "-")) diff --git a/index/trunc.c b/index/trunc.c index 0b6f12d..59ad378 100644 --- a/index/trunc.c +++ b/index/trunc.c @@ -1,4 +1,4 @@ -/* $Id: trunc.c,v 1.48 2004-11-03 16:04:45 heikki Exp $ +/* $Id: trunc.c,v 1.49 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -369,7 +369,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, xfree (ispt); } else - logf (LOG_WARN, "Unknown isam set in rset_trunc_r"); + yaz_log (YLOG_WARN, "Unknown isam set in rset_trunc_r"); rset_close (result_rsfd); return result; @@ -409,7 +409,7 @@ RSET rset_trunc (ZebraHandle zi, ISAMS_P *isam_p, int no, const struct key_control *kctrl, int scope) { TERMID termid; - logf (LOG_DEBUG, "rset_trunc no=%d", no); + yaz_log (YLOG_DEBUG, "rset_trunc no=%d", no); if (no < 1) return rsnull_create (rset_nmem,kctrl); termid=rset_term_create(term, length, flags, term_type,rset_nmem); @@ -448,7 +448,7 @@ RSET rset_trunc (ZebraHandle zi, ISAMS_P *isam_p, int no, } else { - logf (LOG_WARN, "Unknown isam set in rset_trunc"); + yaz_log (YLOG_WARN, "Unknown isam set in rset_trunc"); return rsnull_create (rset_nmem, kctrl); } return rset_trunc_r (zi, term, length, flags, isam_p, 0, no, 100, diff --git a/index/zebraapi.c b/index/zebraapi.c index ca6f4b5..3ede064 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.139 2004-10-29 11:23:52 heikki Exp $ +/* $Id: zebraapi.c,v 1.140 2004-11-19 10:27:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -43,7 +43,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define ASSERTZHRES assert(zh && zh->service && zh->res) #define ASSERTZS assert(zs) -#define LOG_API LOG_APP2 +static int log_level=0; +static int log_level_initialized=0; static Res zebra_open_res (ZebraHandle zh); static void zebra_close_res (ZebraHandle zh); @@ -53,11 +54,11 @@ static void zebra_chdir (ZebraService zs) { const char *dir ; ASSERTZS; - yaz_log(LOG_API,"zebra_chdir"); + yaz_log(log_level,"zebra_chdir"); dir = res_get (zs->global_res, "chdir"); if (!dir) return; - logf (LOG_DEBUG, "chdir %s", dir); + yaz_log (YLOG_DEBUG, "chdir %s", dir); #ifdef WIN32 _chdir(dir); #else @@ -68,7 +69,7 @@ static void zebra_chdir (ZebraService zs) static void zebra_flush_reg (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_flush_reg"); + yaz_log(log_level,"zebra_flush_reg"); zh->errCode=0; zebraExplain_flush (zh->reg->zei, zh); @@ -87,13 +88,19 @@ ZebraHandle zebra_open (ZebraService zs) { ZebraHandle zh; const char *default_encoding; - yaz_log(LOG_API,"zebra_open"); + if (!log_level_initialized) + { + log_level=yaz_log_module_level("zebraapi"); + log_level_initialized=1; + } + + yaz_log(log_level,"zebra_open"); if (!zs) return 0; zh = (ZebraHandle) xmalloc (sizeof(*zh)); - yaz_log (LOG_DEBUG, "zebra_open zs=%p returns %p", zs, zh); + yaz_log (YLOG_DEBUG, "zebra_open zs=%p returns %p", zs, zh); zh->service = zs; zh->reg = 0; /* no register attached yet */ @@ -123,12 +130,12 @@ ZebraHandle zebra_open (ZebraService zs) zh->iconv_to_utf8 = yaz_iconv_open ("UTF-8", default_encoding); if (zh->iconv_to_utf8 == 0) - yaz_log (LOG_WARN, "iconv: %s to UTF-8 unsupported", + yaz_log (YLOG_WARN, "iconv: %s to UTF-8 unsupported", default_encoding); zh->iconv_from_utf8 = yaz_iconv_open (default_encoding, "UTF-8"); if (zh->iconv_to_utf8 == 0) - yaz_log (LOG_WARN, "iconv: UTF-8 to %s unsupported", + yaz_log (YLOG_WARN, "iconv: UTF-8 to %s unsupported", default_encoding); zebra_mutex_cond_lock (&zs->session_lock); @@ -150,14 +157,20 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) { Res res; - yaz_log(LOG_API,"zebra_start %s",configName); + if (!log_level_initialized) + { + log_level=yaz_log_module_level("zebraapi"); + log_level_initialized=1; + } + + yaz_log(log_level,"zebra_start %s",configName); assert(configName); if ((res = res_open (configName, def_res, over_res))) { ZebraService zh = xmalloc (sizeof(*zh)); - yaz_log (LOG_DEBUG, "Read resources `%s'", configName); + yaz_log (YLOG_DEBUG, "Read resources `%s'", configName); zh->global_res = res; zh->configName = xstrdup(configName); @@ -172,7 +185,7 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) { zh->passwd_db = passwd_db_open (); if (!zh->passwd_db) - logf (LOG_WARN|LOG_ERRNO, "passwd_db_open failed"); + yaz_log (YLOG_WARN|YLOG_ERRNO, "passwd_db_open failed"); else passwd_db_file (zh->passwd_db, res_get (zh->global_res, "passwd")); @@ -214,7 +227,7 @@ Dict dict_open_res (BFiles bfs, const char *name, int cache, int rw, if (v) { page_size = atoi(v); - yaz_log(LOG_LOG, "Using custom dictionary page size %d for %s", + yaz_log(YLOG_LOG, "Using custom dictionary page size %d for %s", page_size, name); } return dict_open(bfs, name, cache, rw, compact_flag, page_size); @@ -244,7 +257,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, assert (res); - yaz_log (LOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s", + yaz_log (YLOG_DEBUG, "zebra_register_open rw=%d useshadow=%d p=%p n=%s rp=%s", rw, useshadow, reg, name, reg_path ? reg_path : "(none)"); reg->dh = data1_createx (DATA1_FLAG_XML); @@ -261,7 +274,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, getcwd(cwd, sizeof(cwd)-1); profilePath = res_get_def(res, "profilePath", DEFAULT_PROFILE_PATH); - yaz_log(LOG_DEBUG, "profilePath=%s cwd=%s", profilePath, cwd); + yaz_log(YLOG_DEBUG, "profilePath=%s cwd=%s", profilePath, cwd); data1_set_tabpath (reg->dh, profilePath); data1_set_tabroot (reg->dh, reg_path); @@ -302,7 +315,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->records = rec_open (reg->bfs, rw, record_compression))) { - logf (LOG_WARN, "rec_open"); + yaz_log (YLOG_WARN, "rec_open"); return 0; } if (rw) @@ -311,12 +324,12 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, } if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res))) { - logf (LOG_WARN, "dict_open"); + yaz_log (YLOG_WARN, "dict_open"); return 0; } if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw))) { - logf (LOG_WARN, "sortIdx_open"); + yaz_log (YLOG_WARN, "sortIdx_open"); return 0; } if (res_get_match (res, "isam", "s", ISAM_DEFAULT)) @@ -325,7 +338,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->isams = isams_open (reg->bfs, FNAME_ISAMS, rw, key_isams_m(res, &isams_m)))) { - logf (LOG_WARN, "isams_open"); + yaz_log (YLOG_WARN, "isams_open"); return 0; } } @@ -335,7 +348,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC, rw, key_isamc_m(res, &isamc_m)))) { - logf (LOG_WARN, "isc_open"); + yaz_log (YLOG_WARN, "isc_open"); return 0; } } @@ -346,7 +359,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->isamb = isamb_open (reg->bfs, "isamb", rw, key_isamc_m(res, &isamc_m), 0))) { - logf (LOG_WARN, "isamb_open"); + yaz_log (YLOG_WARN, "isamb_open"); return 0; } } @@ -357,7 +370,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->isamb = isamb_open (reg->bfs, "isamb", rw, key_isamc_m(res, &isamc_m), 1))) { - logf (LOG_WARN, "isamb_open"); + yaz_log (YLOG_WARN, "isamb_open"); return 0; } } @@ -368,7 +381,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (!(reg->isamb = isamb_open (reg->bfs, "isamb", rw, key_isamc_m(res, &isamc_m), -1))) { - logf (LOG_WARN, "isamb_open"); + yaz_log (YLOG_WARN, "isamb_open"); return 0; } } @@ -377,18 +390,18 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, explain_extract); if (!reg->zei) { - logf (LOG_WARN, "Cannot obtain EXPLAIN information"); + yaz_log (YLOG_WARN, "Cannot obtain EXPLAIN information"); return 0; } reg->active = 2; - yaz_log (LOG_DEBUG, "zebra_register_open ok p=%p", reg); + yaz_log (YLOG_DEBUG, "zebra_register_open ok p=%p", reg); return reg; } int zebra_admin_shutdown (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_admin_shutdown"); + yaz_log(log_level,"zebra_admin_shutdown"); zh->errCode=0; zebra_mutex_cond_lock (&zh->service->session_lock); @@ -401,7 +414,7 @@ int zebra_admin_start (ZebraHandle zh) { ZebraService zs; ASSERTZH; - yaz_log(LOG_API,"zebra_admin_start"); + yaz_log(log_level,"zebra_admin_start"); zh->errCode=0; zs = zh->service; zebra_mutex_cond_lock (&zs->session_lock); @@ -413,7 +426,7 @@ static void zebra_register_close (ZebraService zs, struct zebra_register *reg) { ASSERTZS; assert(reg); - yaz_log(LOG_DEBUG, "zebra_register_close p=%p", reg); + yaz_log(YLOG_DEBUG, "zebra_register_close p=%p", reg); reg->stop_flag = 0; zebra_chdir (zs); if (reg->records) @@ -451,7 +464,7 @@ int zebra_stop(ZebraService zs) { if (!zs) return 0; - yaz_log (LOG_API, "zebra_stop"); + yaz_log (log_level, "zebra_stop"); while (zs->sessions) { @@ -477,14 +490,14 @@ int zebra_close (ZebraHandle zh) struct zebra_session **sp; int i; - yaz_log(LOG_API,"zebra_close"); + yaz_log(log_level,"zebra_close"); if (!zh) return 0; ASSERTZH; zh->errCode=0; zs = zh->service; - yaz_log (LOG_DEBUG, "zebra_close zh=%p", zh); + yaz_log (YLOG_DEBUG, "zebra_close zh=%p", zh); resultSetDestroy (zh, -1, 0, 0); if (zh->reg) @@ -555,7 +568,7 @@ static Res zebra_open_res (ZebraHandle zh) } else { - yaz_log (LOG_WARN, "no register root specified"); + yaz_log (YLOG_WARN, "no register root specified"); return 0; /* no path for register - fail! */ } return res; @@ -675,7 +688,7 @@ void map_basenames (ZebraHandle zh, ODR stream, struct map_baseinfo *p = &info; int i; ASSERTZH; - yaz_log(LOG_API,"map_basenames "); + yaz_log(log_level,"map_basenames "); assert(stream); zh->errCode=0; @@ -700,13 +713,13 @@ void map_basenames (ZebraHandle zh, ODR stream, *num_bases = info.new_num_bases; *basenames = info.new_basenames; for (i = 0; i<*num_bases; i++) - logf (LOG_DEBUG, "base %s", (*basenames)[i]); + yaz_log (YLOG_DEBUG, "base %s", (*basenames)[i]); } int zebra_select_database (ZebraHandle zh, const char *basename) { ASSERTZH; - yaz_log(LOG_API,"zebra_select_database %s",basename); + yaz_log(log_level,"zebra_select_database %s",basename); assert(basename); zh->errCode=0; return zebra_select_databases (zh, 1, &basename); @@ -722,7 +735,7 @@ int zebra_select_databases (ZebraHandle zh, int num_bases, ASSERTZH; assert(basenames); - yaz_log(LOG_API,"zebra_select_databases n=%d [0]=%s", + yaz_log(log_level,"zebra_select_databases n=%d [0]=%s", num_bases,basenames[0]); zh->errCode=0; @@ -803,7 +816,7 @@ int zebra_search_RPN (ZebraHandle zh, ODR o, assert(query); assert(hits); assert(setname); - yaz_log(LOG_API,"zebra_search_rpn"); + yaz_log(log_level,"zebra_search_rpn"); zh->errCode=0; zh->hits = 0; *hits = 0; @@ -825,7 +838,7 @@ int zebra_search_RPN (ZebraHandle zh, ODR o, while (i--) maxhits *= 10; } if (zh->hits > maxhits) { /* too large for yaz to handle */ - logf(LOG_DEBUG,"limiting hits to "ZINT_FORMAT, maxhits); + yaz_log(YLOG_DEBUG,"limiting hits to "ZINT_FORMAT, maxhits); *hits=maxhits; } else @@ -846,7 +859,7 @@ int zebra_records_retrieve (ZebraHandle zh, ODR stream, assert(recs); assert(num_recs>0); - yaz_log(LOG_API,"zebra_records_retrieve n=%d",num_recs); + yaz_log(log_level,"zebra_records_retrieve n=%d",num_recs); zh->errCode=0; if (!zh->res) @@ -867,7 +880,7 @@ int zebra_records_retrieve (ZebraHandle zh, ODR stream, poset = zebraPosSetCreate (zh, setname, num_recs, pos_array); if (!poset) { - logf (LOG_DEBUG, "zebraPosSetCreate error"); + yaz_log (YLOG_DEBUG, "zebraPosSetCreate error"); zh->errCode = 30; zh->errString = nmem_strdup (stream->mem, setname); ret = -1; @@ -926,7 +939,7 @@ int zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, assert(num_entries); assert(is_partial); assert(entries); - yaz_log(LOG_API,"zebra_scan"); + yaz_log(log_level,"zebra_scan"); zh->errCode=0; if (zebra_begin_read (zh)) { @@ -952,7 +965,7 @@ int zebra_sort (ZebraHandle zh, ODR stream, assert(input_setnames); assert(sort_sequence); assert(sort_status); - yaz_log(LOG_API,"zebra_sort"); + yaz_log(log_level,"zebra_sort"); zh->errCode=0; if (zebra_begin_read (zh)) return 1; @@ -971,7 +984,7 @@ int zebra_deleleResultSet(ZebraHandle zh, int function, assert(num_setnames>0); assert(setnames); assert(statuses); - yaz_log(LOG_API,"zebra_deleleResultSet n=%d",num_setnames); + yaz_log(log_level,"zebra_deleleResultSet n=%d",num_setnames); zh->errCode=0; if (zebra_begin_read(zh)) return Z_DeleteStatus_systemProblemAtTarget; @@ -996,10 +1009,10 @@ int zebra_errCode (ZebraHandle zh) { if (zh) { - yaz_log(LOG_API,"zebra_errCode: %d",zh->errCode); + yaz_log(log_level,"zebra_errCode: %d",zh->errCode); return zh->errCode; } - yaz_log(LOG_API,"zebra_errCode: o"); + yaz_log(log_level,"zebra_errCode: o"); return 0; } @@ -1008,7 +1021,7 @@ const char *zebra_errString (ZebraHandle zh) const char *e=""; if (zh) e= diagbib1_str (zh->errCode); - yaz_log(LOG_API,"zebra_errString: %s",e); + yaz_log(log_level,"zebra_errString: %s",e); return e; } @@ -1017,7 +1030,7 @@ char *zebra_errAdd (ZebraHandle zh) char *a=""; if (zh) a= zh->errString; - yaz_log(LOG_API,"zebra_errAdd: %s",a); + yaz_log(log_level,"zebra_errAdd: %s",a); return a; } @@ -1058,7 +1071,7 @@ int zebra_admin_import_begin (ZebraHandle zh, const char *database, const char *record_type) { ASSERTZH; - yaz_log(LOG_API,"zebra_admin_import_begin db=%s rt=%s", + yaz_log(log_level,"zebra_admin_import_begin db=%s rt=%s", database, record_type); zh->errCode=0; if (zebra_select_database(zh, database)) @@ -1071,7 +1084,7 @@ int zebra_admin_import_begin (ZebraHandle zh, const char *database, int zebra_admin_import_end (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_admin_import_end"); + yaz_log(log_level,"zebra_admin_import_end"); zh->errCode=0; zebra_end_trans (zh); return 0; @@ -1082,7 +1095,7 @@ int zebra_admin_import_segment (ZebraHandle zh, Z_Segment *segment) SYSNO sysno; int i; ASSERTZH; - yaz_log(LOG_API,"zebra_admin_import_segment"); + yaz_log(log_level,"zebra_admin_import_segment"); zh->errCode=0; for (i = 0; inum_segmentRecords; i++) { @@ -1131,7 +1144,7 @@ int zebra_admin_exchange_record (ZebraHandle zh, assert(action>0 && action <=4); assert(rec_buf); - yaz_log(LOG_API,"zebra_admin_exchange_record ac=%d", action); + yaz_log(log_level,"zebra_admin_exchange_record ac=%d", action); zh->errCode=0; if (!recid_buf || recid_len <= 0 || recid_len >= sizeof(recid_z)) @@ -1217,7 +1230,7 @@ int zebra_drop_database (ZebraHandle zh, const char *database) { int ret = 0; ASSERTZH; - yaz_log(LOG_API,"zebra_drop_database"); + yaz_log(log_level,"zebra_drop_database"); zh->errCode = 0; if (zebra_select_database (zh, database)) @@ -1233,7 +1246,7 @@ int zebra_drop_database (ZebraHandle zh, const char *database) } else { - yaz_log(LOG_WARN, "drop database only supported for isam:b"); + yaz_log(YLOG_WARN, "drop database only supported for isam:b"); ret = -1; } zebra_end_trans (zh); @@ -1243,7 +1256,7 @@ int zebra_drop_database (ZebraHandle zh, const char *database) int zebra_create_database (ZebraHandle zh, const char *database) { ASSERTZH; - yaz_log(LOG_API,"zebra_create_database %s",database); + yaz_log(log_level,"zebra_create_database %s",database); assert(database); zh->errCode=0; @@ -1273,7 +1286,7 @@ int zebra_string_norm (ZebraHandle zh, unsigned reg_id, ASSERTZH; assert(input_str); assert(output_str); - yaz_log(LOG_API,"zebra_string_norm "); + yaz_log(log_level,"zebra_string_norm "); zh->errCode=0; if (!zh->reg->zebra_maps) return -1; @@ -1298,14 +1311,14 @@ int zebra_set_state (ZebraHandle zh, int val, int seqno) long p = getpid(); FILE *f; ASSERTZH; - yaz_log(LOG_API,"zebra_set_state v=%d seq=%d", val, seqno); + yaz_log(log_level,"zebra_set_state v=%d seq=%d", val, seqno); zh->errCode=0; sprintf (state_fname, "state.%s.LCK", zh->reg_name); fname = zebra_mk_fname (res_get(zh->res, "lockDir"), state_fname); f = fopen (fname, "w"); - yaz_log (LOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p); + yaz_log (YLOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p); fprintf (f, "%c %d %ld\n", val, seqno, p); fclose (f); xfree (fname); @@ -1319,7 +1332,7 @@ int zebra_get_state (ZebraHandle zh, char *val, int *seqno) FILE *f; ASSERTZH; - yaz_log(LOG_API,"zebra_get_state "); + yaz_log(log_level,"zebra_get_state "); zh->errCode=0; sprintf (state_fname, "state.%s.LCK", zh->reg_name); fname = zebra_mk_fname (res_get(zh->res, "lockDir"), state_fname); @@ -1385,7 +1398,7 @@ int zebra_begin_trans (ZebraHandle zh, int rw) return -1; } ASSERTZHRES; - yaz_log(LOG_API,"zebra_begin_trans rw=%d",rw); + yaz_log(log_level,"zebra_begin_trans rw=%d",rw); if (zh->user_perm) { @@ -1454,7 +1467,7 @@ int zebra_begin_trans (ZebraHandle zh, int rw) zebra_get_state (zh, &val, &seqno); if (val == 'c') { - yaz_log (LOG_WARN, "previous transaction didn't finish commit"); + yaz_log (YLOG_WARN, "previous transaction didn't finish commit"); zebra_unlock (zh->lock_shadow); zebra_unlock (zh->lock_normal); zebra_commit (zh); @@ -1466,20 +1479,20 @@ int zebra_begin_trans (ZebraHandle zh, int rw) { BFiles bfs = bfs_create (res_get (zh->res, "shadow"), zh->path_reg); - yaz_log (LOG_WARN, "previous transaction didn't reach commit"); + yaz_log (YLOG_WARN, "previous transaction didn't reach commit"); bf_commitClean (bfs, rval); bfs_destroy (bfs); } else { - yaz_log (LOG_WARN, "your previous transaction didn't finish"); + yaz_log (YLOG_WARN, "your previous transaction didn't finish"); } } break; } if (pass == 2) { - yaz_log (LOG_FATAL, "zebra_begin_trans couldn't finish commit"); + yaz_log (YLOG_FATAL, "zebra_begin_trans couldn't finish commit"); abort(); return -1; } @@ -1502,7 +1515,7 @@ int zebra_begin_trans (ZebraHandle zh, int rw) zh->errCode = 2; zh->errString = "zebra_begin_trans: cannot open register"; - yaz_log(LOG_FATAL, zh->errString); + yaz_log(YLOG_FATAL, zh->errString); return -1; } } @@ -1543,13 +1556,13 @@ int zebra_begin_trans (ZebraHandle zh, int rw) dirty = 1; else if (seqno != zh->reg->seqno) { - yaz_log (LOG_DEBUG, "reopen seqno cur/old %d/%d", + yaz_log (YLOG_DEBUG, "reopen seqno cur/old %d/%d", seqno, zh->reg->seqno); dirty = 1; } else if (zh->reg->last_val != val) { - yaz_log (LOG_DEBUG, "reopen last cur/old %d/%d", + yaz_log (YLOG_DEBUG, "reopen last cur/old %d/%d", val, zh->reg->last_val); dirty = 1; } @@ -1588,7 +1601,7 @@ int zebra_end_trans (ZebraHandle zh) { ZebraTransactionStatus dummy; ASSERTZH; - yaz_log(LOG_API,"zebra_end_trans"); + yaz_log(log_level,"zebra_end_trans"); return zebra_end_transaction(zh, &dummy); } @@ -1600,7 +1613,7 @@ int zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *status) ASSERTZH; assert(status); - yaz_log(LOG_API,"zebra_end_transaction"); + yaz_log(log_level,"zebra_end_transaction"); status->processed = 0; status->inserted = 0; @@ -1631,7 +1644,7 @@ int zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *status) zh->trans_no--; zh->trans_w_no = 0; - yaz_log (LOG_DEBUG, "zebra_end_trans"); + yaz_log (YLOG_DEBUG, "zebra_end_trans"); rval = res_get (zh->res, "shadow"); zebraExplain_runNumberIncrement (zh->reg->zei, 1); @@ -1643,7 +1656,7 @@ int zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *status) zebra_register_close (zh->service, zh->reg); zh->reg = 0; - yaz_log (LOG_LOG, "Records: "ZINT_FORMAT" i/u/d " + yaz_log (YLOG_LOG, "Records: "ZINT_FORMAT" i/u/d " ZINT_FORMAT"/"ZINT_FORMAT"/"ZINT_FORMAT, zh->records_processed, zh->records_inserted, zh->records_updated, zh->records_deleted); @@ -1657,7 +1670,7 @@ int zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *status) if (val != 'd') { BFiles bfs = bfs_create (rval, zh->path_reg); - yaz_log (LOG_DEBUG, "deleting shadow val=%c", val); + yaz_log (YLOG_DEBUG, "deleting shadow val=%c", val); bf_commitClean (bfs, rval); bfs_destroy (bfs); } @@ -1671,7 +1684,7 @@ int zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *status) } #if HAVE_SYS_TIMES_H times (&zh->tms2); - logf (LOG_LOG, "user/system: %ld/%ld", + yaz_log (YLOG_LOG, "user/system: %ld/%ld", (long) (zh->tms2.tms_utime - zh->tms1.tms_utime), (long) (zh->tms2.tms_stime - zh->tms1.tms_stime)); @@ -1686,7 +1699,7 @@ int zebra_repository_update (ZebraHandle zh, const char *path) ASSERTZH; assert(path); zh->errCode=0; - logf (LOG_API, "updating %s", path); + yaz_log (log_level, "updating %s", path); repositoryUpdate (zh, path); return zh->errCode; } @@ -1696,7 +1709,7 @@ int zebra_repository_delete (ZebraHandle zh, const char *path) ASSERTZH; assert(path); zh->errCode=0; - logf (LOG_API, "deleting %s", path); + yaz_log (log_level, "deleting %s", path); repositoryDelete (zh, path); return zh->errCode; } @@ -1705,7 +1718,7 @@ int zebra_repository_show (ZebraHandle zh, const char *path) { ASSERTZH; assert(path); - yaz_log(LOG_API,"zebra_repository_show"); + yaz_log(log_level,"zebra_repository_show"); zh->errCode=0; repositoryShow (zh, path); return zh->errCode; @@ -1728,8 +1741,8 @@ static int zebra_commit_ex (ZebraHandle zh, int clean_only) rval = res_get (zh->res, "shadow"); if (!rval) { - logf (LOG_WARN, "Cannot perform commit"); - logf (LOG_WARN, "No shadow area defined"); + yaz_log (YLOG_WARN, "Cannot perform commit"); + yaz_log (YLOG_WARN, "No shadow area defined"); return 0; } @@ -1750,20 +1763,20 @@ static int zebra_commit_ex (ZebraHandle zh, int clean_only) { zebra_set_state (zh, 'c', seqno); - logf (LOG_DEBUG, "commit start"); + yaz_log (YLOG_DEBUG, "commit start"); bf_commitExec (bfs); #ifndef WIN32 sync (); #endif } - logf (LOG_DEBUG, "commit clean"); + yaz_log (YLOG_DEBUG, "commit clean"); bf_commitClean (bfs, rval); seqno++; zebra_set_state (zh, 'o', seqno); } else { - logf (LOG_LOG, "nothing to commit"); + yaz_log (YLOG_LOG, "nothing to commit"); } bfs_destroy (bfs); @@ -1775,14 +1788,14 @@ static int zebra_commit_ex (ZebraHandle zh, int clean_only) int zebra_clean (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_clean"); + yaz_log(log_level,"zebra_clean"); return zebra_commit_ex(zh, 1); } int zebra_commit (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_commit"); + yaz_log(log_level,"zebra_commit"); return zebra_commit_ex(zh, 0); } @@ -1791,7 +1804,7 @@ int zebra_init (ZebraHandle zh) const char *rval; BFiles bfs = 0; ASSERTZH; - yaz_log(LOG_API,"zebra_init"); + yaz_log(log_level,"zebra_init"); zh->errCode=0; if (!zh->res) @@ -1818,7 +1831,7 @@ int zebra_compact (ZebraHandle zh) { BFiles bfs; ASSERTZH; - yaz_log(LOG_API,"zebra_compact"); + yaz_log(log_level,"zebra_compact"); zh->errCode=0; if (!zh->res) { @@ -1834,7 +1847,7 @@ int zebra_compact (ZebraHandle zh) int zebra_result (ZebraHandle zh, int *code, char **addinfo) { ASSERTZH; - yaz_log(LOG_API,"zebra_result"); + yaz_log(log_level,"zebra_result"); *code = zh->errCode; *addinfo = zh->errString; return 0; @@ -1843,7 +1856,7 @@ int zebra_result (ZebraHandle zh, int *code, char **addinfo) int zebra_shadow_enable (ZebraHandle zh, int value) { ASSERTZH; - yaz_log(LOG_API,"zebra_shadow_enable"); + yaz_log(log_level,"zebra_shadow_enable"); zh->errCode=0; zh->shadow_enable = value; return 0; @@ -1853,7 +1866,7 @@ int zebra_record_encoding (ZebraHandle zh, const char *encoding) { ASSERTZH; assert(encoding); - yaz_log(LOG_API,"zebra_record_encoding"); + yaz_log(log_level,"zebra_record_encoding"); zh->errCode=0; xfree (zh->record_encoding); @@ -1869,16 +1882,16 @@ int zebra_record_encoding (ZebraHandle zh, const char *encoding) zh->record_encoding = xstrdup (encoding); - logf(LOG_DEBUG, "Reset record encoding: %s", encoding); + yaz_log(YLOG_DEBUG, "Reset record encoding: %s", encoding); zh->iconv_to_utf8 = yaz_iconv_open ("UTF-8", encoding); if (zh->iconv_to_utf8 == 0) - yaz_log (LOG_WARN, "iconv: %s to UTF-8 unsupported", encoding); + yaz_log (YLOG_WARN, "iconv: %s to UTF-8 unsupported", encoding); zh->iconv_from_utf8 = yaz_iconv_open (encoding, "UTF-8"); if (zh->iconv_to_utf8 == 0) - yaz_log (LOG_WARN, "iconv: UTF-8 to %s unsupported", encoding); + yaz_log (YLOG_WARN, "iconv: UTF-8 to %s unsupported", encoding); return 0; } @@ -1888,7 +1901,7 @@ int zebra_set_resource(ZebraHandle zh, const char *name, const char *value) ASSERTZH; assert(name); assert(value); - yaz_log(LOG_API,"zebra_set_resource %s:%s",name,value); + yaz_log(log_level,"zebra_set_resource %s:%s",name,value); zh->errCode=0; res_set(zh->res, name, value); return 0; @@ -1903,7 +1916,7 @@ const char *zebra_get_resource(ZebraHandle zh, assert(defaultvalue); v= res_get_def( zh->res, name, (char *)defaultvalue); zh->errCode=0; - yaz_log(LOG_API,"zebra_get_resource %s:%s",name,v); + yaz_log(log_level,"zebra_get_resource %s:%s",name,v); return v; } @@ -1913,21 +1926,21 @@ const char *zebra_get_resource(ZebraHandle zh, int zebra_trans_no (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_trans_no"); + yaz_log(log_level,"zebra_trans_no"); return zh->trans_no; } int zebra_get_shadow_enable (ZebraHandle zh) { ASSERTZH; - yaz_log(LOG_API,"zebra_get_shadow_enable"); + yaz_log(log_level,"zebra_get_shadow_enable"); return (zh->shadow_enable); } int zebra_set_shadow_enable (ZebraHandle zh, int value) { ASSERTZH; - yaz_log(LOG_API,"zebra_set_shadow_enable %d",value); + yaz_log(log_level,"zebra_set_shadow_enable %d",value); zh->shadow_enable = value; return 0; } @@ -1947,7 +1960,7 @@ void api_records_retrieve (ZebraHandle zh, ODR stream, assert(comp); assert(recs); assert(num_recs>0); - yaz_log(LOG_API,"api_records_retrieve s=%s n=%d",setname,num_recs); + yaz_log(log_level,"api_records_retrieve s=%s n=%d",setname,num_recs); if (!zh->res) { @@ -1967,7 +1980,7 @@ void api_records_retrieve (ZebraHandle zh, ODR stream, poset = zebraPosSetCreate (zh, setname, num_recs, pos_array); if (!poset) { - logf (LOG_DEBUG, "zebraPosSetCreate error"); + yaz_log (YLOG_DEBUG, "zebraPosSetCreate error"); zh->errCode = 30; zh->errString = nmem_strdup (stream->mem, setname); } @@ -2046,7 +2059,7 @@ int zebra_insert_record (ZebraHandle zh, ASSERTZH; assert(sysno); assert(buf); - yaz_log(LOG_API, "zebra_insert_record sysno=" ZINT_FORMAT, *sysno); + yaz_log(log_level, "zebra_insert_record sysno=" ZINT_FORMAT, *sysno); if (buf_size < 1) buf_size = strlen(buf); @@ -2075,7 +2088,7 @@ int zebra_update_record (ZebraHandle zh, assert(sysno); assert(buf); - yaz_log(LOG_API, "zebra_update_record sysno=" ZINT_FORMAT, *sysno); + yaz_log(log_level, "zebra_update_record sysno=" ZINT_FORMAT, *sysno); if (buf_size < 1) buf_size = strlen(buf); @@ -2103,7 +2116,7 @@ int zebra_delete_record (ZebraHandle zh, ASSERTZH; assert(sysno); assert(buf); - yaz_log(LOG_API, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno); + yaz_log(log_level, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno); if (buf_size < 1) buf_size = strlen(buf); @@ -2136,18 +2149,18 @@ int zebra_search_PQF (ZebraHandle zh, const char *pqf_query, assert(pqf_query); assert(setname); - yaz_log(LOG_API,"zebra_search_PQF s=%s q=%s",setname, pqf_query); + yaz_log(log_level,"zebra_search_PQF s=%s q=%s",setname, pqf_query); query = p_query_rpn (odr, PROTO_Z3950, pqf_query); if (!query) - yaz_log (LOG_WARN, "bad query %s\n", pqf_query); + yaz_log (YLOG_WARN, "bad query %s\n", pqf_query); else res=zebra_search_RPN (zh, odr, query, setname, &hits); odr_destroy(odr); - yaz_log(LOG_API,"Hits: %d",hits); + yaz_log(log_level,"Hits: %d",hits); if (numhits) *numhits=hits; @@ -2173,10 +2186,10 @@ int zebra_sort_by_specstr (ZebraHandle zh, assert(output_setname); assert(input_setnames); sort_sequence = yaz_sort_spec (stream, sort_spec); - yaz_log(LOG_API,"sort (FIXME) "); + yaz_log(log_level,"sort (FIXME) "); if (!sort_sequence) { - logf(LOG_WARN,"invalid sort specs '%s'", sort_spec); + yaz_log(YLOG_WARN,"invalid sort specs '%s'", sort_spec); zh->errCode = 207; return -1; } diff --git a/index/zebrash.c b/index/zebrash.c index a9d1d38..63a8782 100644 --- a/index/zebrash.c +++ b/index/zebrash.c @@ -1,4 +1,4 @@ -/* $Id: zebrash.c,v 1.29 2004-08-25 09:23:36 adam Exp $ +/* $Id: zebrash.c,v 1.30 2004-11-19 10:27:04 heikki Exp $ Copyright (C) 2002,2003,2004 Index Data Aps @@ -38,7 +38,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #include -#include +#include #include #include #include @@ -62,6 +62,8 @@ ZebraHandle zh=0; /* the current session */ /* time being, only one session works */ int nextrecno=1; /* record number to show next */ static char *default_config = DEFAULTCONFIG; +static int log_level=0; + /************************************** * Help functions @@ -210,10 +212,10 @@ static int cmd_quickstart( char *args[], WRBUF outbuff) rc=onecommand("yaz_log_file zebrash.log",outbuff,""); if (!rc) rc=onecommand("yaz_log_prefix ZebraSh", outbuff,""); - sprintf(tmp, "yaz_log_level 0x%x", LOG_DEFAULT_LEVEL | LOG_APP); + sprintf(tmp, "yaz_log_level 0x%x", YLOG_DEFAULT_LEVEL | log_level ); if (!rc) rc=onecommand(tmp,outbuff,""); - logf(LOG_APP,"quickstart"); + yaz_log(log_level,"quickstart"); if (!zs) if (!rc) rc=onecommand("zebra_start",outbuff,""); @@ -239,7 +241,7 @@ static int cmd_yaz_log_file( char *args[], WRBUF outbuff) static int cmd_yaz_log_level( char *args[], WRBUF outbuff) { - int lev = defargint(args[1],LOG_DEFAULT_LEVEL); + int lev = defargint(args[1],YLOG_DEFAULT_LEVEL); wrbuf_printf(outbuff, "setting yaz-log to level %d (ox%x)\n",lev,lev); yaz_log_init_level(lev); return 0; /* ok */ @@ -260,8 +262,8 @@ static int cmd_logf( char *args[], WRBUF outbuff) if (lev) i=2; else - lev=LOG_LOG; /* this is in the default set!*/ - logf( lev, restargs(args,i)); + lev=YLOG_LOG; /* this is in the default set!*/ + yaz_log( lev, restargs(args,i)); return 0; /* ok */ } @@ -557,7 +559,7 @@ struct cmdstruct cmds[] = { "[prefix]", "Sets the log prefix", cmd_yaz_log_prefix}, - { "logf", + { "yaz_log", "[level] text...", "writes an entry in the log", cmd_logf}, @@ -652,7 +654,7 @@ int onecommand( char *args[MAX_NO_ARGS]; int nargs; char argbuf[MAX_ARG_LEN]; - logf(LOG_APP,"%s",line); + yaz_log(log_level,"%s",line); strncpy(argbuf,line, MAX_ARG_LEN-1); argbuf[MAX_ARG_LEN-1]='\0'; /* just to be sure */ /*memset(args,'\0',MAX_NO_ARGS*sizeof(char *));*/ @@ -692,7 +694,7 @@ int onecommand( return ((cmds[i].testfunc)(args,outbuff)); } wrbuf_printf(outbuff, "Unknown command '%s'. Try help\n",args[0]); - logf(LOG_APP,"Unknown command"); + yaz_log(log_level,"Unknown command"); return -90; } @@ -747,7 +749,7 @@ static void Zerrors ( WRBUF outbuff) ec=zebra_errCode (zh); if (ec) { - logf(LOG_APP, " Zebra error %d: %s, (%s)", + yaz_log(log_level, " Zebra error %d: %s, (%s)", ec, zebra_errString (zh), zebra_errAdd (zh) ); wrbuf_printf(outbuff, " Zebra error %d: %s, (%s)\n", @@ -811,7 +813,7 @@ void shell() if (rc==0) { wrbuf_puts(outbuff, " OK\n"); - logf(LOG_APP, "OK"); + yaz_log(log_level, "OK"); } else if (rc>-90) { @@ -847,11 +849,14 @@ int main (int argc, char ** argv) break; case 'h': usage(); + /* FIXME - handle -v */ default: fprintf(stderr, "bad option %s\n", arg); usage(); } } + log_level=yaz_log_module_level("zebrash"); + shell(); return 0; } /* main */ diff --git a/index/zinfo.c b/index/zinfo.c index 7b16902..d9fce2b 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -1,4 +1,4 @@ -/* $Id: zinfo.c,v 1.40 2004-08-25 09:23:36 adam Exp $ +/* $Id: zinfo.c,v 1.41 2004-11-19 10:27:05 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -198,7 +198,7 @@ void zebraExplain_flush (ZebraExplainInfo zei, void *handle) void zebraExplain_close (ZebraExplainInfo zei) { #if ZINFO_DEBUG - yaz_log (LOG_LOG, "zebraExplain_close"); + yaz_log (YLOG_LOG, "zebraExplain_close"); #endif if (!zei) return; @@ -332,7 +332,7 @@ ZebraExplainInfo zebraExplain_open ( NMEM nmem = nmem_create (); #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_open wr=%d", writeFlag); + yaz_log (YLOG_LOG, "zebraExplain_open wr=%d", writeFlag); #endif zei = (ZebraExplainInfo) nmem_malloc (nmem, sizeof(*zei)); zei->write_flag = writeFlag; @@ -380,7 +380,7 @@ ZebraExplainInfo zebraExplain_open ( if (!zei->data1_target) #endif { - logf (LOG_FATAL, "Explain schema missing. Check profilePath"); + yaz_log (YLOG_FATAL, "Explain schema missing. Check profilePath"); nmem_destroy (zei->nmem); return 0; } @@ -462,7 +462,7 @@ ZebraExplainInfo zebraExplain_open ( np = np->child; assert (np && np->which == DATA1N_data); zei->runNumber = atoi_zn (np->u.data.data, np->u.data.len); - yaz_log (LOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber); + yaz_log (YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber); *zdip = NULL; } rec_rm (&trec); @@ -487,7 +487,7 @@ ZebraExplainInfo zebraExplain_open ( "\n" ); if (!zei->data1_target) { - logf (LOG_FATAL, "Explain schema missing. Check profilePath"); + yaz_log (YLOG_FATAL, "Explain schema missing. Check profilePath"); nmem_destroy (zei->nmem); return 0; } @@ -596,7 +596,7 @@ static void zebraExplain_readAttributeDetails (ZebraExplainInfo zei, node_use->u.data.len); (*zsuip)->info.ordinal = atoi_n (node_ordinal->u.data.data, node_ordinal->u.data.len); - logf (LOG_DEBUG, "set=%d use=%d ordinal=%d", + yaz_log (YLOG_DEBUG, "set=%d use=%d ordinal=%d", (*zsuip)->info.set, (*zsuip)->info.use, (*zsuip)->info.ordinal); zsuip = &(*zsuip)->next; } @@ -703,19 +703,19 @@ int zebraExplain_curDatabase (ZebraExplainInfo zei, const char *database) if (!zdi) return -1; #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_curDatabase: %s", database); + yaz_log (YLOG_LOG, "zebraExplain_curDatabase: %s", database); #endif if (zdi->readFlag) { #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_readDatabase: %s", database); + yaz_log (YLOG_LOG, "zebraExplain_readDatabase: %s", database); #endif zebraExplain_readDatabase (zei, zdi); } if (zdi->attributeDetails->readFlag) { #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_readAttributeDetails: %s", database); + yaz_log (YLOG_LOG, "zebraExplain_readAttributeDetails: %s", database); #endif zebraExplain_readAttributeDetails (zei, zdi->attributeDetails); } @@ -787,7 +787,7 @@ int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database, database_n = database; #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_newDatabase: %s", database); + yaz_log (YLOG_LOG, "zebraExplain_newDatabase: %s", database); #endif assert (zei); for (zdi = zei->databaseInfo; zdi; zdi=zdi->next) @@ -916,7 +916,7 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, node_categoryList = zcl->data1_categoryList; #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_writeCategoryList"); + yaz_log (YLOG_LOG, "zebraExplain_writeCategoryList"); #endif drec = createRecord (zei->records, &sysno); @@ -970,7 +970,7 @@ static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei, zad->dirty = 0; #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_writeAttributeDetails"); + yaz_log (YLOG_LOG, "zebraExplain_writeAttributeDetails"); #endif drec = createRecord (zei->records, &zad->sysno); @@ -1098,7 +1098,7 @@ static void zebraExplain_writeDatabase (ZebraExplainInfo zei, zdi->dirty = 0; #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName); + yaz_log (YLOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName); #endif drec = createRecord (zei->records, &zdi->sysno); assert (zdi->data1_database); @@ -1182,7 +1182,7 @@ static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei, attset = data1_attset_search_id (zei->dh, entp->value); #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_writeAttributeSet %s", + yaz_log (YLOG_LOG, "zebraExplain_writeAttributeSet %s", attset ? attset->name : ""); #endif @@ -1459,7 +1459,7 @@ static void att_loadset(void *p, const char *n, const char *name) { data1_handle dh = (data1_handle) p; if (!data1_get_attset (dh, name)) - logf (LOG_WARN, "Directive attset failed for %s", name); + yaz_log (YLOG_WARN, "Directive attset failed for %s", name); } void zebraExplain_loadAttsets (data1_handle dh, Res res) diff --git a/index/zrpn.c b/index/zrpn.c index bc273e7..c261fa7 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.160 2004-11-15 22:57:25 adam Exp $ +/* $Id: zrpn.c,v 1.161 2004-11-19 10:27:06 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -72,10 +72,10 @@ static const char **rpn_char_map_handler(void *vp, const char **from, int len) if (out && *out) { const char *outp = *out; - yaz_log(LOG_LOG, "---"); + yaz_log(YLOG_LOG, "---"); while (*outp) { - yaz_log(LOG_LOG, "%02X", *outp); + yaz_log(YLOG_LOG, "%02X", *outp); outp++; } } @@ -245,10 +245,10 @@ static void add_isam_p(const char *name, const char *info, int len = key_SU_decode (&su_code, name); term_untrans (p->zh, p->reg_type, term_tmp, name+len+1); - yaz_log(LOG_LOG, "grep: %d %c %s", su_code, name[len], term_tmp); + yaz_log(YLOG_LOG, "grep: %d %c %s", su_code, name[len], term_tmp); zebraExplain_lookup_ord (p->zh->reg->zei, su_code, &db, &set, &use); - yaz_log(LOG_LOG, "grep: set=%d use=%d db=%s", set, use, db); + yaz_log(YLOG_LOG, "grep: set=%d use=%d db=%s", set, use, db); resultSetAddTerm(p->zh, p->termset, name[len], db, set, use, term_tmp); @@ -584,7 +584,7 @@ static void gen_regular_rel(char *dst, int val, int islt) int pos = 0; char numstr[20]; - yaz_log(LOG_DEBUG, "gen_regular_rel. val=%d, islt=%d", val, islt); + yaz_log(YLOG_DEBUG, "gen_regular_rel. val=%d, islt=%d", val, islt); if (val >= 0) { if (islt) @@ -716,7 +716,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, attr_init(&relation, zapt, 2); relation_value = attr_find(&relation, NULL); - yaz_log(LOG_DEBUG, "string relation value=%d", relation_value); + yaz_log(YLOG_DEBUG, "string relation value=%d", relation_value); switch (relation_value) { case 1: @@ -724,7 +724,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, term_sub, term_component, space_split, term_dst)) return 0; - yaz_log(LOG_DEBUG, "Relation <"); + yaz_log(YLOG_DEBUG, "Relation <"); *term_tmp++ = '('; for (i = 0; term_component[i]; ) @@ -757,7 +757,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, term_sub, term_component, space_split, term_dst)) return 0; - yaz_log(LOG_DEBUG, "Relation <="); + yaz_log(YLOG_DEBUG, "Relation <="); *term_tmp++ = '('; for (i = 0; term_component[i]; ) @@ -790,7 +790,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_component, space_split, term_dst)) return 0; - yaz_log(LOG_DEBUG, "Relation >"); + yaz_log(YLOG_DEBUG, "Relation >"); *term_tmp++ = '('; for (i = 0; term_component[i];) @@ -825,7 +825,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_component, space_split, term_dst)) return 0; - yaz_log(LOG_DEBUG, "Relation >="); + yaz_log(YLOG_DEBUG, "Relation >="); *term_tmp++ = '('; for (i = 0; term_component[i];) @@ -861,7 +861,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, break; case 3: default: - yaz_log(LOG_DEBUG, "Relation ="); + yaz_log(YLOG_DEBUG, "Relation ="); if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_component, space_split, term_dst)) return 0; @@ -897,7 +897,7 @@ static RSET term_trunc(ZebraHandle zh, Z_AttributesPlusTerm *zapt, term_dst, xpath_use); if (r < 1) return 0; - yaz_log(LOG_DEBUG, "term: %s", term_dst); + yaz_log(YLOG_DEBUG, "term: %s", term_dst); return rset_trunc(zh, grep_info->isam_p_buf, grep_info->isam_p_indx, term_dst, strlen(term_dst), rank_type, 1 /* preserve pos */, @@ -938,10 +938,10 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, rpn_char_map_prepare (zh->reg, reg_type, &rcmi); attr_init (&use, zapt, 1); use_value = attr_find_ex (&use, &curAttributeSet, &use_string); - yaz_log(LOG_DEBUG, "string_term, use value %d", use_value); + yaz_log(YLOG_DEBUG, "string_term, use value %d", use_value); attr_init (&truncation, zapt, 5); truncation_value = attr_find (&truncation, NULL); - yaz_log(LOG_DEBUG, "truncation value %d", truncation_value); + yaz_log(YLOG_DEBUG, "truncation value %d", truncation_value); if (use_value == -1) /* no attribute - assumy "any" */ use_value = 1016; @@ -983,7 +983,7 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value, use_string))) { - yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d", + yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d", curAttributeSet, use_value, r); if (r == -1) { @@ -1052,7 +1052,7 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, term_dict[prefix_len++] = ')'; term_dict[prefix_len++] = 1; term_dict[prefix_len++] = reg_type; - yaz_log(LOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]); + yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]); term_dict[prefix_len] = '\0'; j = prefix_len; switch (truncation_value) @@ -1136,12 +1136,12 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, } if (attr_ok) { - yaz_log(LOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len); + yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len); r = dict_lookup_grep(zh->reg->dict, term_dict, regex_range, grep_info, &max_pos, init_pos, grep_handle); if (r) - yaz_log(LOG_WARN, "dict_lookup_grep fail %d", r); + yaz_log(YLOG_WARN, "dict_lookup_grep fail %d", r); } } if (!bases_ok) @@ -1151,7 +1151,7 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, return -1; } *term_sub = termp; - yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx); + yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx); return 1; } @@ -1333,7 +1333,7 @@ static int grep_info_prepare (ZebraHandle zh, } else termset_name = termset_value_string; - yaz_log(LOG_LOG, "creating termset set %s", termset_name); + yaz_log(YLOG_LOG, "creating termset set %s", termset_name); grep_info->termset = resultSetAdd (zh, termset_name, 1); if (!grep_info->termset) { @@ -1368,7 +1368,7 @@ static RSET rpn_search_APT_phrase (ZebraHandle zh, return 0; while (1) { - yaz_log(LOG_DEBUG, "APT_phrase termp=%s", termp); + yaz_log(YLOG_DEBUG, "APT_phrase termp=%s", termp); rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, @@ -1415,7 +1415,7 @@ static RSET rpn_search_APT_or_list (ZebraHandle zh, return 0; while (1) { - yaz_log(LOG_DEBUG, "APT_or_list termp=%s", termp); + yaz_log(YLOG_DEBUG, "APT_or_list termp=%s", termp); rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, @@ -1456,7 +1456,7 @@ static RSET rpn_search_APT_and_list (ZebraHandle zh, return 0; while (1) { - yaz_log(LOG_DEBUG, "APT_and_list termp=%s", termp); + yaz_log(YLOG_DEBUG, "APT_and_list termp=%s", termp); rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, @@ -1495,7 +1495,7 @@ static int numeric_relation (ZebraHandle zh, Z_AttributesPlusTerm *zapt, attr_init (&relation, zapt, 2); relation_value = attr_find (&relation, NULL); - yaz_log(LOG_DEBUG, "numeric relation value=%d", relation_value); + yaz_log(YLOG_DEBUG, "numeric relation value=%d", relation_value); if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_tmp, 1, term_dst)) @@ -1504,32 +1504,32 @@ static int numeric_relation (ZebraHandle zh, Z_AttributesPlusTerm *zapt, switch (relation_value) { case 1: - yaz_log(LOG_DEBUG, "Relation <"); + yaz_log(YLOG_DEBUG, "Relation <"); gen_regular_rel (term_tmp, term_value-1, 1); break; case 2: - yaz_log(LOG_DEBUG, "Relation <="); + yaz_log(YLOG_DEBUG, "Relation <="); gen_regular_rel (term_tmp, term_value, 1); break; case 4: - yaz_log(LOG_DEBUG, "Relation >="); + yaz_log(YLOG_DEBUG, "Relation >="); gen_regular_rel (term_tmp, term_value, 0); break; case 5: - yaz_log(LOG_DEBUG, "Relation >"); + yaz_log(YLOG_DEBUG, "Relation >"); gen_regular_rel (term_tmp, term_value+1, 0); break; case 3: default: - yaz_log(LOG_DEBUG, "Relation ="); + yaz_log(YLOG_DEBUG, "Relation ="); sprintf (term_tmp, "(0*%d)", term_value); } - yaz_log(LOG_DEBUG, "dict_lookup_grep: %s", term_tmp); + yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_tmp); r = dict_lookup_grep(zh->reg->dict, term_dict, 0, grep_info, max_pos, 0, grep_handle); if (r) - yaz_log(LOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r); - yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx); + yaz_log(YLOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r); + yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx); return 1; } @@ -1588,7 +1588,7 @@ static int numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value, use_string))) { - yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d", + yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d", curAttributeSet, use_value, r); if (r == -1) { @@ -1639,7 +1639,7 @@ static int numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, term_dict[prefix_len++] = ')'; term_dict[prefix_len++] = 1; term_dict[prefix_len++] = reg_type; - yaz_log(LOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]); + yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]); term_dict[prefix_len] = '\0'; if (!numeric_relation (zh, zapt, &termp, term_dict, attributeSet, grep_info, &max_pos, reg_type, @@ -1653,7 +1653,7 @@ static int numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, return -1; } *term_sub = termp; - yaz_log(LOG_DEBUG, "%d positions", grep_info->isam_p_indx); + yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx); return 1; } @@ -1673,12 +1673,12 @@ static RSET rpn_search_APT_numeric (ZebraHandle zh, int r, rset_no = 0; struct grep_info grep_info; - yaz_log(LOG_DEBUG, "APT_numeric t='%s'",termz); + yaz_log(YLOG_DEBUG, "APT_numeric t='%s'",termz); if (grep_info_prepare (zh, zapt, &grep_info, reg_type, stream)) return 0; while (1) { - yaz_log(LOG_DEBUG, "APT_numeric termp=%s", termp); + yaz_log(YLOG_DEBUG, "APT_numeric termp=%s", termp); grep_info.isam_p_indx = 0; r = numeric_term(zh, zapt, &termp, attributeSet, &grep_info, reg_type, complete_flag, num_bases, basenames, @@ -1686,7 +1686,7 @@ static RSET rpn_search_APT_numeric (ZebraHandle zh, stream); if (r < 1) break; - yaz_log(LOG_DEBUG, "term: %s", term_dst); + yaz_log(YLOG_DEBUG, "term: %s", term_dst); rset[rset_no] = rset_trunc(zh, grep_info.isam_p_buf, grep_info.isam_p_indx, term_dst, strlen(term_dst), rank_type, @@ -1884,7 +1884,7 @@ static RSET xpath_trunc(ZebraHandle zh, NMEM stream, grep_info.isam_p_indx = 0; r = dict_lookup_grep(zh->reg->dict, term_dict, 0, &grep_info, &max_pos, 0, grep_handle); - yaz_log (LOG_LOG, "%s %d positions", term, + yaz_log (YLOG_LOG, "%s %d positions", term, grep_info.isam_p_indx); rset = rset_trunc(zh, grep_info.isam_p_buf, grep_info.isam_p_indx, term, strlen(term), @@ -1908,10 +1908,10 @@ static RSET rpn_search_xpath (ZebraHandle zh, if (xpath_len < 0) return rset; - yaz_log (LOG_LOG, "len=%d", xpath_len); + yaz_log (YLOG_LOG, "len=%d", xpath_len); for (i = 0; ireg->zebra_maps, zapt, ®_id, &search_type, rank_type, &complete_flag, &sort_flag); - yaz_log(LOG_DEBUG, "reg_id=%c", reg_id); - yaz_log(LOG_DEBUG, "complete_flag=%d", complete_flag); - yaz_log(LOG_DEBUG, "search_type=%s", search_type); - yaz_log(LOG_DEBUG, "rank_type=%s", rank_type); + yaz_log(YLOG_DEBUG, "reg_id=%c", reg_id); + yaz_log(YLOG_DEBUG, "complete_flag=%d", complete_flag); + yaz_log(YLOG_DEBUG, "search_type=%s", search_type); + yaz_log(YLOG_DEBUG, "rank_type=%s", rank_type); if (zapt_term_to_utf8(zh, zapt, termz)) return 0; @@ -2208,14 +2208,14 @@ static RSET rpn_search_structure (ZebraHandle zh, Z_RPNStructure *zs, { if (zs->u.simple->which == Z_Operand_APT) { - yaz_log(LOG_DEBUG, "rpn_search_APT"); + yaz_log(YLOG_DEBUG, "rpn_search_APT"); r = rpn_search_APT (zh, zs->u.simple->u.attributesPlusTerm, attributeSet, stream, sort_sequence, num_bases, basenames,rset_nmem); } else if (zs->u.simple->which == Z_Operand_resultSetId) { - yaz_log(LOG_DEBUG, "rpn_search_ref"); + yaz_log(YLOG_DEBUG, "rpn_search_ref"); r = resultSetRef (zh, zs->u.simple->u.resultSetId); if (!r) { @@ -2276,7 +2276,7 @@ RSET rpn_search (ZebraHandle zh, NMEM nmem, NMEM rset_nmem, return 0; if (zh->errCode) - yaz_log(LOG_DEBUG, "search error: %d", zh->errCode); + yaz_log(YLOG_DEBUG, "search error: %d", zh->errCode); for (i = 0; sort_sequence->specs[i]; i++) ; @@ -2285,12 +2285,12 @@ RSET rpn_search (ZebraHandle zh, NMEM nmem, NMEM rset_nmem, resultSetRank (zh, sset, rset, rset_nmem); else { - yaz_log(LOG_DEBUG, "resultSetSortSingle in rpn_search"); + yaz_log(YLOG_DEBUG, "resultSetSortSingle in rpn_search"); resultSetSortSingle (zh, nmem, sset, rset, sort_sequence, &sort_status); if (zh->errCode) { - yaz_log(LOG_DEBUG, "resultSetSortSingle status = %d", zh->errCode); + yaz_log(YLOG_DEBUG, "resultSetSortSingle status = %d", zh->errCode); } } return rset; @@ -2366,7 +2366,7 @@ static void count_set (RSET r, int *count) struct it_key key; RSFD rfd; - yaz_log(LOG_DEBUG, "count_set"); + yaz_log(YLOG_DEBUG, "count_set"); *count = 0; rfd = rset_open (r, RSETF_READ); @@ -2380,7 +2380,7 @@ static void count_set (RSET r, int *count) kno++; } rset_close (rfd); - yaz_log(LOG_DEBUG, "%d keys, %d records", kno, *count); + yaz_log(YLOG_DEBUG, "%d keys, %d records", kno, *count); } void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, @@ -2446,7 +2446,7 @@ void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, } } - yaz_log (LOG_DEBUG, "position = %d, num = %d set=%d", + yaz_log (YLOG_DEBUG, "position = %d, num = %d set=%d", pos, num, attributeset); attr_init (&use, zapt, 1); @@ -2459,7 +2459,7 @@ void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, zh->errCode = 113; return ; } - yaz_log (LOG_DEBUG, "use_value = %d", use_value); + yaz_log (YLOG_DEBUG, "use_value = %d", use_value); if (use_value == -1) use_value = 1016; @@ -2472,7 +2472,7 @@ void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, if ((r=att_getentbyatt (zh, &attp, attributeset, use_value, use_string))) { - yaz_log(LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d", + yaz_log(YLOG_DEBUG, "att_getentbyatt fail. set=%d use=%d", attributeset, use_value); if (r == -1) { @@ -2696,9 +2696,9 @@ void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, nmem_destroy(rset_nmem); *list = glist + i; /* list is set to first 'real' entry */ - yaz_log(LOG_DEBUG, "position = %d, num_entries = %d", + yaz_log(YLOG_DEBUG, "position = %d, num_entries = %d", *position, *num_entries); if (zh->errCode) - yaz_log(LOG_DEBUG, "scan error: %d", zh->errCode); + yaz_log(YLOG_DEBUG, "scan error: %d", zh->errCode); } diff --git a/index/zserver.c b/index/zserver.c index 996c31e..600248a 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -1,4 +1,4 @@ -/* $Id: zserver.c,v 1.122 2004-08-25 09:28:01 adam Exp $ +/* $Id: zserver.c,v 1.123 2004-11-19 10:27:08 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -32,7 +32,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #include -#include +#include #include #include @@ -70,12 +70,12 @@ bend_initresult *bend_init (bend_initrequest *q) q->implementation_name = "Zebra Information Server"; q->implementation_version = "Zebra " ZEBRAVER; - yaz_log (LOG_DEBUG, "bend_init"); + yaz_log (YLOG_DEBUG, "bend_init"); sob = statserv_getcontrol (); if (!(zh = zebra_open (sob->handle))) { - yaz_log (LOG_WARN, "Failed to read config `%s'", sob->configname); + yaz_log (YLOG_WARN, "Failed to read config `%s'", sob->configname); r->errcode = 1; return r; } @@ -118,7 +118,7 @@ bend_initresult *bend_init (bend_initrequest *q) int i; NMEM nmem = nmem_create(); - yaz_log (LOG_LOG, "character set and language negotiation"); + yaz_log (YLOG_LOG, "character set and language negotiation"); yaz_get_proposal_charneg (nmem, q->charneg_request, &charsets, &num_charsets, @@ -149,7 +149,7 @@ bend_initresult *bend_init (bend_initrequest *q) } if (odr_set_charset (q->decode, "UTF-8", right_name) == 0) { - yaz_log (LOG_LOG, "charset %d %s (proper name %s): OK", i, + yaz_log (YLOG_LOG, "charset %d %s (proper name %s): OK", i, charsets[i], right_name); odr_set_charset (q->stream, right_name, "UTF-8"); if (selected) @@ -159,7 +159,7 @@ bend_initresult *bend_init (bend_initrequest *q) 0, selected); break; } else { - yaz_log (LOG_LOG, "charset %d %s (proper name %s): unsupported", i, + yaz_log (YLOG_LOG, "charset %d %s (proper name %s): unsupported", i, charsets[i], right_name); } } @@ -230,12 +230,12 @@ static void search_terms (ZebraHandle zh, bend_search_rr *r) switch (type) { case Z_Term_characterString: - yaz_log (LOG_DEBUG, "term as characterString"); + yaz_log (YLOG_DEBUG, "term as characterString"); term->which = Z_Term_characterString; term->u.characterString = odr_strdup (r->stream, outbuf); break; case Z_Term_general: - yaz_log (LOG_DEBUG, "term as general"); + yaz_log (YLOG_DEBUG, "term as general"); term->which = Z_Term_general; term->u.general = odr_malloc (r->stream, sizeof(*term->u.general)); term->u.general->size = term->u.general->len = len; @@ -271,7 +271,7 @@ int bend_search (void *handle, bend_search_rr *r) zebra_result (zh, &r->errcode, &r->errstring); return 0; } - yaz_log (LOG_LOG, "ResultSet '%s'", r->setname); + yaz_log (YLOG_LOG, "ResultSet '%s'", r->setname); switch (r->query->which) { case Z_Query_type_1: case Z_Query_type_101: @@ -390,48 +390,48 @@ static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r) { if (r->toKeep->databaseName) { - yaz_log(LOG_LOG, "adm request database %s", r->toKeep->databaseName); + yaz_log(YLOG_LOG, "adm request database %s", r->toKeep->databaseName); } switch (r->toKeep->which) { case Z_ESAdminOriginPartToKeep_reIndex: - yaz_log(LOG_LOG, "adm-reindex"); + yaz_log(YLOG_LOG, "adm-reindex"); break; case Z_ESAdminOriginPartToKeep_truncate: - yaz_log(LOG_LOG, "adm-truncate"); + yaz_log(YLOG_LOG, "adm-truncate"); break; case Z_ESAdminOriginPartToKeep_drop: - yaz_log(LOG_LOG, "adm-drop"); + yaz_log(YLOG_LOG, "adm-drop"); zebra_drop_database (zh, r->toKeep->databaseName); break; case Z_ESAdminOriginPartToKeep_create: - yaz_log(LOG_LOG, "adm-create %s", r->toKeep->databaseName); + yaz_log(YLOG_LOG, "adm-create %s", r->toKeep->databaseName); zebra_create_database (zh, r->toKeep->databaseName); break; case Z_ESAdminOriginPartToKeep_import: - yaz_log(LOG_LOG, "adm-import"); + yaz_log(YLOG_LOG, "adm-import"); zebra_admin_import_begin (zh, r->toKeep->databaseName, r->toKeep->u.import->recordType); break; case Z_ESAdminOriginPartToKeep_refresh: - yaz_log(LOG_LOG, "adm-refresh"); + yaz_log(YLOG_LOG, "adm-refresh"); break; case Z_ESAdminOriginPartToKeep_commit: - yaz_log(LOG_LOG, "adm-commit"); + yaz_log(YLOG_LOG, "adm-commit"); if (r->toKeep->databaseName) zebra_select_database(zh, r->toKeep->databaseName); zebra_commit(zh); break; case Z_ESAdminOriginPartToKeep_shutdown: - yaz_log(LOG_LOG, "shutdown"); + yaz_log(YLOG_LOG, "shutdown"); zebra_admin_shutdown(zh); break; case Z_ESAdminOriginPartToKeep_start: - yaz_log(LOG_LOG, "start"); + yaz_log(YLOG_LOG, "start"); zebra_admin_start(zh); break; default: - yaz_log(LOG_LOG, "unknown admin"); + yaz_log(YLOG_LOG, "unknown admin"); } return 0; } @@ -444,7 +444,7 @@ static int es_admin (ZebraHandle zh, Z_Admin *r) es_admin_request (zh, r->u.esRequest); break; case Z_Admin_taskPackage: - yaz_log (LOG_LOG, "adm taskpackage (unhandled)"); + yaz_log (YLOG_LOG, "adm taskpackage (unhandled)"); break; default: break; @@ -469,14 +469,14 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) { ZebraHandle zh = (ZebraHandle) handle; - yaz_log(LOG_LOG, "function: %d", *rr->esr->function); + yaz_log(YLOG_LOG, "function: %d", *rr->esr->function); if (rr->esr->packageName) - yaz_log(LOG_LOG, "packagename: %s", rr->esr->packageName); - yaz_log(LOG_LOG, "Waitaction: %d", *rr->esr->waitAction); + yaz_log(YLOG_LOG, "packagename: %s", rr->esr->packageName); + yaz_log(YLOG_LOG, "Waitaction: %d", *rr->esr->waitAction); if (!rr->esr->taskSpecificParameters) { - yaz_log (LOG_WARN, "No task specific parameters"); + yaz_log (YLOG_WARN, "No task specific parameters"); } else if (rr->esr->taskSpecificParameters->which == Z_External_ESAdmin) { @@ -487,53 +487,53 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) else if (rr->esr->taskSpecificParameters->which == Z_External_update) { Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update; - yaz_log (LOG_LOG, "Received DB Update"); + yaz_log (YLOG_LOG, "Received DB Update"); if (up->which == Z_IUUpdate_esRequest) { Z_IUUpdateEsRequest *esRequest = up->u.esRequest; Z_IUOriginPartToKeep *toKeep = esRequest->toKeep; Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep; - yaz_log (LOG_LOG, "action"); + yaz_log (YLOG_LOG, "action"); if (toKeep->action) { switch (*toKeep->action) { case Z_IUOriginPartToKeep_recordInsert: - yaz_log (LOG_LOG, "recordInsert"); + yaz_log (YLOG_LOG, "recordInsert"); break; case Z_IUOriginPartToKeep_recordReplace: - yaz_log (LOG_LOG, "recordUpdate"); + yaz_log (YLOG_LOG, "recordUpdate"); break; case Z_IUOriginPartToKeep_recordDelete: - yaz_log (LOG_LOG, "recordDelete"); + yaz_log (YLOG_LOG, "recordDelete"); break; case Z_IUOriginPartToKeep_elementUpdate: - yaz_log (LOG_LOG, "elementUpdate"); + yaz_log (YLOG_LOG, "elementUpdate"); break; case Z_IUOriginPartToKeep_specialUpdate: - yaz_log (LOG_LOG, "specialUpdate"); + yaz_log (YLOG_LOG, "specialUpdate"); break; case Z_ESAdminOriginPartToKeep_shutdown: - yaz_log (LOG_LOG, "shutDown"); + yaz_log (YLOG_LOG, "shutDown"); break; case Z_ESAdminOriginPartToKeep_start: - yaz_log (LOG_LOG, "start"); + yaz_log (YLOG_LOG, "start"); break; default: - yaz_log (LOG_LOG, " unknown (%d)", *toKeep->action); + yaz_log (YLOG_LOG, " unknown (%d)", *toKeep->action); } } if (toKeep->databaseName) { - yaz_log (LOG_LOG, "database: %s", toKeep->databaseName); + yaz_log (YLOG_LOG, "database: %s", toKeep->databaseName); if (zebra_select_database(zh, toKeep->databaseName)) return 0; } else { - yaz_log (LOG_WARN, "no database supplied for ES Update"); + yaz_log (YLOG_WARN, "no database supplied for ES Update"); rr->errcode = 1008; rr->errstring = "database"; return 0; @@ -565,28 +565,28 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) { oident = oid_getentbyoid(rec->direct_reference); if (oident) - yaz_log (LOG_LOG, "record %d type %s", i, + yaz_log (YLOG_LOG, "record %d type %s", i, oident->desc); } switch (rec->which) { case Z_External_sutrs: if (rec->u.octet_aligned->len > 170) - yaz_log (LOG_LOG, "%d bytes:\n%.168s ...", + yaz_log (YLOG_LOG, "%d bytes:\n%.168s ...", rec->u.sutrs->len, rec->u.sutrs->buf); else - yaz_log (LOG_LOG, "%d bytes:\n%s", + yaz_log (YLOG_LOG, "%d bytes:\n%s", rec->u.sutrs->len, rec->u.sutrs->buf); break; case Z_External_octet: if (rec->u.octet_aligned->len > 170) - yaz_log (LOG_LOG, "%d bytes:\n%.168s ...", + yaz_log (YLOG_LOG, "%d bytes:\n%.168s ...", rec->u.octet_aligned->len, rec->u.octet_aligned->buf); else - yaz_log (LOG_LOG, "%d bytes\n%s", + yaz_log (YLOG_LOG, "%d bytes\n%s", rec->u.octet_aligned->len, rec->u.octet_aligned->buf); } @@ -697,7 +697,7 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) } else { - yaz_log (LOG_WARN, "Unknown Extended Service(%d)", + yaz_log (YLOG_WARN, "Unknown Extended Service(%d)", rr->esr->taskSpecificParameters->which); rr->errcode = 221; @@ -712,7 +712,7 @@ static void bend_start (struct statserv_options_block *sob) sob->handle = zebra_start(sob->configname); if (!sob->handle) { - yaz_log (LOG_FATAL, "Failed to read config `%s'", sob->configname); + yaz_log (YLOG_FATAL, "Failed to read config `%s'", sob->configname); exit (1); } #ifdef WIN32 @@ -731,13 +731,13 @@ static void bend_start (struct statserv_options_block *sob) { if (errno != EEXIST) { - yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname); + yaz_log(YLOG_FATAL|YLOG_ERRNO, "lock file %s", pidfname); exit(1); } fd = open(pidfname, O_RDWR, 0666); if (fd == -1) { - yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname); + yaz_log(YLOG_FATAL|YLOG_ERRNO, "lock file %s", pidfname); exit(1); } } @@ -746,7 +746,7 @@ static void bend_start (struct statserv_options_block *sob) area.l_len = area.l_start = 0L; if (fcntl (fd, F_SETLK, &area) == -1) { - yaz_log(LOG_ERRNO|LOG_FATAL, "Zebra server already running"); + yaz_log(YLOG_ERRNO|YLOG_FATAL, "Zebra server already running"); exit(1); } else diff --git a/index/zsets.c b/index/zsets.c index 78b69d6..cbdc8b1 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -1,4 +1,4 @@ -/* $Id: zsets.c,v 1.70 2004-11-15 22:44:33 adam Exp $ +/* $Id: zsets.c,v 1.71 2004-11-19 10:27:09 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -201,7 +201,7 @@ ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov) break; if (s) { - yaz_log(LOG_DEBUG, "updating result set %s", name); + yaz_log(YLOG_DEBUG, "updating result set %s", name); if (!ov || s->locked) return NULL; if (s->rset) @@ -215,7 +215,7 @@ ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov) { const char *sort_max_str = zebra_get_resource(zh, "sortmax", "1000"); - yaz_log(LOG_DEBUG, "adding result set %s", name); + yaz_log(YLOG_DEBUG, "adding result set %s", name); s = (ZebraSet) xmalloc (sizeof(*s)); s->next = zh->sets; zh->sets = s; @@ -257,7 +257,7 @@ ZebraSet resultSetGet (ZebraHandle zh, const char *name) if (!s->term_entries && !s->rset && s->rpn) { NMEM nmem = nmem_create (); - yaz_log(LOG_LOG, "research %s", name); + yaz_log(YLOG_LOG, "research %s", name); if (!s->rset_nmem) s->rset_nmem=nmem_create(); s->rset = @@ -382,7 +382,7 @@ ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name, position = positions[i]; if (position > 0 && position <= sort_info->num_entries) { - yaz_log(LOG_DEBUG, "got pos=%d (sorted)", position); + yaz_log(YLOG_DEBUG, "got pos=%d (sorted)", position); sr[i].sysno = sort_info->entries[position-1]->sysno; sr[i].score = sort_info->entries[position-1]->score; } @@ -427,7 +427,7 @@ ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name, if (position == positions[num_i]) { sr[num_i].sysno = psysno; - yaz_log(LOG_DEBUG, "got pos=%d (unsorted)", position); + yaz_log(YLOG_DEBUG, "got pos=%d (unsorted)", position); sr[num_i].score = -1; num_i++; } @@ -591,7 +591,7 @@ void resultSetSort (ZebraHandle zh, NMEM nmem, zh->errCode = 230; return; } - yaz_log(LOG_DEBUG, "result set sort input=%s output=%s", + yaz_log(YLOG_DEBUG, "result set sort input=%s output=%s", *input_setnames, output_setname); sset = resultSetGet (zh, input_setnames[0]); if (!sset) @@ -670,20 +670,20 @@ void resultSetSortSingle (ZebraHandle zh, NMEM nmem, switch (sk->which) { case Z_SortKey_sortField: - yaz_log(LOG_DEBUG, "Sort: key %d is of type sortField", i+1); + yaz_log(YLOG_DEBUG, "Sort: key %d is of type sortField", i+1); zh->errCode = 207; return; case Z_SortKey_elementSpec: - yaz_log(LOG_DEBUG, "Sort: key %d is of type elementSpec", i+1); + yaz_log(YLOG_DEBUG, "Sort: key %d is of type elementSpec", i+1); zh->errCode = 207; return; case Z_SortKey_sortAttributes: - yaz_log(LOG_DEBUG, "Sort: key %d is of type sortAttributes", i+1); + yaz_log(YLOG_DEBUG, "Sort: key %d is of type sortAttributes", i+1); sort_criteria[i].attrUse = zebra_maps_sort (zh->reg->zebra_maps, sk->u.sortAttributes, &sort_criteria[i].numerical); - yaz_log(LOG_DEBUG, "use value = %d", sort_criteria[i].attrUse); + yaz_log(YLOG_DEBUG, "use value = %d", sort_criteria[i].attrUse); if (sort_criteria[i].attrUse == -1) { zh->errCode = 116; @@ -712,10 +712,10 @@ void resultSetSortSingle (ZebraHandle zh, NMEM nmem, } } rset_close (rfd); - yaz_log(LOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, sort", + yaz_log(YLOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, sort", kno, sset->hits); for (i = 0; i < numTerms; i++) - yaz_log(LOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT, + yaz_log(YLOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT, terms[i]->name, terms[i]->flags, rset_count(terms[i]->rset)); *sort_status = Z_SortResponse_success; } @@ -760,7 +760,7 @@ void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset, NMEM nmem) rank_class = zebraRankLookup (zh, rank_handler_name); if (!rank_class) { - yaz_log(LOG_WARN, "No such rank handler: %s", rank_handler_name); + yaz_log(YLOG_WARN, "No such rank handler: %s", rank_handler_name); return; } rc = rank_class->control; @@ -797,7 +797,7 @@ void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset, NMEM nmem) if (tot>0) { ratio = cur/tot; est = (zint)(0.5+zebraSet->hits/ratio); - logf(LOG_LOG, "Estimating hits (%s) " + yaz_log(YLOG_LOG, "Estimating hits (%s) " "%0.1f->" ZINT_FORMAT "; %0.1f->" ZINT_FORMAT, rset->control->desc, @@ -821,11 +821,11 @@ void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset, NMEM nmem) } rset_close (rfd); - yaz_log(LOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, rank", + yaz_log(YLOG_DEBUG, ZINT_FORMAT " keys, " ZINT_FORMAT " sysnos, rank", kno, zebraSet->hits); for (i = 0; i < numTerms; i++) { - yaz_log(LOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT, + yaz_log(YLOG_LOG, "term=\"%s\" type=%s count=" ZINT_FORMAT, terms[i]->name, terms[i]->flags, rset_count(terms[i]->rset)); } } diff --git a/isamb/isamb.c b/isamb/isamb.c index 500c10d..d1722e0 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,4 +1,4 @@ -/* $Id: isamb.c,v 1.58 2004-09-09 10:08:05 heikki Exp $ +/* $Id: isamb.c,v 1.59 2004-11-19 10:27:09 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -22,7 +22,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include @@ -221,17 +221,17 @@ ISAMB isamb_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method, const char *src = 0; if (memcmp(hbuf, "isamb", 5)) { - logf(LOG_WARN, "bad isamb header for file %s", fname); + yaz_log(YLOG_WARN, "bad isamb header for file %s", fname); return 0; } if (sscanf(hbuf+5, "%d %d %d", &major, &minor, &len) != 3) { - logf(LOG_WARN, "bad isamb header for file %s", fname); + yaz_log(YLOG_WARN, "bad isamb header for file %s", fname); return 0; } if (major != ISAMB_MAJOR_VERSION) { - logf(LOG_WARN, "bad major version for file %s %d, must be %d", + yaz_log(YLOG_WARN, "bad major version for file %s %d, must be %d", fname, major, ISAMB_MAJOR_VERSION); return 0; } @@ -240,7 +240,7 @@ ISAMB isamb_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method, pos++; if (!bf_read (isamb->file[i].bf, pos, 0, 0, hbuf + pos*b_size)) { - logf(LOG_WARN, "truncated isamb header for " + yaz_log(YLOG_WARN, "truncated isamb header for " "file=%s len=%d pos=%d", fname, len, pos); return 0; @@ -261,7 +261,7 @@ ISAMB isamb_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method, b_size = b_size * 4; } #if ISAMB_DEBUG - logf(LOG_WARN, "isamb debug enabled. Things will be slower than usual"); + yaz_log(YLOG_WARN, "isamb debug enabled. Things will be slower than usual"); #endif return isamb; } @@ -360,10 +360,10 @@ void isamb_close (ISAMB isamb) { int i; for (i=0;isamb->accessed_nodes[i];i++) - logf(LOG_DEBUG,"isamb_close level leaf-%d: "ZINT_FORMAT" read, " + yaz_log(YLOG_DEBUG,"isamb_close level leaf-%d: "ZINT_FORMAT" read, " ZINT_FORMAT" skipped", i, isamb->accessed_nodes[i], isamb->skipped_nodes[i]); - logf(LOG_DEBUG,"isamb_close returned "ZINT_FORMAT" values, " + yaz_log(YLOG_DEBUG,"isamb_close returned "ZINT_FORMAT" values, " "skipped "ZINT_FORMAT, isamb->skipped_numbers, isamb->returned_numbers); for (i = 0; ino_cat; i++) @@ -435,7 +435,7 @@ static struct ISAMB_block *open_block (ISAMB b, ISAMC_P pos) yaz_log (b->log_io, "bf_read: open_block"); if (!bf_read (b->file[cat].bf, pos/CAT_MAX, 0, 0, p->buf)) { - yaz_log (LOG_FATAL, "isamb: read fail for pos=%ld block=%ld", + yaz_log (YLOG_FATAL, "isamb: read fail for pos=%ld block=%ld", (long) pos, (long) pos/CAT_MAX); abort(); } @@ -445,7 +445,7 @@ static struct ISAMB_block *open_block (ISAMB b, ISAMC_P pos) p->size = (p->buf[1] + 256 * p->buf[2]) - offset; if (p->size < 0) { - yaz_log (LOG_FATAL, "Bad block size %d in pos=" ZINT_FORMAT "\n", + yaz_log (YLOG_FATAL, "Bad block size %d in pos=" ZINT_FORMAT "\n", p->size, pos); } assert (p->size >= 0); @@ -481,7 +481,7 @@ struct ISAMB_block *new_block (ISAMB b, int leaf, int cat) yaz_log (b->log_io, "bf_read: new_block"); if (!bf_read (b->file[cat].bf, p->pos/CAT_MAX, 0, 0, p->buf)) { - yaz_log (LOG_FATAL, "isamb: read fail for pos=%ld block=%ld", + yaz_log (YLOG_FATAL, "isamb: read fail for pos=%ld block=%ld", (long) p->pos/CAT_MAX, (long) p->pos/CAT_MAX); abort (); } @@ -796,7 +796,7 @@ int insert_leaf (ISAMB b, struct ISAMB_block **sp1, void *lookahead_item, /* if this is not an insertion, it's really bad .. */ if (!*lookahead_mode) { - yaz_log (LOG_WARN, "isamb: Inconsistent register (1)"); + yaz_log (YLOG_WARN, "isamb: Inconsistent register (1)"); assert (*lookahead_mode); } } @@ -912,7 +912,7 @@ int insert_leaf (ISAMB b, struct ISAMB_block **sp1, void *lookahead_item, if (!*lookahead_mode) { /* this is append. So a delete is bad */ - yaz_log (LOG_WARN, "isamb: Inconsistent register (2)"); + yaz_log (YLOG_WARN, "isamb: Inconsistent register (2)"); abort(); } else if (!half1 && dst > tail_cut) @@ -1176,12 +1176,12 @@ void isamb_pp_close_x (ISAMB_PP pp, int *size, int *blocks) int i; if (!pp) return; - logf(LOG_DEBUG,"isamb_pp_close lev=%d returned "ZINT_FORMAT" values," + yaz_log(YLOG_DEBUG,"isamb_pp_close lev=%d returned "ZINT_FORMAT" values," "skipped "ZINT_FORMAT, pp->maxlevel, pp->skipped_numbers, pp->returned_numbers); for (i=pp->maxlevel;i>=0;i--) if ( pp->skipped_nodes[i] || pp->accessed_nodes[i]) - logf(LOG_DEBUG,"isamb_pp_close level leaf-%d: " + yaz_log(YLOG_DEBUG,"isamb_pp_close level leaf-%d: " ZINT_FORMAT" read, "ZINT_FORMAT" skipped", i, pp->accessed_nodes[i], pp->skipped_nodes[i]); pp->isamb->skipped_numbers += pp->skipped_numbers; @@ -1235,7 +1235,7 @@ static void isamb_dump_r (ISAMB b, ISAMB_P pos, void (*pr)(const char *str), const char *src = p->bytes + p->offset; char *dst = buf; (*b->method->codec.decode)(p->decodeClientData, &dst, &src); - (*b->method->log_item)(LOG_DEBUG, buf, prefix_str); + (*b->method->log_item)(YLOG_DEBUG, buf, prefix_str); p->offset = src - (char*) p->bytes; } assert(p->offset == p->size); @@ -1254,7 +1254,7 @@ static void isamb_dump_r (ISAMB b, ISAMB_P pos, void (*pr)(const char *str), while (p->offset < p->size) { decode_ptr (&src, &item_len); - (*b->method->log_item)(LOG_DEBUG, src, prefix_str); + (*b->method->log_item)(YLOG_DEBUG, src, prefix_str); src += item_len; decode_ptr (&src, &sub); @@ -1289,7 +1289,7 @@ static int isamb_pp_on_right_node(ISAMB_PP pp, int level, const void *untilbuf) assert(level>=0); if ( level == 0) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_on_right returning true for root"); + yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning true for root"); #endif return 1; /* we can never skip the root node */ } @@ -1302,20 +1302,20 @@ static int isamb_pp_on_right_node(ISAMB_PP pp, int level, const void *untilbuf) src=p->bytes + p->offset; decode_ptr(&src, &item_len); #if ISAMB_DEBUG - (*pp->isamb->method->codec.log_item)(LOG_DEBUG,untilbuf,"on_leaf: until"); - (*pp->isamb->method->codec.log_item)(LOG_DEBUG,src,"on_leaf: value"); + (*pp->isamb->method->codec.log_item)(YLOG_DEBUG,untilbuf,"on_leaf: until"); + (*pp->isamb->method->codec.log_item)(YLOG_DEBUG,src,"on_leaf: value"); #endif cmp=(*pp->isamb->method->compare_item)(untilbuf,src); if (cmpscope) { /* cmp<2 */ #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_on_right returning true " + yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning true " "cmp=%d lev=%d ofs=%d",cmp,level,p->offset); #endif return 1; } else { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_on_right returning false " + yaz_log(YLOG_DEBUG,"isamb_pp_on_right returning false " "cmp=%d lev=%d ofs=%d",cmp,level,p->offset); #endif return 0; @@ -1323,7 +1323,7 @@ static int isamb_pp_on_right_node(ISAMB_PP pp, int level, const void *untilbuf) } else { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_on_right at tail, looking higher " + yaz_log(YLOG_DEBUG,"isamb_pp_on_right at tail, looking higher " "lev=%d",level); #endif return isamb_pp_on_right_node(pp, level, untilbuf); @@ -1339,7 +1339,7 @@ static int isamb_pp_read_on_leaf(ISAMB_PP pp, void *buf) assert(buf); if (p->offset == p->size) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_read_on_leaf returning 0 on node %d",p->pos); + yaz_log(YLOG_DEBUG,"isamb_pp_read_on_leaf returning 0 on node %d",p->pos); #endif return 0; /* at end of leaf */ } @@ -1348,7 +1348,7 @@ static int isamb_pp_read_on_leaf(ISAMB_PP pp, void *buf) (*pp->isamb->method->codec.decode)(p->decodeClientData,&dst, &src); p->offset = src - (char*) p->bytes; #if ISAMB_DEBUG - (*pp->isamb->method->codec.log_item)(LOG_DEBUG, buf, "read_on_leaf returning 1"); + (*pp->isamb->method->codec.log_item)(YLOG_DEBUG, buf, "read_on_leaf returning 1"); #endif pp->returned_numbers++; return 1; @@ -1366,7 +1366,7 @@ static int isamb_pp_forward_on_leaf(ISAMB_PP pp, void *buf, const void *untilbuf if (cmp scope){ /* cmp<2 found a good one */ #if ISAMB_DEBUG if (skips) - logf(LOG_DEBUG, "isam_pp_fwd_on_leaf skipped %d items",skips); + yaz_log(YLOG_DEBUG, "isam_pp_fwd_on_leaf skipped %d items",skips); #endif pp->returned_numbers++; return 1; @@ -1386,7 +1386,7 @@ static int isamb_pp_climb_level(ISAMB_PP pp, ISAMB_P *pos) const char *src; zint item_len; #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_climb_level starting " + yaz_log(YLOG_DEBUG,"isamb_pp_climb_level starting " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1395,7 +1395,7 @@ static int isamb_pp_climb_level(ISAMB_PP pp, ISAMB_P *pos) if (pp->level==0) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_climb_level returning 0 at root"); + yaz_log(YLOG_DEBUG,"isamb_pp_climb_level returning 0 at root"); #endif return 0; } @@ -1405,7 +1405,7 @@ static int isamb_pp_climb_level(ISAMB_PP pp, ISAMB_P *pos) (pp->level)--; p=pp->block[pp->level]; #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_climb_level climbed to level %d node %d ofs=%d", + yaz_log(YLOG_DEBUG,"isamb_pp_climb_level climbed to level %d node %d ofs=%d", pp->level, p->pos, p->offset); #endif assert(!p->leaf); @@ -1420,7 +1420,7 @@ static int isamb_pp_climb_level(ISAMB_PP pp, ISAMB_P *pos) { /* skip the child we just came from */ #if ISAMB_DEBUG - logf(LOG_DEBUG,"isam_pp_climb_level: skipping lev=%d ofs=%d sz=%d", + yaz_log(YLOG_DEBUG,"isam_pp_climb_level: skipping lev=%d ofs=%d sz=%d", pp->level, p->offset, p->size); #endif assert (p->offset < p->size ); @@ -1450,7 +1450,7 @@ static zint isamb_pp_forward_unode(ISAMB_PP pp, zint pos, const void *untilbuf) zint nxtpos; #if ISAMB_DEBUG int skips=0; - logf(LOG_DEBUG,"isamb_pp_forward_unode starting " + yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode starting " "at level %d node %d ofs=%di sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1458,7 +1458,7 @@ static zint isamb_pp_forward_unode(ISAMB_PP pp, zint pos, const void *untilbuf) assert(p->offset <= p->size); if (p->offset == p->size) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward_unode returning at end " + yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning at end " "at level %d node %d ofs=%di sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1472,7 +1472,7 @@ static zint isamb_pp_forward_unode(ISAMB_PP pp, zint pos, const void *untilbuf) if (cmpscope) /* cmp<2 */ { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward_unode returning a hit " + yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning a hit " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1486,7 +1486,7 @@ static zint isamb_pp_forward_unode(ISAMB_PP pp, zint pos, const void *untilbuf) #endif } #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward_unode returning at tail " + yaz_log(YLOG_DEBUG,"isamb_pp_forward_unode returning at tail " "at level %d node %d ofs=%d sz=%d skips=%d", pp->level, p->pos, p->offset, p->size, skips); #endif @@ -1500,7 +1500,7 @@ static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAMB_P pos, const void *until const char *src; assert(!p->leaf); #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_descend_to_leaf " + yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf " "starting at lev %d node %d ofs=%d lf=%d u=%p", pp->level, p->pos, p->offset, p->leaf, untilbuf); #endif @@ -1513,7 +1513,7 @@ static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAMB_P pos, const void *until ++(pp->accessed_nodes[pp->maxlevel-pp->level]); ++(pp->no_blocks); #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_descend_to_leaf " + yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf " "got lev %d node %d lf=%d", pp->level, p->pos, p->leaf); #endif @@ -1525,7 +1525,7 @@ static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAMB_P pos, const void *until p->offset=src-(char*)p->bytes; isamb_pp_descend_to_leaf(pp,pos,untilbuf); #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_descend_to_leaf " + yaz_log(YLOG_DEBUG,"isamb_pp_descend_to_leaf " "returning at lev %d node %d ofs=%d lf=%d", pp->level, p->pos, p->offset, p->leaf); #endif @@ -1545,7 +1545,7 @@ static int isamb_pp_climb_desc(ISAMB_PP pp, const void *untilbuf) ISAMB_P pos; #if ISAMB_DEBUG struct ISAMB_block *p = pp->block[pp->level]; - logf(LOG_DEBUG,"isamb_pp_climb_desc starting " + yaz_log(YLOG_DEBUG,"isamb_pp_climb_desc starting " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1558,7 +1558,7 @@ static int isamb_pp_climb_desc(ISAMB_PP pp, const void *untilbuf) isamb_pp_descend_to_leaf(pp, pos,untilbuf); #if ISAMB_DEBUG p = pp->block[pp->level]; - logf(LOG_DEBUG,"isamb_pp_climb_desc done " + yaz_log(YLOG_DEBUG,"isamb_pp_climb_desc done " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1570,14 +1570,14 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf) #if ISAMB_DEBUG struct ISAMB_block *p = pp->block[pp->level]; assert(p->leaf); - logf(LOG_DEBUG,"isamb_pp_forward starting " + yaz_log(YLOG_DEBUG,"isamb_pp_forward starting " "at level %d node %d ofs=%d sz=%d u=%p sc=%d", pp->level, p->pos, p->offset, p->size,untilbuf, scope); #endif if (untilbuf) { if (isamb_pp_forward_on_leaf( pp, buf, untilbuf)) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward (f) returning (A) " + yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning (A) " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1585,7 +1585,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf) } if (! isamb_pp_climb_desc( pp, untilbuf)) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward (f) returning notfound (B) " + yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning notfound (B) " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1594,7 +1594,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf) do{ if (isamb_pp_forward_on_leaf( pp, buf, untilbuf)) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward (f) returning (C) " + yaz_log(YLOG_DEBUG,"isamb_pp_forward (f) returning (C) " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1610,7 +1610,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf) * interface as the old fwd */ if (isamb_pp_read_on_leaf( pp, buf)) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward (read) returning (D) " + yaz_log(YLOG_DEBUG,"isamb_pp_forward (read) returning (D) " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1618,7 +1618,7 @@ int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf) } if (isamb_pp_find_next_leaf(pp)) { #if ISAMB_DEBUG - logf(LOG_DEBUG,"isamb_pp_forward (read) returning (E) " + yaz_log(YLOG_DEBUG,"isamb_pp_forward (read) returning (E) " "at level %d node %d ofs=%d sz=%d", pp->level, p->pos, p->offset, p->size); #endif @@ -1640,7 +1640,7 @@ void isamb_pp_pos( ISAMB_PP pp, double *current, double *total ) *total = pp->block[0]->no_items; *current = (double) pp->returned_numbers; #if ISAMB_DEBUG - logf(LOG_LOG, "isamb_pp_pos returning: cur= %0.1f tot=%0.1f rn=" + yaz_log(YLOG_LOG, "isamb_pp_pos returning: cur= %0.1f tot=%0.1f rn=" ZINT_FORMAT, *current, *total, pp->returned_numbers); #endif } diff --git a/isamb/tstisamb.c b/isamb/tstisamb.c index e3eebbb..5a0d3ec 100644 --- a/isamb/tstisamb.c +++ b/isamb/tstisamb.c @@ -1,4 +1,4 @@ -/* $Id: tstisamb.c,v 1.10 2004-09-09 10:08:06 heikki Exp $ +/* $Id: tstisamb.c,v 1.11 2004-11-19 10:27:09 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -22,7 +22,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include @@ -30,12 +30,12 @@ static void log_item(int level, const void *b, const char *txt) { int x; memcpy(&x, b, sizeof(int)); - yaz_log(LOG_DEBUG, "%s %d", txt, x); + yaz_log(YLOG_DEBUG, "%s %d", txt, x); } static void log_pr(const char *txt) { - yaz_log(LOG_DEBUG, "%s", txt); + yaz_log(YLOG_DEBUG, "%s", txt); } int compare_item(const void *a, const void *b) @@ -118,7 +118,7 @@ void tst_forward(ISAMB isb, int n) isamb_pp_forward(pp, &x, &xu); if (x != xu && xu != x+1) { - yaz_log(LOG_WARN, "isamb_pp_forward (1). Got %d (expected %d)", + yaz_log(YLOG_WARN, "isamb_pp_forward (1). Got %d (expected %d)", x, xu); exit(4); } @@ -134,7 +134,7 @@ void tst_forward(ISAMB isb, int n) isamb_pp_forward(pp, &x, &xu); if (x != xu && xu != x+1) { - yaz_log(LOG_WARN, "isamb_pp_forward (2). Got %d (expected %d)", + yaz_log(YLOG_WARN, "isamb_pp_forward (2). Got %d (expected %d)", x, xu); exit(4); } @@ -174,7 +174,7 @@ void tst_insert(ISAMB isb, int n) memcpy (&x, key_buf, sizeof(int)); if (x != ri.no) { - yaz_log(LOG_WARN, "isamb_pp_read. Got %d (expected %d)", + yaz_log(YLOG_WARN, "isamb_pp_read. Got %d (expected %d)", x, ri.no); exit(3); } @@ -182,7 +182,7 @@ void tst_insert(ISAMB isb, int n) } if (ri.no != ri.max) { - yaz_log(LOG_WARN, "ri.max != ri.max (%d != %d)", ri.no, ri.max); + yaz_log(YLOG_WARN, "ri.max != ri.max (%d != %d)", ri.no, ri.max); exit(3); } isamb_pp_close(pp); @@ -213,7 +213,7 @@ void tst_insert(ISAMB isb, int n) if (isamc_p) { - yaz_log(LOG_WARN, "isamb_merge did not return empty list"); + yaz_log(YLOG_WARN, "isamb_merge did not return empty list"); exit(3); } } @@ -225,7 +225,7 @@ int main(int argc, char **argv) ISAMC_M method; if (argc == 2) - yaz_log_init_level(LOG_ALL); + yaz_log_init_level(YLOG_ALL); /* setup method (attributes) */ method.compare_item = compare_item; @@ -240,7 +240,7 @@ int main(int argc, char **argv) bfs = bfs_create(0, 0); if (!bfs) { - yaz_log(LOG_WARN, "bfs_create failed"); + yaz_log(YLOG_WARN, "bfs_create failed"); exit(1); } @@ -250,7 +250,7 @@ int main(int argc, char **argv) isb = isamb_open (bfs, "isamb", 1, &method, 0); if (!isb) { - yaz_log(LOG_WARN, "isamb_open failed"); + yaz_log(YLOG_WARN, "isamb_open failed"); exit(2); } tst_insert(isb, 1); diff --git a/isamc/isamc.c b/isamc/isamc.c index d15ba1e..534037f 100644 --- a/isamc/isamc.c +++ b/isamc/isamc.c @@ -1,4 +1,4 @@ -/* $Id: isamc.c,v 1.26 2004-08-06 12:28:23 adam Exp $ +/* $Id: isamc.c,v 1.27 2004-11-19 10:27:09 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -29,7 +29,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include "isamc-p.h" static void flush_block (ISAMC is, int cat); @@ -88,11 +88,11 @@ ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method) /* determine number of block categories */ if (is->method->debug) - logf (LOG_LOG, "isc: bsize ifill mfill mblocks"); + yaz_log (YLOG_LOG, "isc: bsize ifill mfill mblocks"); do { if (is->method->debug) - logf (LOG_LOG, "isc:%6d %6d %6d %6d", + yaz_log (YLOG_LOG, "isc:%6d %6d %6d %6d", filecat[i].bsize, filecat[i].ifill, filecat[i].mfill, filecat[i].mblocks); if (max_buf_size < filecat[i].mblocks * filecat[i].bsize) @@ -105,7 +105,7 @@ ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method) if (max_buf_size < (1+is->method->max_blocks_mem) * filecat[i].bsize) max_buf_size = (1+is->method->max_blocks_mem) * filecat[i].bsize; if (is->method->debug) - logf (LOG_LOG, "isc: max_buf_size %d", max_buf_size); + yaz_log (YLOG_LOG, "isc: max_buf_size %d", max_buf_size); assert (is->no_files > 0); is->files = (ISAMC_file) xmalloc (sizeof(*is->files)*is->no_files); @@ -174,9 +174,9 @@ int isc_close (ISAMC is) if (is->method->debug) { - logf (LOG_LOG, "isc: next forw mid-f prev backw mid-b"); + yaz_log (YLOG_LOG, "isc: next forw mid-f prev backw mid-b"); for (i = 0; ino_files; i++) - logf (LOG_LOG, "isc:%8d%8d%8.1f%8d%8d%8.1f", + yaz_log (YLOG_LOG, "isc:%8d%8d%8.1f%8d%8d%8.1f", is->files[i].no_next, is->files[i].no_forward, is->files[i].no_forward ? @@ -189,7 +189,7 @@ int isc_close (ISAMC is) : 0.0); } if (is->method->debug) - logf (LOG_LOG, "isc: writes reads skipped alloc released remap"); + yaz_log (YLOG_LOG, "isc: writes reads skipped alloc released remap"); for (i = 0; ino_files; i++) { release_fc (is, i); @@ -198,7 +198,7 @@ int isc_close (ISAMC is) bf_write (is->files[i].bf, 0, 0, sizeof(ISAMC_head), &is->files[i].head); if (is->method->debug) - logf (LOG_LOG, "isc:%8d%8d%8d%8d%8d%8d", + yaz_log (YLOG_LOG, "isc:%8d%8d%8d%8d%8d%8d", is->files[i].no_writes, is->files[i].no_reads, is->files[i].no_skip_writes, @@ -226,7 +226,7 @@ int isc_write_block (ISAMC is, int cat, zint pos, char *src) { ++(is->files[cat].no_writes); if (is->method->debug > 2) - logf (LOG_LOG, "isc: write_block %d " ZINT_FORMAT, cat, pos); + yaz_log (YLOG_LOG, "isc: write_block %d " ZINT_FORMAT, cat, pos); return bf_write (is->files[cat].bf, pos, 0, 0, src); } @@ -235,7 +235,7 @@ int isc_write_dblock (ISAMC is, int cat, zint pos, char *src, { ISAMC_BLOCK_SIZE size = offset + ISAMC_BLOCK_OFFSET_N; if (is->method->debug > 2) - logf (LOG_LOG, "isc: write_dblock. size=%d nextpos=" ZINT_FORMAT, + yaz_log (YLOG_LOG, "isc: write_dblock. size=%d nextpos=" ZINT_FORMAT, (int) size, nextpos); src -= ISAMC_BLOCK_OFFSET_N; memcpy (src, &nextpos, sizeof(nextpos)); @@ -394,14 +394,14 @@ zint isc_alloc_block (ISAMC is, int cat) if (!block) block = alloc_block (is, cat); if (is->method->debug > 3) - logf (LOG_LOG, "isc: alloc_block in cat %d: " ZINT_FORMAT, cat, block); + yaz_log (YLOG_LOG, "isc: alloc_block in cat %d: " ZINT_FORMAT, cat, block); return block; } void isc_release_block (ISAMC is, int cat, zint pos) { if (is->method->debug > 3) - logf (LOG_LOG, "isc: release_block in cat %d:" ZINT_FORMAT, cat, pos); + yaz_log (YLOG_LOG, "isc: release_block in cat %d:" ZINT_FORMAT, cat, pos); if (is->files[cat].fc_list) { int j; @@ -478,14 +478,14 @@ ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P ipos) src += sizeof(pp->numKeys); if (pp->next == pp->pos) { - yaz_log(LOG_FATAL|LOG_LOG, "pp->next = " ZINT_FORMAT, pp->next); - yaz_log(LOG_FATAL|LOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos); + yaz_log(YLOG_FATAL|YLOG_LOG, "pp->next = " ZINT_FORMAT, pp->next); + yaz_log(YLOG_FATAL|YLOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos); assert (pp->next != pp->pos); } pp->offset = src - pp->buf; assert (pp->offset == ISAMC_BLOCK_OFFSET_1); if (is->method->debug > 2) - logf (LOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next=" + yaz_log (YLOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next=" ZINT_FORMAT, pp->size, pp->cat, pp->pos, pp->next); } return pp; @@ -549,8 +549,8 @@ int isc_read_item (ISAMC_PP pp, char **dst) if (pp->next == pp->pos) { - yaz_log(LOG_FATAL|LOG_LOG, "pp->next = " ZINT_FORMAT, pp->next); - yaz_log(LOG_FATAL|LOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos); + yaz_log(YLOG_FATAL|YLOG_LOG, "pp->next = " ZINT_FORMAT, pp->next); + yaz_log(YLOG_FATAL|YLOG_LOG, "pp->pos = " ZINT_FORMAT, pp->pos); assert (pp->next != pp->pos); } @@ -559,7 +559,7 @@ int isc_read_item (ISAMC_PP pp, char **dst) (*is->method->codec.decode)(pp->decodeClientData, dst, &src); pp->offset = src - pp->buf; if (is->method->debug > 2) - logf (LOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next=" + yaz_log (YLOG_LOG, "isc: read_block size=%d %d " ZINT_FORMAT " next=" ZINT_FORMAT, pp->size, pp->cat, pp->pos, pp->next); return 2; } diff --git a/isamc/merge.c b/isamc/merge.c index c816766..e8d9247 100644 --- a/isamc/merge.c +++ b/isamc/merge.c @@ -1,4 +1,4 @@ -/* $Id: merge.c,v 1.26 2004-08-06 12:55:02 adam Exp $ +/* $Id: merge.c,v 1.27 2004-11-19 10:27:09 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include -#include +#include #include "isamc-p.h" struct isc_merge_block { @@ -103,7 +103,7 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, if (!*firstpos) *firstpos = mb[i].block; if (is->method->debug > 2) - logf (LOG_LOG, "isc: skip ptr=%d size=%d %d " ZINT_FORMAT, + yaz_log (YLOG_LOG, "isc: skip ptr=%d size=%d %d " ZINT_FORMAT, i, ssize, cat, mb[i].block); ++(is->files[cat].no_skip_writes); continue; @@ -118,7 +118,7 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, memcpy (src+sizeof(zint)+sizeof(ssize), numkeys, sizeof(*numkeys)); if (is->method->debug > 2) - logf (LOG_LOG, "isc: flush ptr=%d numk=" ZINT_FORMAT " size=%d nextpos=" + yaz_log (YLOG_LOG, "isc: flush ptr=%d numk=" ZINT_FORMAT " size=%d nextpos=" ZINT_FORMAT, i, *numkeys, (int) ssize, mb[i+1].block); } else @@ -126,7 +126,7 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, src = r_buf + mb[i].offset - ISAMC_BLOCK_OFFSET_N; ssize += ISAMC_BLOCK_OFFSET_N; if (is->method->debug > 2) - logf (LOG_LOG, "isc: flush ptr=%d size=%d nextpos=" ZINT_FORMAT, + yaz_log (YLOG_LOG, "isc: flush ptr=%d size=%d nextpos=" ZINT_FORMAT, i, (int) ssize, mb[i+1].block); } memcpy (src, &mb[i+1].block, sizeof(zint)); @@ -187,7 +187,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) cat = pp->cat; if (debug > 1) - logf (LOG_LOG, "isc: isc_merge begin %d " ZINT_FORMAT, cat, pp->pos); + yaz_log (YLOG_LOG, "isc: isc_merge begin %d " ZINT_FORMAT, cat, pp->pos); /* read first item from i */ i_item_ptr = i_item; @@ -218,7 +218,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) the original (if any) */ if (debug > 3) - logf (LOG_LOG, "isc: release A"); + yaz_log (YLOG_LOG, "isc: release A"); if (mb[ptr].block) isc_release_block (is, pp->cat, mb[ptr].block); mb[ptr].block = pp->pos; @@ -234,7 +234,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) mb[ptr].dirty = last_dirty; mb[ptr].offset = r_offset; if (debug > 3) - logf (LOG_LOG, "isc: bound ptr=%d,offset=%d", + yaz_log (YLOG_LOG, "isc: bound ptr=%d,offset=%d", ptr, r_offset); if (cat==is->max_cat && ptr >= is->method->max_blocks_mem) { @@ -242,7 +242,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) except 1 will be flushed. */ if (debug > 2) - logf (LOG_LOG, "isc: flush A %d sections", ptr); + yaz_log (YLOG_LOG, "isc: flush A %d sections", ptr); flush_blocks (is, mb, ptr-1, r_buf, &firstpos, cat, 0, &pp->numKeys); mb[0].block = mb[ptr-1].block; @@ -319,7 +319,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) { if (!i_mode) /* delete item which isn't there? */ { - logf (LOG_FATAL, "Inconsistent register at offset %d", + yaz_log (YLOG_FATAL, "Inconsistent register at offset %d", r_offset); abort (); } @@ -345,7 +345,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (border < new_offset && border >= r_offset) { if (debug > 2) - logf (LOG_LOG, "isc: border %d " ZINT_FORMAT, + yaz_log (YLOG_LOG, "isc: border %d " ZINT_FORMAT, ptr, border); /* Max size of current block category reached ... make new virtual block entry */ @@ -359,7 +359,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) surely not the last one(s). */ if (debug > 2) - logf (LOG_LOG, "isc: flush B %d sections", ptr-1); + yaz_log (YLOG_LOG, "isc: flush B %d sections", ptr-1); flush_blocks (is, mb, ptr-1, r_buf, &firstpos, cat, 0, &pp->numKeys); mb[0].block = mb[ptr-1].block; @@ -406,23 +406,23 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) int border = is->method->filecat[cat].ifill - ISAMC_BLOCK_OFFSET_1 + mb[j].offset; if (debug > 3) - logf (LOG_LOG, "isc: remap %d border=%d", i, border); + yaz_log (YLOG_LOG, "isc: remap %d border=%d", i, border); if (mb[i+1].offset > border && mb[i].offset <= border) { if (debug > 3) - logf (LOG_LOG, "isc: to %d %d", j, mb[i].offset); + yaz_log (YLOG_LOG, "isc: to %d %d", j, mb[i].offset); mb[++j].dirty = 1; mb[j].block = 0; mb[j].offset = mb[i].offset; } } if (debug > 2) - logf (LOG_LOG, "isc: remap from %d to %d sections to cat %d", + yaz_log (YLOG_LOG, "isc: remap from %d to %d sections to cat %d", ptr, j, cat); ptr = j; border = get_border (is, mb, ptr, cat, firstpos); if (debug > 3) - logf (LOG_LOG, "isc: border=" ZINT_FORMAT " r_offset=%d", + yaz_log (YLOG_LOG, "isc: border=" ZINT_FORMAT " r_offset=%d", border, r_offset); } } @@ -437,7 +437,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (cat == pp->cat && mb[ptr].block) { if (debug > 3) - logf (LOG_LOG, "isc: release C"); + yaz_log (YLOG_LOG, "isc: release C"); isc_release_block (is, pp->cat, mb[ptr].block); mb[ptr].block = 0; if (ptr > 0) @@ -446,7 +446,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) } if (debug > 2) - logf (LOG_LOG, "isc: flush C, %d sections", ptr); + yaz_log (YLOG_LOG, "isc: flush C, %d sections", ptr); if (firstpos) { @@ -455,7 +455,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (numKeys != isc_pp_num (pp)) { if (debug > 2) - logf (LOG_LOG, "isc: patch num keys firstpos=" ZINT_FORMAT " num=" ZINT_FORMAT, + yaz_log (YLOG_LOG, "isc: patch num keys firstpos=" ZINT_FORMAT " num=" ZINT_FORMAT, firstpos, numKeys); bf_write (is->files[cat].bf, firstpos, ISAMC_BLOCK_OFFSET_N, sizeof(numKeys), &numKeys); @@ -474,7 +474,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (!firstpos) cat = 0; if (debug > 1) - logf (LOG_LOG, "isc: isc_merge return %d " ZINT_FORMAT, cat, firstpos); + yaz_log (YLOG_LOG, "isc: isc_merge return %d " ZINT_FORMAT, cat, firstpos); isc_pp_close (pp); return cat + firstpos * 8; } diff --git a/isamg/isamg.c b/isamg/isamg.c index 987930f..87166d9 100644 --- a/isamg/isamg.c +++ b/isamg/isamg.c @@ -1,4 +1,4 @@ -/* $Id: isamg.c,v 1.3 2003-04-02 19:01:47 adam Exp $ +/* $Id: isamg.c,v 1.4 2004-11-19 10:27:10 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -118,7 +118,7 @@ ISAMG isamg_open (BFiles bfs, int writeflag, char *isam_type_name, Res res){ writeflag, key_isamd_m (res,&isamd_m) } else { - logf (LOG_FATAL, "isamg: Unknown isam type: %s", isam_type_name); + yaz_log (YLOG_FATAL, "isamg: Unknown isam type: %s", isam_type_name); exit(1); } } /* open */ @@ -148,7 +148,10 @@ int isamg_close (ISAMG is){ /* * $Log: isamg.c,v $ - * Revision 1.3 2003-04-02 19:01:47 adam + * Revision 1.4 2004-11-19 10:27:10 heikki + * Using the new ylog.h everywhere, and fixing what that breaks! + * + * Revision 1.3 2003/04/02 19:01:47 adam * Remove // comment * * Revision 1.2 2002/08/02 19:26:56 adam diff --git a/isams/isams.c b/isams/isams.c index 5e4bbce..01817b2 100644 --- a/isams/isams.c +++ b/isams/isams.c @@ -1,4 +1,4 @@ -/* $Id: isams.c,v 1.7 2004-08-06 13:36:23 adam Exp $ +/* $Id: isams.c,v 1.8 2004-11-19 10:27:11 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -26,7 +26,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include typedef struct { @@ -126,7 +126,7 @@ ISAMS_P isams_merge (ISAMS is, ISAMS_I data) if (is->head.last_offset > is->block_size) { if (is->debug > 2) - logf (LOG_LOG, "first_block=%d", first_block); + yaz_log (YLOG_LOG, "first_block=%d", first_block); bf_write(is->bf, is->head.last_block, 0, 0, is->merge_buf); (is->head.last_block)++; is->head.last_offset -= is->block_size; @@ -188,7 +188,7 @@ ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos) ISAMS_PP pp = (ISAMS_PP) xmalloc (sizeof(*pp)); if (is->debug > 1) - logf (LOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos); + yaz_log (YLOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos); pp->is = is; pp->decodeClientData = (*is->method->codec.start)(); pp->numKeys = 0; @@ -197,7 +197,7 @@ ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos) pp->block_no = (int) (pos/is->block_size); pp->block_offset = (int) (pos - pp->block_no * is->block_size); if (is->debug) - logf (LOG_LOG, "isams: isams_pp_open off=%d no=%d", + yaz_log (YLOG_LOG, "isams: isams_pp_open off=%d no=%d", pp->block_offset, pp->block_no); if (pos) { @@ -205,7 +205,7 @@ ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos) bf_read (is->bf, pp->block_no+1, 0, 0, pp->buf + is->block_size); memcpy(&pp->numKeys, pp->buf + pp->block_offset, sizeof(int)); if (is->debug) - logf (LOG_LOG, "isams: isams_pp_open numKeys=%d", pp->numKeys); + yaz_log (YLOG_LOG, "isams: isams_pp_open numKeys=%d", pp->numKeys); pp->block_offset += sizeof(int); } return pp; diff --git a/perl/zebra_perl.c b/perl/zebra_perl.c index 4d133aa..147d2ac 100644 --- a/perl/zebra_perl.c +++ b/perl/zebra_perl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -17,17 +17,17 @@ NMEM handles; void init (void) { nmem_init (); yaz_log_init_prefix ("ZebraPerl"); - yaz_log (LOG_LOG, "Zebra API initialized"); + yaz_log (YLOG_LOG, "Zebra API initialized"); } void DESTROY (void) { nmem_exit (); - yaz_log (LOG_LOG, "Zebra API destroyed"); + yaz_log (YLOG_LOG, "Zebra API destroyed"); } /* Logging facilities from yaz */ void logMsg (int level, const char *message) { - logf(level, "%s", message); + yaz_log(level, "%s", message); } /* debug tool for data1... maybe should be moved to data1. @@ -119,7 +119,7 @@ void records_retrieve(ZebraHandle zh, } else { schema = oid_getvalbyname (a_schema); if (schema == VAL_NONE) { - logf(LOG_WARN,"unknown schema '%s'",a_schema); + yaz_log(YLOG_WARN,"unknown schema '%s'",a_schema); } } @@ -129,7 +129,7 @@ void records_retrieve(ZebraHandle zh, } else { recordsyntax = oid_getvalbyname (a_format); if (recordsyntax == VAL_NONE) { - logf(LOG_WARN,"unknown record syntax '%s', using SUTRS",a_schema); + yaz_log(YLOG_WARN,"unknown record syntax '%s', using SUTRS",a_schema); recordsyntax = VAL_SUTRS; } } @@ -209,7 +209,7 @@ int zebra_cql2pqf (cql_transform_t ct, if (cql_transform_buf(ct, cql_parser_result(cp), res, len)) { status = cql_transform_error(ct, &addinfo); - logf (LOG_WARN,"Transform error %d %s\n", status, addinfo ? addinfo : ""); + yaz_log (YLOG_WARN,"Transform error %d %s\n", status, addinfo ? addinfo : ""); cql_parser_destroy(cp); return (status); } @@ -230,18 +230,18 @@ void zebra_scan_PQF (ZebraHandle zh, ZebraScanEntry *entries; int i, class; - logf(LOG_DEBUG, + yaz_log(YLOG_DEBUG, "scan req: pos:%d, num:%d, partial:%d", so->position, so->num_entries, so->is_partial); zapt = p_query_scan (stream, PROTO_Z3950, &attrsetid, pqf_query); oidname = yaz_z3950oid_to_str (attrsetid, &class); - logf (LOG_DEBUG, "Attributreset: %s", oidname); + yaz_log (YLOG_DEBUG, "Attributreset: %s", oidname); attributeset = oid_getvalbyname(oidname); if (!zapt) { - logf (LOG_WARN, "bad query %s\n", pqf_query); + yaz_log (YLOG_WARN, "bad query %s\n", pqf_query); odr_reset (stream); return; } @@ -254,7 +254,7 @@ void zebra_scan_PQF (ZebraHandle zh, &so->position, &so->num_entries, (ZebraScanEntry **) &so->entries, &so->is_partial); - logf(LOG_DEBUG, + yaz_log(YLOG_DEBUG, "scan res: pos:%d, num:%d, partial:%d", so->position, so->num_entries, so->is_partial); } diff --git a/recctrl/danbibr.c b/recctrl/danbibr.c index b79b4f3..f7478ba 100644 --- a/recctrl/danbibr.c +++ b/recctrl/danbibr.c @@ -1,4 +1,4 @@ -/* $Id: danbibr.c,v 1.6 2004-09-28 10:15:03 adam Exp $ +/* $Id: danbibr.c,v 1.7 2004-11-19 10:27:12 heikki Exp $ Copyright (C) 2004 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include diff --git a/recctrl/marcread.c b/recctrl/marcread.c index 96c9eea..a0fdcac 100644 --- a/recctrl/marcread.c +++ b/recctrl/marcread.c @@ -1,4 +1,4 @@ -/* $Id: marcread.c,v 1.26 2004-09-28 10:15:03 adam Exp $ +/* $Id: marcread.c,v 1.27 2004-11-19 10:27:12 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,7 +24,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include #include #include @@ -63,14 +63,14 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) record_length = atoi_n (buf, 5); if (record_length < 25) { - logf (LOG_WARN, "MARC record length < 25, is %d", record_length); + yaz_log (YLOG_WARN, "MARC record length < 25, is %d", record_length); return NULL; } /* read remaining part - attempt to read one byte furhter... */ read_bytes = (*p->readf)(p->fh, buf+5, record_length-4); if (read_bytes < record_length-5) { - logf (LOG_WARN, "Couldn't read whole MARC record"); + yaz_log (YLOG_WARN, "Couldn't read whole MARC record"); return NULL; } if (read_bytes == record_length - 4) @@ -85,7 +85,7 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) res_root = data1_mk_root (p->dh, p->mem, absynName); if (!res_root) { - yaz_log (LOG_WARN, "cannot read MARC without an abstract syntax"); + yaz_log (YLOG_WARN, "cannot read MARC without an abstract syntax"); return 0; } if (marc_xml) @@ -376,7 +376,7 @@ static inline_subfield *cat_inline_subfield(mc_subfield *psf, WRBUF buf, wrbuf_puts(buf, " "); } #if MARCOMP_DEBUG - logf(LOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name); + yaz_log(YLOG_LOG, "cat_inline_subfield(): add subfield $%s", found->name); #endif pisf = found->next; } @@ -440,7 +440,7 @@ static void cat_inline_field(mc_field *pf, WRBUF buf, data1_node *subfield) int i; if ((i=inline_parse(pif, psubf->u.tag.tag, get_data(psubf, &len)))<0) { - logf(LOG_WARN, "inline subfield ($%s): parse error", + yaz_log(YLOG_WARN, "inline subfield ($%s): parse error", psubf->u.tag.tag); inline_destroy_field(pif); return; @@ -482,14 +482,14 @@ static void cat_inline_field(mc_field *pf, WRBUF buf, data1_node *subfield) } else { - logf(LOG_WARN, "In-line field %s missed -- indicators do not match", pif->name); + yaz_log(YLOG_WARN, "In-line field %s missed -- indicators do not match", pif->name); } } } inline_destroy_field(pif); } #if MARCOMP_DEBUG - logf(LOG_LOG, "cat_inline_field(): got buffer {%s}", buf); + yaz_log(YLOG_LOG, "cat_inline_field(): got buffer {%s}", buf); #endif } @@ -534,7 +534,7 @@ static data1_node *cat_subfield(mc_subfield *psf, WRBUF buf, wrbuf_puts(buf, " "); } #if MARCOMP_DEBUG - logf(LOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag); + yaz_log(YLOG_LOG, "cat_subfield(): add subfield $%s", found->u.tag.tag); #endif subfield = found->next; } @@ -610,7 +610,7 @@ static data1_node *cat_field(struct grs_read_info *p, mc_field *pf, wrbuf_puts(buf, ""); } #if MARCOMP_DEBUG - logf(LOG_LOG, "cat_field(): got buffer {%s}", buf); + yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf); #endif return field->next; } @@ -628,7 +628,7 @@ static data1_node *cat_field(struct grs_read_info *p, mc_field *pf, )) { #if MARCOMP_DEBUG - logf(LOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag); + yaz_log(YLOG_WARN, "Field %s missed -- does not match indicators", field->u.tag.tag); #endif return field->next; } @@ -641,7 +641,7 @@ static data1_node *cat_field(struct grs_read_info *p, mc_field *pf, cat_subfield(pf->list, buf, subfield); #if MARCOMP_DEBUG - logf(LOG_LOG, "cat_field(): got buffer {%s}", buf); + yaz_log(YLOG_LOG, "cat_field(): got buffer {%s}", buf); #endif return field->next; @@ -683,13 +683,13 @@ static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt, } buf = wrbuf_alloc(); #if MARCOMP_DEBUG - logf(LOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt); + yaz_log(YLOG_LOG, "parse_data1_tree(): statement -{%s}", mc_stmnt); #endif if (!yaz_matchstr(pf->name, "ldr")) { data1_node *new; #if MARCOMP_DEBUG - logf(LOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions", + yaz_log(YLOG_LOG,"parse_data1_tree(): try LEADER from {%d} to {%d} positions", pf->interval.start, pf->interval.end); #endif new = data1_mk_tag_n(p->dh, p->mem, mc_stmnt, strlen(mc_stmnt), 0, top); @@ -707,7 +707,7 @@ static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt, data1_node *new; char *pb; #if MARCOMP_DEBUG - logf(LOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag); + yaz_log(YLOG_LOG, "parse_data1_tree(): try field {%s}", field->u.tag.tag); #endif wrbuf_rewind(buf); wrbuf_puts(buf, ""); diff --git a/recctrl/recctrl.c b/recctrl/recctrl.c index 9415233..c4dbdbc 100644 --- a/recctrl/recctrl.c +++ b/recctrl/recctrl.c @@ -1,4 +1,4 @@ -/* $Id: recctrl.c,v 1.12 2004-09-30 08:30:05 adam Exp $ +/* $Id: recctrl.c,v 1.13 2004-11-19 10:27:12 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -98,7 +98,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) if (module_path) { DIR *dir = opendir(module_path); - yaz_log(LOG_LOG, "searching filters in %s", module_path); + yaz_log(YLOG_LOG, "searching filters in %s", module_path); if (dir) { struct dirent *de; @@ -118,20 +118,20 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) mod_p = dlopen(fname, RTLD_NOW|RTLD_GLOBAL); if (mod_p && (fl = dlsym(mod_p, "idzebra_filter"))) { - yaz_log(LOG_LOG, "Loaded filter module %s", fname); + yaz_log(YLOG_LOG, "Loaded filter module %s", fname); recTypeClass_add(&rts, fl, nmem, mod_p); } else if (mod_p) { const char *err = dlerror(); - yaz_log(LOG_WARN, "dlsym failed %s %s", + yaz_log(YLOG_WARN, "dlsym failed %s %s", fname, err ? err : "none"); dlclose(mod_p); } else { const char *err = dlerror(); - yaz_log(LOG_WARN, "dlopen failed %s %s", + yaz_log(YLOG_WARN, "dlopen failed %s %s", fname, err ? err : "none"); } @@ -154,7 +154,7 @@ static void recTypeClass_add (struct recTypeClass **rts, RecType *rt, r->next = *rts; *rts = r; - yaz_log(LOG_LOG, "Adding filter %s", (*rt)->name); + yaz_log(YLOG_LOG, "Adding filter %s", (*rt)->name); r->module_handle = module_handle; module_handle = 0; /* so that we only store module_handle once */ r->recType = *rt; diff --git a/recctrl/recgrs.c b/recctrl/recgrs.c index 3fe7f21..41b873c 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -1,4 +1,4 @@ -/* $Id: recgrs.c,v 1.92 2004-10-12 18:21:35 quinn Exp $ +/* $Id: recgrs.c,v 1.93 2004-11-19 10:27:12 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -28,7 +28,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #endif -#include +#include #include #include @@ -180,26 +180,26 @@ int d1_check_xpath_predicate(data1_node *n, struct xpath_predicate *p) if (p->which == XPATH_PREDICATE_RELATION) { if (p->u.relation.name[0]) { if (*p->u.relation.name != '@') { - yaz_log(LOG_WARN, + yaz_log(YLOG_WARN, " Only attributes (@) are supported in xelm xpath predicates"); - yaz_log(LOG_WARN, "predicate %s ignored", p->u.relation.name); + yaz_log(YLOG_WARN, "predicate %s ignored", p->u.relation.name); return (1); } attname = p->u.relation.name + 1; res = 0; /* looking for the attribute with a specified name */ for (attr = n->u.tag.attributes; attr; attr = attr->next) { - yaz_log(LOG_DEBUG," - attribute %s <-> %s", attname, attr->name ); + yaz_log(YLOG_DEBUG," - attribute %s <-> %s", attname, attr->name ); if (!strcmp(attr->name, attname)) { if (p->u.relation.op[0]) { if (*p->u.relation.op != '=') { - yaz_log(LOG_WARN, + yaz_log(YLOG_WARN, "Only '=' relation is supported (%s)",p->u.relation.op); - yaz_log(LOG_WARN, "predicate %s ignored", p->u.relation.name); + yaz_log(YLOG_WARN, "predicate %s ignored", p->u.relation.name); res = 1; break; } else { - yaz_log(LOG_DEBUG," - value %s <-> %s", + yaz_log(YLOG_DEBUG," - value %s <-> %s", p->u.relation.value, attr->value ); if (!strcmp(attr->value, p->u.relation.value)) { res = 1; break; @@ -211,7 +211,7 @@ int d1_check_xpath_predicate(data1_node *n, struct xpath_predicate *p) } } } - yaz_log(LOG_DEBUG, "return %d", res); + yaz_log(YLOG_DEBUG, "return %d", res); return res; } else { return 1; @@ -226,7 +226,7 @@ int d1_check_xpath_predicate(data1_node *n, struct xpath_predicate *p) return (d1_check_xpath_predicate(n, p->u.boolean.left) || d1_check_xpath_predicate(n, p->u.boolean.right)); } else { - yaz_log(LOG_WARN, "Unknown boolean relation %s, ignored",p->u.boolean.op); + yaz_log(YLOG_WARN, "Unknown boolean relation %s, ignored",p->u.boolean.op); return 1; } } @@ -265,7 +265,7 @@ data1_termlist *xpath_termlist_by_tagpath(char *tagpath, data1_node *n) int ok = 0; sprintf (pexpr, "%s\n", tagpath); - yaz_log(LOG_DEBUG,"Checking tagpath %s",tagpath); + yaz_log(YLOG_DEBUG,"Checking tagpath %s",tagpath); while (xpe) { struct DFA_state **dfaar = xpe->dfa->states; @@ -293,9 +293,9 @@ data1_termlist *xpath_termlist_by_tagpath(char *tagpath, data1_node *n) } while (i >= 0); } if (ok) - yaz_log(LOG_DEBUG," xpath match %s",xpe->xpath_expr); + yaz_log(YLOG_DEBUG," xpath match %s",xpe->xpath_expr); else - yaz_log(LOG_DEBUG," xpath no match %s",xpe->xpath_expr); + yaz_log(YLOG_DEBUG," xpath no match %s",xpe->xpath_expr); pexpr--; if (ok) { @@ -312,11 +312,11 @@ data1_termlist *xpath_termlist_by_tagpath(char *tagpath, data1_node *n) backwards trough xpath location steps ... */ for (i=xpe->xpath_len - 1; i>0; i--) { - yaz_log(LOG_DEBUG,"Checking step %d: %s on tag %s", + yaz_log(YLOG_DEBUG,"Checking step %d: %s on tag %s", i,xp[i].part,nn->u.tag.tag); if (!d1_check_xpath_predicate(nn, xp[i].predicate)) { - yaz_log(LOG_DEBUG," Predicates didn't match"); + yaz_log(YLOG_DEBUG," Predicates didn't match"); ok = 0; break; } @@ -336,7 +336,7 @@ data1_termlist *xpath_termlist_by_tagpath(char *tagpath, data1_node *n) xfree(pexpr); if (ok) { - yaz_log(LOG_DEBUG,"Got it"); + yaz_log(YLOG_DEBUG,"Got it"); return xpe->termlists; } else { return NULL; @@ -400,7 +400,7 @@ static void index_xpath (data1_node *n, struct recExtractCtrl *p, data1_termlist *tl; int xpdone = 0; - yaz_log(LOG_DEBUG, "index_xpath level=%d use=%d", level, use); + yaz_log(YLOG_DEBUG, "index_xpath level=%d use=%d", level, use); if ((!n->root->u.root.absyn) || (n->root->u.root.absyn->enable_xpath_indexing)) { termlist_only = 0; @@ -914,10 +914,10 @@ static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c) if (!(eset = data1_getesetbyname(dh, n->u.root.absyn, c->u.simple->u.generic))) { - yaz_log(LOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic); + yaz_log(YLOG_LOG, "Unknown esetname '%s'", c->u.simple->u.generic); return 25; /* invalid esetname */ } - yaz_log(LOG_DEBUG, "Esetname '%s' in simple compspec", + yaz_log(YLOG_DEBUG, "Esetname '%s' in simple compspec", c->u.simple->u.generic); espec = eset->spec; break; @@ -934,23 +934,23 @@ static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c) data1_getesetbyname(dh, n->u.root.absyn, p->u.elementSetName))) { - yaz_log(LOG_LOG, "Unknown esetname '%s'", + yaz_log(YLOG_LOG, "Unknown esetname '%s'", p->u.elementSetName); return 25; /* invalid esetname */ } - yaz_log(LOG_DEBUG, "Esetname '%s' in complex compspec", + yaz_log(YLOG_DEBUG, "Esetname '%s' in complex compspec", p->u.elementSetName); espec = eset->spec; break; case Z_ElementSpec_externalSpec: if (p->u.externalSpec->which == Z_External_espec1) { - yaz_log(LOG_DEBUG, "Got Espec-1"); + yaz_log(YLOG_DEBUG, "Got Espec-1"); espec = p->u.externalSpec-> u.espec1; } else { - yaz_log(LOG_LOG, "Unknown external espec."); + yaz_log(YLOG_LOG, "Unknown external espec."); return 25; /* bad. what is proper diagnostic? */ } break; @@ -962,12 +962,12 @@ static int process_comp(data1_handle dh, data1_node *n, Z_RecordComposition *c) } if (espec) { - yaz_log(LOG_DEBUG, "Element: Espec-1 match"); + yaz_log(YLOG_DEBUG, "Element: Espec-1 match"); return data1_doespec1(dh, n, espec); } else { - yaz_log(LOG_DEBUG, "Element: all match"); + yaz_log(YLOG_DEBUG, "Element: all match"); return -1; } } @@ -1046,7 +1046,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, gri.dh = p->dh; gri.clientData = clientData; - yaz_log(LOG_DEBUG, "grs_retrieve"); + yaz_log(YLOG_DEBUG, "grs_retrieve"); node = (*grs_read)(&gri); if (!node) { @@ -1064,7 +1064,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, #endif top = data1_get_root_tag (p->dh, node); - yaz_log(LOG_DEBUG, "grs_retrieve: size"); + yaz_log(YLOG_DEBUG, "grs_retrieve: size"); tagname = data1_systag_lookup(node->u.root.absyn, "size", "size"); if (tagname && (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem))) @@ -1079,7 +1079,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, if (tagname && p->score >= 0 && (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem))) { - yaz_log(LOG_DEBUG, "grs_retrieve: %s", tagname); + yaz_log(YLOG_DEBUG, "grs_retrieve: %s", tagname); dnew->u.data.what = DATA1I_num; dnew->u.data.data = dnew->lbuf; sprintf(dnew->u.data.data, "%d", p->score); @@ -1091,7 +1091,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, if (tagname && p->localno > 0 && (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem))) { - yaz_log(LOG_DEBUG, "grs_retrieve: %s", tagname); + yaz_log(YLOG_DEBUG, "grs_retrieve: %s", tagname); dnew->u.data.what = DATA1I_text; dnew->u.data.data = dnew->lbuf; @@ -1130,7 +1130,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, */ if (requested_schema != VAL_NONE) { - yaz_log(LOG_DEBUG, "grs_retrieve: schema mapping"); + yaz_log(YLOG_DEBUG, "grs_retrieve: schema mapping"); for (map = node->u.root.absyn->maptabs; map; map = map->next) { if (map->target_absyn_ref == requested_schema) @@ -1158,7 +1158,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, * the overlap of schema and formatting which is inherent in the MARC * family) */ - yaz_log(LOG_DEBUG, "grs_retrieve: syntax mapping"); + yaz_log(YLOG_DEBUG, "grs_retrieve: syntax mapping"); if (node->u.root.absyn) for (map = node->u.root.absyn->maptabs; map; map = map->next) { @@ -1174,7 +1174,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, break; } } - yaz_log(LOG_DEBUG, "grs_retrieve: schemaIdentifier"); + yaz_log(YLOG_DEBUG, "grs_retrieve: schemaIdentifier"); if (node->u.root.absyn && node->u.root.absyn->reference != VAL_NONE && p->input_format == VAL_GRS1) @@ -1212,7 +1212,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, } } - yaz_log(LOG_DEBUG, "grs_retrieve: element spec"); + yaz_log(YLOG_DEBUG, "grs_retrieve: element spec"); if (p->comp && (res = process_comp(p->dh, node, p->comp)) > 0) { p->diagnostic = res; @@ -1228,7 +1228,7 @@ int zebra_grs_retrieve(void *clientData, struct recRetrieveCtrl *p, #if 0 data1_pr_tree (p->dh, node, stdout); #endif - yaz_log(LOG_DEBUG, "grs_retrieve: transfer syntax mapping"); + yaz_log(YLOG_DEBUG, "grs_retrieve: transfer syntax mapping"); switch (p->output_format = (p->input_format != VAL_NONE ? p->input_format : VAL_SUTRS)) { diff --git a/recctrl/rectext.c b/recctrl/rectext.c index aac5eec..c666816 100644 --- a/recctrl/rectext.c +++ b/recctrl/rectext.c @@ -1,4 +1,4 @@ -/* $Id: rectext.c,v 1.21 2004-09-28 10:15:03 adam Exp $ +/* $Id: rectext.c,v 1.22 2004-11-19 10:27:13 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -105,7 +105,7 @@ static int text_extract (void *clientData, struct recExtractCtrl *p) struct buf_info *fi = buf_open (p); #if 0 - yaz_log(LOG_LOG, "text_extract off=%ld", + yaz_log(YLOG_LOG, "text_extract off=%ld", (long) (*fi->p->tellf)(fi->p->fh)); #endif xfree(tinfo->sep); diff --git a/recctrl/regxread.c b/recctrl/regxread.c index 04d621e..f6f74c8 100644 --- a/recctrl/regxread.c +++ b/recctrl/regxread.c @@ -1,4 +1,4 @@ -/* $Id: regxread.c,v 1.54 2004-09-28 10:15:03 adam Exp $ +/* $Id: regxread.c,v 1.55 2004-11-19 10:27:13 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -412,7 +412,7 @@ static int readParseToken (const char **cpp, int *len) cmd[i] = '\0'; if (i == 0) { - logf (LOG_WARN, "bad character %d %c", *cp, *cp); + yaz_log (YLOG_WARN, "bad character %d %c", *cp, *cp); cp++; while (*cp && *cp != ' ' && *cp != '\t' && *cp != '\n' && *cp != '\r') @@ -433,7 +433,7 @@ static int readParseToken (const char **cpp, int *len) return REGX_INIT; else { - logf (LOG_WARN, "bad command %s", cmd); + yaz_log (YLOG_WARN, "bad command %s", cmd); return 0; } } @@ -471,7 +471,7 @@ static int actionListMk (struct lexSpec *spec, const char *s, { xfree (*ap); *ap = NULL; - logf (LOG_WARN, "regular expression error '%.*s'", s-s0, s0); + yaz_log (YLOG_WARN, "regular expression error '%.*s'", s-s0, s0); return -1; } if (debug_dfa_tran) @@ -480,10 +480,10 @@ static int actionListMk (struct lexSpec *spec, const char *s, s++; break; case REGX_BEGIN: - logf (LOG_WARN, "cannot use BEGIN here"); + yaz_log (YLOG_WARN, "cannot use BEGIN here"); continue; case REGX_INIT: - logf (LOG_WARN, "cannot use INIT here"); + yaz_log (YLOG_WARN, "cannot use INIT here"); continue; case REGX_END: *ap = (struct lexRuleAction *) xmalloc (sizeof(**ap)); @@ -509,7 +509,7 @@ int readOneSpec (struct lexSpec *spec, const char *s) tok = readParseToken (&s, &len); if (tok != REGX_CODE) { - logf (LOG_WARN, "missing name after CONTEXT keyword"); + yaz_log (YLOG_WARN, "missing name after CONTEXT keyword"); return 0; } if (len > 31) @@ -540,17 +540,17 @@ int readOneSpec (struct lexSpec *spec, const char *s) break; case REGX_PATTERN: #if REGX_DEBUG - logf (LOG_LOG, "rule %d %s", spec->context->ruleNo, s); + yaz_log (YLOG_LOG, "rule %d %s", spec->context->ruleNo, s); #endif r = dfa_parse (spec->context->dfa, &s); if (r) { - logf (LOG_WARN, "regular expression error. r=%d", r); + yaz_log (YLOG_WARN, "regular expression error. r=%d", r); return -1; } if (*s != '/') { - logf (LOG_WARN, "expects / at end of pattern. got %c", *s); + yaz_log (YLOG_WARN, "expects / at end of pattern. got %c", *s); return -1; } s++; @@ -585,13 +585,13 @@ int readFileSpec (struct lexSpec *spec) } if (!spec_inf) { - logf (LOG_ERRNO|LOG_WARN, "cannot read spec file %s", spec->name); + yaz_log (YLOG_ERRNO|YLOG_WARN, "cannot read spec file %s", spec->name); return -1; } - logf (LOG_LOG, "reading regx filter %s", fname); + yaz_log (YLOG_LOG, "reading regx filter %s", fname); #if HAVE_TCL_H if (spec->tcl_interp) - logf (LOG_LOG, "Tcl enabled"); + yaz_log (YLOG_LOG, "Tcl enabled"); #endif #if 0 @@ -675,16 +675,16 @@ static void execData (struct lexSpec *spec, return ; #if REGX_DEBUG if (elen > 80) - logf (LOG_LOG, "data(%d bytes) %.40s ... %.*s", elen, + yaz_log (YLOG_LOG, "data(%d bytes) %.40s ... %.*s", elen, ebuf, 40, ebuf + elen-40); else if (elen == 1 && ebuf[0] == '\n') { - logf (LOG_LOG, "data(new line)"); + yaz_log (YLOG_LOG, "data(new line)"); } else if (elen > 0) - logf (LOG_LOG, "data(%d bytes) %.*s", elen, elen, ebuf); + yaz_log (YLOG_LOG, "data(%d bytes) %.*s", elen, elen, ebuf); else - logf (LOG_LOG, "data(%d bytes)", elen); + yaz_log (YLOG_LOG, "data(%d bytes)", elen); #endif if (spec->d1_level <= 1) @@ -803,7 +803,7 @@ static void variantBegin (struct lexSpec *spec, if (spec->d1_level == 0) { - logf (LOG_WARN, "in variant begin. No record type defined"); + yaz_log (YLOG_WARN, "in variant begin. No record type defined"); return ; } if (class_len >= DATA1_MAX_SYMBOL) @@ -817,7 +817,7 @@ static void variantBegin (struct lexSpec *spec, ttype[type_len] = '\0'; #if REGX_DEBUG - logf (LOG_LOG, "variant begin(%s,%s,%d)", tclass, ttype, + yaz_log (YLOG_LOG, "variant begin(%s,%s,%d)", tclass, ttype, spec->d1_level); #endif @@ -842,7 +842,7 @@ static void variantBegin (struct lexSpec *spec, } #if REGX_DEBUG - logf (LOG_LOG, "variant node(%d)", spec->d1_level); + yaz_log (YLOG_LOG, "variant node(%d)", spec->d1_level); #endif parent = spec->d1_stack[spec->d1_level-1]; res = data1_mk_node2 (spec->dh, spec->m, DATA1N_variant, parent); @@ -879,7 +879,7 @@ static void tagBegin (struct lexSpec *spec, { if (spec->d1_level == 0) { - logf (LOG_WARN, "in element begin. No record type defined"); + yaz_log (YLOG_WARN, "in element begin. No record type defined"); return ; } tagStrip (&tag, &len); @@ -887,7 +887,7 @@ static void tagBegin (struct lexSpec *spec, tagDataRelease (spec); #if REGX_DEBUG - logf (LOG_LOG, "begin tag(%.*s, %d)", len, tag, spec->d1_level); + yaz_log (YLOG_LOG, "begin tag(%.*s, %d)", len, tag, spec->d1_level); #endif spec->d1_stack[spec->d1_level] = data1_mk_tag_n ( @@ -913,7 +913,7 @@ static void tagEnd (struct lexSpec *spec, int min_level, break; } #if REGX_DEBUG - logf (LOG_LOG, "end tag(%d)", spec->d1_level); + yaz_log (YLOG_LOG, "end tag(%d)", spec->d1_level); #endif } @@ -1085,7 +1085,7 @@ static int cmd_tcl_begin (ClientData clientData, Tcl_Interp *interp, data1_node *res; #if REGX_DEBUG - logf (LOG_LOG, "begin record %s", absynName); + yaz_log (YLOG_LOG, "begin record %s", absynName); #endif res = data1_mk_root (spec->dh, spec->m, absynName); @@ -1113,7 +1113,7 @@ static int cmd_tcl_begin (ClientData clientData, Tcl_Interp *interp, { struct lexContext *lc = spec->context; #if REGX_DEBUG - logf (LOG_LOG, "begin context %s",argv[2]); + yaz_log (YLOG_LOG, "begin context %s",argv[2]); #endif while (lc && strcmp (argv[2], lc->name)) lc = lc->next; @@ -1122,7 +1122,7 @@ static int cmd_tcl_begin (ClientData clientData, Tcl_Interp *interp, spec->context_stack[++(spec->context_stack_top)] = lc; } else - logf (LOG_WARN, "unknown context %s", argv[2]); + yaz_log (YLOG_WARN, "unknown context %s", argv[2]); } else return TCL_ERROR; @@ -1144,7 +1144,7 @@ static int cmd_tcl_end (ClientData clientData, Tcl_Interp *interp, (spec->d1_level)--; } #if REGX_DEBUG - logf (LOG_LOG, "end record"); + yaz_log (YLOG_LOG, "end record"); #endif spec->stop_flag = 1; } @@ -1165,7 +1165,7 @@ static int cmd_tcl_end (ClientData clientData, Tcl_Interp *interp, if (spec->d1_level <= 1) { #if REGX_DEBUG - logf (LOG_LOG, "end element end records"); + yaz_log (YLOG_LOG, "end element end records"); #endif spec->stop_flag = 1; } @@ -1173,7 +1173,7 @@ static int cmd_tcl_end (ClientData clientData, Tcl_Interp *interp, else if (!strcmp (argv[1], "context")) { #if REGX_DEBUG - logf (LOG_LOG, "end context"); + yaz_log (YLOG_LOG, "end context"); #endif if (spec->context_stack_top) (spec->context_stack_top)--; @@ -1295,7 +1295,7 @@ static void execTcl (struct lexSpec *spec, struct regxCode *code) if (ret != TCL_OK) { const char *err = Tcl_GetVar(spec->tcl_interp, "errorInfo", 0); - logf(LOG_FATAL, "Tcl error, line=%d, \"%s\"\n%s", + yaz_log(YLOG_FATAL, "Tcl error, line=%d, \"%s\"\n%s", spec->tcl_interp->errorLine, spec->tcl_interp->result, err ? err : "[NO ERRORINFO]"); @@ -1326,7 +1326,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) r = execTok (spec, &s, &cmd_str, &cmd_len); if (r < 2) { - logf (LOG_WARN, "missing keyword after 'begin'"); + yaz_log (YLOG_WARN, "missing keyword after 'begin'"); continue; } p = regxStrz (cmd_str, cmd_len, ptmp); @@ -1345,7 +1345,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) memcpy (absynName, cmd_str, cmd_len); absynName[cmd_len] = '\0'; #if REGX_DEBUG - logf (LOG_LOG, "begin record %s", absynName); + yaz_log (YLOG_LOG, "begin record %s", absynName); #endif res = data1_mk_root (spec->dh, spec->m, absynName); @@ -1408,21 +1408,21 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) r = execTok (spec, &s, &cmd_str, &cmd_len); p = regxStrz (cmd_str, cmd_len, ptmp); #if REGX_DEBUG - logf (LOG_LOG, "begin context %s", p); + yaz_log (YLOG_LOG, "begin context %s", p); #endif while (lc && strcmp (p, lc->name)) lc = lc->next; if (lc) spec->context_stack[++(spec->context_stack_top)] = lc; else - logf (LOG_WARN, "unknown context %s", p); + yaz_log (YLOG_WARN, "unknown context %s", p); } r = execTok (spec, &s, &cmd_str, &cmd_len); } else { - logf (LOG_WARN, "bad keyword '%s' after begin", p); + yaz_log (YLOG_WARN, "bad keyword '%s' after begin", p); } } else if (!strcmp (p, "end")) @@ -1430,7 +1430,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) r = execTok (spec, &s, &cmd_str, &cmd_len); if (r < 2) { - logf (LOG_WARN, "missing keyword after 'end'"); + yaz_log (YLOG_WARN, "missing keyword after 'end'"); continue; } p = regxStrz (cmd_str, cmd_len, ptmp); @@ -1443,7 +1443,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) } r = execTok (spec, &s, &cmd_str, &cmd_len); #if REGX_DEBUG - logf (LOG_LOG, "end record"); + yaz_log (YLOG_LOG, "end record"); #endif spec->stop_flag = 1; } @@ -1465,7 +1465,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) if (spec->d1_level <= 1) { #if REGX_DEBUG - logf (LOG_LOG, "end element end records"); + yaz_log (YLOG_LOG, "end element end records"); #endif spec->stop_flag = 1; } @@ -1474,14 +1474,14 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) else if (!strcmp (p, "context")) { #if REGX_DEBUG - logf (LOG_LOG, "end context"); + yaz_log (YLOG_LOG, "end context"); #endif if (spec->context_stack_top) (spec->context_stack_top)--; r = execTok (spec, &s, &cmd_str, &cmd_len); } else - logf (LOG_WARN, "bad keyword '%s' after end", p); + yaz_log (YLOG_WARN, "bad keyword '%s' after end", p); } else if (!strcmp (p, "data")) { @@ -1509,12 +1509,12 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) break; } else - logf (LOG_WARN, "bad data option: %.*s", + yaz_log (YLOG_WARN, "bad data option: %.*s", cmd_len, cmd_str); } if (r != 2) { - logf (LOG_WARN, "missing data item after data"); + yaz_log (YLOG_WARN, "missing data item after data"); continue; } if (element_str) @@ -1537,7 +1537,7 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) r = execTok (spec, &s, &cmd_str, &cmd_len); if (r < 2) { - logf (LOG_WARN, "missing number after -offset"); + yaz_log (YLOG_WARN, "missing number after -offset"); continue; } p = regxStrz (cmd_str, cmd_len, ptmp); @@ -1548,12 +1548,12 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) offset = 0; if (r < 2) { - logf (LOG_WARN, "missing index after unread command"); + yaz_log (YLOG_WARN, "missing index after unread command"); continue; } if (cmd_len != 1 || *cmd_str < '0' || *cmd_str > '9') { - logf (LOG_WARN, "bad index after unread command"); + yaz_log (YLOG_WARN, "bad index after unread command"); continue; } else @@ -1578,20 +1578,20 @@ static void execCode (struct lexSpec *spec, struct regxCode *code) if (lc) spec->context_stack[spec->context_stack_top] = lc; else - logf (LOG_WARN, "unknown context %s", p); + yaz_log (YLOG_WARN, "unknown context %s", p); } r = execTok (spec, &s, &cmd_str, &cmd_len); } else { - logf (LOG_WARN, "unknown code command '%.*s'", cmd_len, cmd_str); + yaz_log (YLOG_WARN, "unknown code command '%.*s'", cmd_len, cmd_str); r = execTok (spec, &s, &cmd_str, &cmd_len); continue; } if (r > 1) { - logf (LOG_WARN, "ignoring token %.*s", cmd_len, cmd_str); + yaz_log (YLOG_WARN, "ignoring token %.*s", cmd_len, cmd_str); do { r = execTok (spec, &s, &cmd_str, &cmd_len); } while (r > 1); @@ -1629,7 +1629,7 @@ static int execAction (struct lexSpec *spec, struct lexRuleAction *ap, arg_no++; arg_start[arg_no] = F_WIN_EOF; arg_end[arg_no] = F_WIN_EOF; - yaz_log(LOG_DEBUG, "Pattern match rest of record"); + yaz_log(YLOG_DEBUG, "Pattern match rest of record"); *pptr = F_WIN_EOF; } else @@ -1681,7 +1681,7 @@ static int execRule (struct lexSpec *spec, struct lexContext *context, int ruleNo, int start_ptr, int *pptr) { #if REGX_DEBUG - logf (LOG_LOG, "exec rule %d", ruleNo); + yaz_log (YLOG_LOG, "exec rule %d", ruleNo); #endif return execAction (spec, context->fastRule[ruleNo]->actionList, start_ptr, pptr); @@ -1759,7 +1759,7 @@ data1_node *lexNode (struct lexSpec *spec, int *ptr) if (spec->f_win_ef && *ptr != F_WIN_EOF) { #if REGX_DEBUG - logf (LOG_LOG, "regx: endf ptr=%d", *ptr); + yaz_log (YLOG_LOG, "regx: endf ptr=%d", *ptr); #endif (*spec->f_win_ef)(spec->f_win_fh, *ptr); } @@ -1824,7 +1824,7 @@ static data1_node *lexRoot (struct lexSpec *spec, off_t offset, } if (!lt) { - logf (LOG_WARN, "cannot find context %s", context_name); + yaz_log (YLOG_WARN, "cannot find context %s", context_name); return NULL; } spec->context_stack[spec->context_stack_top] = lt; @@ -1880,7 +1880,7 @@ data1_node *grs_read_regx (struct grs_read_info *p) struct lexSpec **curLexSpec = &specs->spec; #if REGX_DEBUG - logf (LOG_LOG, "grs_read_regx"); + yaz_log (YLOG_LOG, "grs_read_regx"); #endif if (!*curLexSpec || strcmp ((*curLexSpec)->name, specs->type)) { @@ -1937,7 +1937,7 @@ data1_node *grs_read_tcl (struct grs_read_info *p) struct lexSpec **curLexSpec = &specs->spec; #if REGX_DEBUG - logf (LOG_LOG, "grs_read_tcl"); + yaz_log (YLOG_LOG, "grs_read_tcl"); #endif if (!*curLexSpec || strcmp ((*curLexSpec)->name, specs->type)) { diff --git a/recctrl/sgmlread.c b/recctrl/sgmlread.c index 7edfbdf..ba9cbb1 100644 --- a/recctrl/sgmlread.c +++ b/recctrl/sgmlread.c @@ -1,4 +1,4 @@ -/* $Id: sgmlread.c,v 1.13 2004-09-28 10:15:03 adam Exp $ +/* $Id: sgmlread.c,v 1.14 2004-11-19 10:27:13 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -22,7 +22,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -#include +#include #include diff --git a/recctrl/xmlread.c b/recctrl/xmlread.c index a5bd006..aef219b 100644 --- a/recctrl/xmlread.c +++ b/recctrl/xmlread.c @@ -1,4 +1,4 @@ -/* $Id: xmlread.c,v 1.15 2004-09-28 10:15:03 adam Exp $ +/* $Id: xmlread.c,v 1.16 2004-11-19 10:27:13 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -30,12 +30,12 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #endif -#include +#include #include #include -#include +#include #include @@ -98,7 +98,7 @@ static void cb_decl (void *user, const char *version, const char *encoding, data1_mk_preprocess (ui->dh, ui->nmem, "xml", attr_list, ui->d1_stack[ui->level-1]); #if 0 - yaz_log (LOG_LOG, "decl version=%s encoding=%s", + yaz_log (YLOG_LOG, "decl version=%s encoding=%s", version ? version : "null", encoding ? encoding : "null"); #endif @@ -175,7 +175,7 @@ static int cb_external_entity (XML_Parser pparser, if (!(inf = fopen (systemId, "rb"))) { - yaz_log (LOG_WARN|LOG_ERRNO, "fopen %s", systemId); + yaz_log (YLOG_WARN|YLOG_ERRNO, "fopen %s", systemId); return 0; } @@ -186,7 +186,7 @@ static int cb_external_entity (XML_Parser pparser, void *buf = XML_GetBuffer (parser, XML_CHUNK); if (!buf) { - yaz_log (LOG_WARN, "XML_GetBuffer fail"); + yaz_log (YLOG_WARN, "XML_GetBuffer fail"); break; } r = fread (buf, 1, XML_CHUNK, inf); @@ -194,7 +194,7 @@ static int cb_external_entity (XML_Parser pparser, { if (ferror(inf)) { - yaz_log (LOG_WARN|LOG_ERRNO, "fread %s", systemId); + yaz_log (YLOG_WARN|YLOG_ERRNO, "fread %s", systemId); break; } done = 1; @@ -202,7 +202,7 @@ static int cb_external_entity (XML_Parser pparser, if (!XML_ParseBuffer (parser, r, done)) { done = 1; - yaz_log (LOG_WARN, "%s:%d:%d:XML error: %s", + yaz_log (YLOG_WARN, "%s:%d:%d:XML error: %s", systemId, XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser), @@ -227,7 +227,7 @@ static int cb_encoding_convert (void *data, const char *s) unsigned short code; #if 1 - yaz_log(LOG_LOG, "------------------------- cb_encoding_convert --- "); + yaz_log(YLOG_LOG, "------------------------- cb_encoding_convert --- "); #endif ret = iconv (t, &inbuf, &inleft, &outbuf, &outleft); if (ret == (size_t) (-1) && errno != E2BIG) @@ -343,7 +343,7 @@ static int cb_encoding_handler (void *userData, const char *name, { info->map[i] = -1; /* no room for output */ if (i != 0) - yaz_log (LOG_WARN, "Encoding %d: no room for output", + yaz_log (YLOG_WARN, "Encoding %d: no room for output", i); } } @@ -357,7 +357,7 @@ static int cb_encoding_handler (void *userData, const char *name, else { /* should never happen */ info->map[i] = -1; - yaz_log (LOG_DEBUG, "Encoding %d: bad state", i); + yaz_log (YLOG_DEBUG, "Encoding %d: bad state", i); } } if (info->data) @@ -401,7 +401,7 @@ data1_node *zebra_read_xml (data1_handle dh, int done = 0; data1_node *first_node; - uinfo.loglevel = LOG_DEBUG; + uinfo.loglevel = YLOG_DEBUG; uinfo.level = 1; uinfo.dh = dh; uinfo.nmem = m; @@ -430,14 +430,14 @@ data1_node *zebra_read_xml (data1_handle dh, if (!buf) { /* error */ - yaz_log (LOG_WARN, "XML_GetBuffer fail"); + yaz_log (YLOG_WARN, "XML_GetBuffer fail"); break; } r = (*rf)(fh, buf, XML_CHUNK); if (r < 0) { /* error */ - yaz_log (LOG_WARN, "XML read fail"); + yaz_log (YLOG_WARN, "XML read fail"); break; } else if (r == 0) @@ -445,7 +445,7 @@ data1_node *zebra_read_xml (data1_handle dh, if (!XML_ParseBuffer (parser, r, done)) { done = 1; - yaz_log (LOG_WARN, "%d:%d:XML error: %s", + yaz_log (YLOG_WARN, "%d:%d:XML error: %s", XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); diff --git a/rset/rsbetween.c b/rset/rsbetween.c index d5a210a..5081bd7 100644 --- a/rset/rsbetween.c +++ b/rset/rsbetween.c @@ -1,4 +1,4 @@ -/* $Id: rsbetween.c,v 1.31 2004-11-05 18:08:06 heikki Exp $ +/* $Id: rsbetween.c,v 1.32 2004-11-19 10:27:13 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -146,7 +146,7 @@ RSET rsbetween_create( NMEM nmem, const struct key_control *kcontrol, } info->andset=rsmultiand_create( nmem, kcontrol, scope, n, rsetarray); rnew->priv=info; - logf(log_level,"create rset at %p",rnew); + yaz_log(log_level,"create rset at %p",rnew); return rnew; } @@ -154,7 +154,7 @@ RSET rsbetween_create( NMEM nmem, const struct key_control *kcontrol, static void r_delete (RSET ct) { struct rset_between_info *info = (struct rset_between_info *) ct->priv; - logf(log_level,"delete rset at %p",ct); + yaz_log(log_level,"delete rset at %p",ct); rset_delete(info->andset); } @@ -167,7 +167,7 @@ static RSFD r_open (RSET ct, int flag) if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "between set type is read-only"); + yaz_log (YLOG_FATAL, "between set type is read-only"); return NULL; } rfd=rfd_create_base(ct); @@ -186,14 +186,14 @@ static RSFD r_open (RSET ct, int flag) p->attrdepth=0; p->attrbufok=0; p->startbufok=0; - logf(log_level,"open rset=%p rfd=%p", ct, rfd); + yaz_log(log_level,"open rset=%p rfd=%p", ct, rfd); return rfd; } static void r_close (RSFD rfd) { struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv; - logf(log_level,"close rfd=%p", rfd); + yaz_log(log_level,"close rfd=%p", rfd); rset_close (p->andrfd); rfd_delete_base(rfd); } @@ -205,7 +205,7 @@ static int r_forward(RSFD rfd, void *buf, { struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv; int rc; - logf(log_level, "forwarding "); + yaz_log(log_level, "forwarding "); rc=rset_forward(p->andrfd,buf,term,untilbuf); return rc; } @@ -231,7 +231,7 @@ static void checkattr(RSFD rfd) if (0==cmp) /* and the keys match */ { p->attrdepth=p->depth; - logf(log_level, "found attribute match at depth %d",p->attrdepth); + yaz_log(log_level, "found attribute match at depth %d",p->attrdepth); } } } @@ -243,13 +243,13 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv; const struct key_control *kctrl=rfd->rset->keycontrol; int cmp; - logf(log_level,"== read: term=%p",term); + yaz_log(log_level,"== read: term=%p",term); TERMID dummyterm=0; if (!term) term=&dummyterm; while ( rset_read(p->andrfd,buf,term) ) { - logf(log_level,"read loop term=%p d=%d ad=%d", + yaz_log(log_level,"read loop term=%p d=%d ad=%d", *term,p->depth, p->attrdepth); if (p->hits<0) {/* first time? */ @@ -259,23 +259,23 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) } else { cmp=(kctrl->cmp)(buf,p->recbuf); - logf(log_level, "cmp=%d",cmp); + yaz_log(log_level, "cmp=%d",cmp); } if (cmp>=rfd->rset->scope) { - logf(log_level,"new record"); + yaz_log(log_level,"new record"); p->depth=0; p->attrdepth=0; memcpy(p->recbuf,buf,kctrl->key_size); } if (*term) - logf(log_level," term: '%s'", (*term)->name); + yaz_log(log_level," term: '%s'", (*term)->name); if (*term==info->startterm) { p->depth++; - logf(log_level,"read start tag. d=%d",p->depth); + yaz_log(log_level,"read start tag. d=%d",p->depth); memcpy(p->startbuf,buf,kctrl->key_size); p->startbufok=1; checkattr(rfd); /* in case we already saw the attr here */ @@ -285,11 +285,11 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) if (p->depth == p->attrdepth) p->attrdepth=0; /* ending the tag with attr match */ p->depth--; - logf(log_level,"read end tag. d=%d ad=%d",p->depth, p->attrdepth); + yaz_log(log_level,"read end tag. d=%d ad=%d",p->depth, p->attrdepth); } else if (*term==info->attrterm) { - logf(log_level,"read attr"); + yaz_log(log_level,"read attr"); memcpy(p->attrbuf,buf,kctrl->key_size); p->attrbufok=1; checkattr(rfd); /* in case the start tag came first */ @@ -299,11 +299,11 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) if (p->depth && p->attrdepth) { p->hits++; - logf(log_level,"got a hit h="ZINT_FORMAT" d=%d ad=%d", + yaz_log(log_level,"got a hit h="ZINT_FORMAT" d=%d ad=%d", p->hits,p->depth,p->attrdepth); return 1; /* we have everything in place already! */ } else - logf(log_level, "Ignoring hit. h="ZINT_FORMAT" d=%d ad=%d", + yaz_log(log_level, "Ignoring hit. h="ZINT_FORMAT" d=%d ad=%d", p->hits,p->depth,p->attrdepth); } } /* while read */ @@ -315,7 +315,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "between set type is read-only"); + yaz_log (YLOG_FATAL, "between set type is read-only"); return -1; } @@ -324,7 +324,7 @@ static void r_pos (RSFD rfd, double *current, double *total) { struct rset_between_rfd *p=(struct rset_between_rfd *)rfd->priv; rset_pos(p->andrfd,current, total); - logf(log_level,"pos: %0.1f/%0.1f ", *current, *total); + yaz_log(log_level,"pos: %0.1f/%0.1f ", *current, *total); } static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm) diff --git a/rset/rsbool.c b/rset/rsbool.c index 3f50b08..39f9ec1 100644 --- a/rset/rsbool.c +++ b/rset/rsbool.c @@ -1,4 +1,4 @@ -/* $Id: rsbool.c,v 1.50 2004-10-22 10:12:51 heikki Exp $ +/* $Id: rsbool.c,v 1.51 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -165,7 +165,7 @@ static RSFD r_open (RSET ct, int flag) if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "bool set type is read-only"); + yaz_log (YLOG_FATAL, "bool set type is read-only"); return NULL; } rfd = rfd_create_base(ct); @@ -178,7 +178,7 @@ static RSFD r_open (RSET ct, int flag) p->buf_r = nmem_malloc(ct->nmem, ct->keycontrol->key_size); } - logf(LOG_DEBUG,"rsbool (%s) open [%p]", ct->control->desc, rfd); + yaz_log(YLOG_DEBUG,"rsbool (%s) open [%p]", ct->control->desc, rfd); p->hits=0; p->rfd_l = rset_open (info->rset_l, RSETF_READ); @@ -247,10 +247,10 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) else cmp = rfd->rset->scope; #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] looping: m=%d/%d c=%d t=%d", + yaz_log (YLOG_DEBUG, "r_read_and [%p] looping: m=%d/%d c=%d t=%d", rfd, p->more_l, p->more_r, cmp, p->tail); - (*kctrl->log_item)(LOG_DEBUG, p->buf_l, "left "); - (*kctrl->log_item)(LOG_DEBUG, p->buf_r, "right "); + (*kctrl->log_item)(YLOG_DEBUG, p->buf_l, "left "); + (*kctrl->log_item)(YLOG_DEBUG, p->buf_r, "right "); #endif if (!cmp) { /* cmp==0 */ @@ -268,10 +268,10 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r); p->tail = 1; #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] returning R m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_and [%p] returning R m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); - key_logdump(LOG_DEBUG,buf); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + key_logdump(YLOG_DEBUG,buf); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -284,9 +284,9 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) p->more_l = rset_read (p->rfd_l, p->buf_l,&p->term_l); p->tail = 1; #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] returning L m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_and [%p] returning L m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -302,9 +302,9 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) if (!p->more_r || (*kctrl->cmp)(p->buf_r, buf) > 1) p->tail = 0; #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] returning R tail m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_and [%p] returning R tail m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -312,7 +312,7 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) else { #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] about to forward R " + yaz_log (YLOG_DEBUG, "r_read_and [%p] about to forward R " "m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); #endif @@ -334,9 +334,9 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) if (!p->more_l || (*kctrl->cmp)(p->buf_l, buf) > 1) p->tail = 0; #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] returning L tail m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_and [%p] returning L tail m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -344,7 +344,7 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) else { #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] about to forward L " + yaz_log (YLOG_DEBUG, "r_read_and [%p] about to forward L " "m=%d/%d c=%d", rfd, p->more_l, p->more_r, cmp); #endif @@ -357,7 +357,7 @@ static int r_read_and (RSFD rfd, void *buf, TERMID *term) } } #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_and [%p] reached its end",rfd); + yaz_log (YLOG_DEBUG, "r_read_and [%p] reached its end",rfd); #endif return 0; } @@ -388,9 +388,9 @@ static int r_read_or (RSFD rfd, void *buf, TERMID *term) /* get to see both? */ p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r); #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_or returning A m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_or returning A m=%d/%d c=%d", p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -402,9 +402,9 @@ static int r_read_or (RSFD rfd, void *buf, TERMID *term) *term=p->term_r; p->more_r = rset_read (p->rfd_r, p->buf_r, &p->term_r); #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_or returning B m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_or returning B m=%d/%d c=%d", p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -416,9 +416,9 @@ static int r_read_or (RSFD rfd, void *buf, TERMID *term) *term=p->term_l; p->more_l = rset_read ( p->rfd_l, p->buf_l, &p->term_l); #if RSET_DEBUG - logf (LOG_DEBUG, "r_read_or returning C m=%d/%d c=%d", + yaz_log (YLOG_DEBUG, "r_read_or returning C m=%d/%d c=%d", p->more_l, p->more_r, cmp); - (*kctrl->log_item)(LOG_DEBUG, buf, ""); + (*kctrl->log_item)(YLOG_DEBUG, buf, ""); #endif p->hits++; return 1; @@ -484,7 +484,7 @@ static int r_read_not (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "bool set type is read-only"); + yaz_log (YLOG_FATAL, "bool set type is read-only"); return -1; } @@ -512,7 +512,7 @@ static void r_pos (RSFD rfd, double *current, double *total) *current=(double) (p->hits); *total=*current/r ; #if RSET_DEBUG - yaz_log(LOG_DEBUG,"bool_pos: (%s/%s) %0.1f/%0.1f= %0.4f ", + yaz_log(YLOG_DEBUG,"bool_pos: (%s/%s) %0.1f/%0.1f= %0.4f ", info->rset_l->control->desc, info->rset_r->control->desc, *current, *total, r); #endif diff --git a/rset/rset.c b/rset/rset.c index a58d5f9..9520639 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,4 +1,4 @@ -/* $Id: rset.c,v 1.39 2004-11-04 13:54:08 heikki Exp $ +/* $Id: rset.c,v 1.40 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -52,13 +52,13 @@ RSFD rfd_create_base(RSET rs) { rs->free_list=rnew->next; assert(rnew->rset==rs); - logf(log_level,"rfd-create_base (fl): rfd=%p rs=%p fl=%p priv=%p", + yaz_log(log_level,"rfd-create_base (fl): rfd=%p rs=%p fl=%p priv=%p", rnew, rs, rs->free_list, rnew->priv); } else { rnew=nmem_malloc(rs->nmem, sizeof(*rnew)); rnew->priv=NULL; rnew->rset=rs; - logf(log_level,"rfd_create_base (new): rfd=%p rs=%p fl=%p priv=%p", + yaz_log(log_level,"rfd_create_base (new): rfd=%p rs=%p fl=%p priv=%p", rnew, rs, rs->free_list, rnew->priv); } rnew->next=NULL; /* not part of any (free?) list */ @@ -70,7 +70,7 @@ RSFD rfd_create_base(RSET rs) void rfd_delete_base(RSFD rfd) { RSET rs=rfd->rset; - logf(log_level,"rfd_delete_base: rfd=%p rs=%p priv=%p fl=%p", + yaz_log(log_level,"rfd_delete_base: rfd=%p rs=%p priv=%p fl=%p", rfd, rs, rfd->priv, rs->free_list); assert(NULL == rfd->next); rfd->next=rs->free_list; @@ -90,7 +90,7 @@ RSET rset_create_base(const struct rset_control *sel, else M=nmem_create(); rnew = (RSET) nmem_malloc(M,sizeof(*rnew)); - logf (log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rnew, nmem); + yaz_log (log_level, "rs_create(%s) rs=%p (nm=%p)", sel->desc, rnew, nmem); rnew->nmem=M; if (nmem) rnew->my_nmem=0; @@ -111,7 +111,7 @@ RSET rset_create_base(const struct rset_control *sel, void rset_delete (RSET rs) { (rs->count)--; - logf(log_level,"rs_delete(%s), rs=%p, count=%d", + yaz_log(log_level,"rs_delete(%s), rs=%p, count=%d", rs->control->desc, rs, rs->count); if (!rs->count) { @@ -124,7 +124,7 @@ void rset_delete (RSET rs) RSET rset_dup (RSET rs) { (rs->count)++; - logf(log_level,"rs_dup(%s), rs=%p, count=%d", + yaz_log(log_level,"rs_dup(%s), rs=%p, count=%d", rs->control->desc, rs, rs->count); return rs; } @@ -136,14 +136,14 @@ int rset_default_forward(RSFD rfd, void *buf, TERMID *term, int cmp=rfd->rset->scope; if (log_level) { - logf (log_level, "rset_default_forward starting '%s' (ct=%p rfd=%p)", + yaz_log (log_level, "rset_default_forward starting '%s' (ct=%p rfd=%p)", rfd->rset->control->desc, rfd->rset, rfd); /* key_logdump(log_level, untilbuf); */ } while ( (cmp>=rfd->rset->scope) && (more)) { if (log_level) /* time-critical, check first */ - logf(log_level,"rset_default_forward looping m=%d c=%d",more,cmp); + yaz_log(log_level,"rset_default_forward looping m=%d c=%d",more,cmp); more=rset_read(rfd, buf, term); if (more) cmp=(rfd->rset->keycontrol->cmp)(untilbuf,buf); @@ -151,7 +151,7 @@ int rset_default_forward(RSFD rfd, void *buf, TERMID *term, key_logdump(log_level,buf); */ } if (log_level) - logf (log_level, "rset_default_forward exiting m=%d c=%d",more,cmp); + yaz_log (log_level, "rset_default_forward exiting m=%d c=%d",more,cmp); return more; } @@ -195,7 +195,7 @@ TERMID rset_term_create (const char *name, int length, const char *flags, { TERMID t; - logf (log_level, "term_create '%s' %d f=%s type=%d nmem=%p", + yaz_log (log_level, "term_create '%s' %d f=%s type=%d nmem=%p", name, length, flags, type, nmem); t= (TERMID) nmem_malloc (nmem, sizeof(*t)); if (!name) diff --git a/rset/rsisamb.c b/rset/rsisamb.c index b132694..50e9bea 100644 --- a/rset/rsisamb.c +++ b/rset/rsisamb.c @@ -1,4 +1,4 @@ -/* $Id: rsisamb.c,v 1.27 2004-11-15 23:13:12 adam Exp $ +/* $Id: rsisamb.c,v 1.28 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -94,7 +94,7 @@ RSFD r_open (RSET ct, int flag) if (flag & RSETF_WRITE) { - yaz_log(LOG_FATAL, "ISAMB set type is read-only"); + yaz_log(YLOG_FATAL, "ISAMB set type is read-only"); return NULL; } rfd = rfd_create_base(ct); @@ -152,6 +152,6 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - yaz_log(LOG_FATAL, "ISAMB set type is read-only"); + yaz_log(YLOG_FATAL, "ISAMB set type is read-only"); return -1; } diff --git a/rset/rsisamc.c b/rset/rsisamc.c index 4f8fad1..d01d601 100644 --- a/rset/rsisamc.c +++ b/rset/rsisamc.c @@ -1,4 +1,4 @@ -/* $Id: rsisamc.c,v 1.32 2004-11-15 23:13:12 adam Exp $ +/* $Id: rsisamc.c,v 1.33 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -97,7 +97,7 @@ RSFD r_open (RSET ct, int flag) yaz_log(log_level, "risamc_open"); if (flag & RSETF_WRITE) { - yaz_log(LOG_FATAL, "ISAMC set type is read-only"); + yaz_log(YLOG_FATAL, "ISAMC set type is read-only"); return NULL; } rfd = rfd_create_base(ct); @@ -134,7 +134,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - yaz_log(LOG_FATAL, "ISAMC set type is read-only"); + yaz_log(YLOG_FATAL, "ISAMC set type is read-only"); return -1; } diff --git a/rset/rsisams.c b/rset/rsisams.c index 0607c2b..124558c 100644 --- a/rset/rsisams.c +++ b/rset/rsisams.c @@ -1,4 +1,4 @@ -/* $Id: rsisams.c,v 1.16 2004-10-22 10:12:52 heikki Exp $ +/* $Id: rsisams.c,v 1.17 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -73,7 +73,7 @@ RSET rsisams_create( NMEM nmem, const struct key_control *kcontrol, int scope, static void r_delete (RSET ct) { - logf (LOG_DEBUG, "rsisams_delete"); + yaz_log (YLOG_DEBUG, "rsisams_delete"); rset_delete(ct); } @@ -84,10 +84,10 @@ RSFD r_open (RSET ct, int flag) RSFD rfd; struct rset_pp_info *ptinfo; - logf (LOG_DEBUG, "risams_open"); + yaz_log (YLOG_DEBUG, "risams_open"); if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "ISAMS set type is read-only"); + yaz_log (YLOG_FATAL, "ISAMS set type is read-only"); return NULL; } rfd=rfd_create_base(ct); @@ -122,7 +122,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "ISAMS set type is read-only"); + yaz_log (YLOG_FATAL, "ISAMS set type is read-only"); return -1; } diff --git a/rset/rsmultiandor.c b/rset/rsmultiandor.c index ac728b1..2e3ea01 100644 --- a/rset/rsmultiandor.c +++ b/rset/rsmultiandor.c @@ -1,4 +1,4 @@ -/* $Id: rsmultiandor.c,v 1.9 2004-11-04 13:54:08 heikki Exp $ +/* $Id: rsmultiandor.c,v 1.10 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -137,13 +137,13 @@ static void heap_dump_item( HEAP h, int i, int level) { if (i>h->heapnum) return; (void)rset_pos(h->heap[i]->rset,h->heap[i]->fd, &cur, &tot); - logf(log_level," %d %*s i=%p buf=%p %0.1f/%0.1f",i, level, "", + yaz_log(log_level," %d %*s i=%p buf=%p %0.1f/%0.1f",i, level, "", &(h->heap[i]), h->heap[i]->buf, cur,tot ); heap_dump_item(h, 2*i, level+1); heap_dump_item(h, 2*i+1, level+1); } static void heap_dump( HEAP h,char *msg) { - logf(log_level, "heap dump: %s num=%d max=%d",msg, h->heapnum, h->heapmax); + yaz_log(log_level, "heap dump: %s num=%d max=%d",msg, h->heapnum, h->heapmax); heap_dump_item(h,1,1); } #endif @@ -316,7 +316,7 @@ static RSFD r_open_andor (RSET ct, int flag, int is_and) if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "multiandor set type is read-only"); + yaz_log (YLOG_FATAL, "multiandor set type is read-only"); return NULL; } rfd=rfd_create_base(ct); @@ -571,26 +571,26 @@ static void r_pos (RSFD rfd, double *current, double *total) int i; for (i=0; ino_rsets; i++){ rset_pos(mrfd->items[i].fd, &cur, &tot); - logf(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot); + yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot); scur += cur; stot += tot; } if (stot <1.0) { /* nothing there */ *current=0; *total=0; - logf(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total); + yaz_log(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total); return; } *current=mrfd->hits; *total=*current*stot/scur; - logf(log_level, "r_pos: = %0.1f %0.1f", *current, *total); + yaz_log(log_level, "r_pos: = %0.1f %0.1f", *current, *total); } static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "multior set type is read-only"); + yaz_log (YLOG_FATAL, "multior set type is read-only"); return -1; } diff --git a/rset/rsnull.c b/rset/rsnull.c index f3d2135..ea44bd2 100644 --- a/rset/rsnull.c +++ b/rset/rsnull.c @@ -1,4 +1,4 @@ -/* $Id: rsnull.c,v 1.29 2004-10-22 10:12:52 heikki Exp $ +/* $Id: rsnull.c,v 1.30 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -62,7 +62,7 @@ static RSFD r_open (RSET ct, int flag) RSFD rfd; if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "NULL set type is read-only"); + yaz_log (YLOG_FATAL, "NULL set type is read-only"); return NULL; } rfd=rfd_create_base(ct); @@ -98,7 +98,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "NULL set type is read-only"); + yaz_log (YLOG_FATAL, "NULL set type is read-only"); return -1; } diff --git a/rset/rsprox.c b/rset/rsprox.c index d24d2ef..da66936 100644 --- a/rset/rsprox.c +++ b/rset/rsprox.c @@ -1,4 +1,4 @@ -/* $Id: rsprox.c,v 1.20 2004-10-22 10:12:52 heikki Exp $ +/* $Id: rsprox.c,v 1.21 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -114,7 +114,7 @@ static RSFD r_open (RSET ct, int flag) if (flag & RSETF_WRITE) { - logf (LOG_FATAL, "prox set type is read-only"); + yaz_log (YLOG_FATAL, "prox set type is read-only"); return NULL; } rfd = rfd_create_base(ct); @@ -133,7 +133,7 @@ static RSFD r_open (RSET ct, int flag) } p->rfd = nmem_malloc(ct->nmem,sizeof(*p->rfd) * info->rset_no); } - logf(LOG_DEBUG,"rsprox (%s) open [%p] n=%d", + yaz_log(YLOG_DEBUG,"rsprox (%s) open [%p] n=%d", ct->control->desc, rfd, info->rset_no); for (i = 0; i < info->rset_no; i++) { @@ -302,7 +302,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) static int r_write (RSFD rfd, const void *buf) { - logf (LOG_FATAL, "prox set type is read-only"); + yaz_log (YLOG_FATAL, "prox set type is read-only"); return -1; } @@ -315,7 +315,7 @@ static void r_pos (RSFD rfd, double *current, double *total) double scur=0,stot=0; double r; - logf (LOG_DEBUG, "rsprox_pos"); + yaz_log (YLOG_DEBUG, "rsprox_pos"); for (i = 0; i < info->rset_no; i++) { @@ -336,7 +336,7 @@ static void r_pos (RSFD rfd, double *current, double *total) *current=p->hits; *total=*current/r ; } - logf(LOG_DEBUG,"prox_pos: [%d] %0.1f/%0.1f= %0.4f ", + yaz_log(YLOG_DEBUG,"prox_pos: [%d] %0.1f/%0.1f= %0.4f ", i,*current, *total, r); } diff --git a/rset/rstemp.c b/rset/rstemp.c index 984249b..b492f0e 100644 --- a/rset/rstemp.c +++ b/rset/rstemp.c @@ -1,4 +1,4 @@ -/* $Id: rstemp.c,v 1.54 2004-11-04 13:54:08 heikki Exp $ +/* $Id: rstemp.c,v 1.55 2004-11-19 10:27:14 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -115,10 +115,10 @@ static void r_delete (RSET ct) { struct rset_temp_info *info = (struct rset_temp_info*) ct->priv; - logf (log_level, "r_delete: set size %ld", (long) info->pos_end); + yaz_log (log_level, "r_delete: set size %ld", (long) info->pos_end); if (info->fname) { - logf (log_level, "r_delete: unlink %s", info->fname); + yaz_log (log_level, "r_delete: unlink %s", info->fname); unlink (info->fname); } } @@ -138,7 +138,7 @@ static RSFD r_open (RSET ct, int flag) info->fd = open (info->fname, O_BINARY|O_RDONLY); if (info->fd == -1) { - logf (LOG_FATAL|LOG_ERRNO, "rstemp: open failed %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: open failed %s", info->fname); exit (1); } } @@ -179,7 +179,7 @@ static void r_flush (RSFD rfd, int mk) if (info->fd == -1) { - logf (LOG_FATAL|LOG_ERRNO, "rstemp: mkstemp %s", template); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: mkstemp %s", template); exit (1); } info->fname= nmem_malloc(rfd->rset->nmem,strlen(template)+1); @@ -189,11 +189,11 @@ static void r_flush (RSFD rfd, int mk) info->fname= nmem_malloc(rfd->rset->nmem,strlen(template)+1); strcpy (info->fname, s); - logf (log_level, "creating tempfile %s", info->fname); + yaz_log (log_level, "creating tempfile %s", info->fname); info->fd = open (info->fname, O_BINARY|O_RDWR|O_CREAT, 0666); if (info->fd == -1) { - logf (LOG_FATAL|LOG_ERRNO, "rstemp: open %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: open %s", info->fname); exit (1); } #endif @@ -205,7 +205,7 @@ static void r_flush (RSFD rfd, int mk) if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1) { - logf (LOG_FATAL|LOG_ERRNO, "rstemp: lseek %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: lseek %s", info->fname); exit (1); } count = info->buf_size; @@ -214,9 +214,9 @@ static void r_flush (RSFD rfd, int mk) if ((r = write (info->fd, info->buf_mem, count)) < (int) count) { if (r == -1) - logf (LOG_FATAL|LOG_ERRNO, "rstemp: write %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: write %s", info->fname); else - logf (LOG_FATAL, "rstemp: write of %ld but got %ld", + yaz_log (YLOG_FATAL, "rstemp: write of %ld but got %ld", (long) count, (long) r); exit (1); } @@ -261,15 +261,15 @@ static void r_reread (RSFD rfd) { if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1) { - logf (LOG_FATAL|LOG_ERRNO, "rstemp: lseek %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: lseek %s", info->fname); exit (1); } if ((r = read (info->fd, info->buf_mem, count)) < (int) count) { if (r == -1) - logf (LOG_FATAL|LOG_ERRNO, "rstemp: read %s", info->fname); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "rstemp: read %s", info->fname); else - logf (LOG_FATAL, "read of %ld but got %ld", + yaz_log (YLOG_FATAL, "read of %ld but got %ld", (long) count, (long) r); exit (1); } diff --git a/test/Makefile.am b/test/Makefile.am index 072ba96..7c53244 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS=codec api gils malxml config usmarc dmoz sort sort2 xelm cddb \ - rusmarc zsh marcxml charmap + rusmarc zsh marcxml charmap diff --git a/test/api/t10.c b/test/api/t10.c index eb99c1b..83defa0 100644 --- a/test/api/t10.c +++ b/test/api/t10.c @@ -1,4 +1,4 @@ -/* $Id: t10.c,v 1.4 2004-11-04 13:09:49 heikki Exp $ +/* $Id: t10.c,v 1.5 2004-11-19 10:27:15 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -87,7 +87,7 @@ int main(int argc, char **argv) zh = zebra_open (zs); zebra_select_database(zh, "Default"); zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema); - logf(LOG_LOG,"============%d: %s ============", i,tests[i].schema); + yaz_log(log_level,"============%d: %s ============", i,tests[i].schema); ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 the", 3, tests[i].hit1, tests[i].score1); diff --git a/test/api/testlib.c b/test/api/testlib.c index 52173d3..5118284 100644 --- a/test/api/testlib.c +++ b/test/api/testlib.c @@ -1,4 +1,4 @@ -/* $Id: testlib.c,v 1.4 2004-11-04 13:10:07 heikki Exp $ +/* $Id: testlib.c,v 1.5 2004-11-19 10:27:15 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -23,14 +23,14 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA /** testlib - utilities for the api tests */ #include -#include #include #include #include "testlib.h" /** start_log: open a log file */ /* FIXME - parse command line arguments to set log levels etc */ -static int loglevel=0; +int log_level=0; /* not static, t*.c may use it */ + void start_log(int argc, char **argv) { char logname[2048]; @@ -40,9 +40,9 @@ void start_log(int argc, char **argv) return; sprintf(logname, "%s.log", argv[0]); yaz_log_init_file(logname); - loglevel = yaz_log_mask_str_x(argv[0],0); - yaz_log_init_level(LOG_DEFAULT_LEVEL | loglevel); - logf(loglevel,"starting %s",argv[0]); + log_level = yaz_log_mask_str_x(argv[0],0); + yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level); + yaz_log(log_level,"starting %s",argv[0]); } /** @@ -92,9 +92,9 @@ int close_down(ZebraHandle zh, ZebraService zs, int retcode) zebra_stop(zs); if (retcode) - logf(loglevel,"========= Exiting with return code %d", retcode); + yaz_log(log_level,"========= Exiting with return code %d", retcode); else - logf(loglevel,"========= All tests OK"); + yaz_log(log_level,"========= All tests OK"); nmem_exit(); xmalloc_trav("x"); return retcode; @@ -108,9 +108,9 @@ void init_data( ZebraHandle zh, const char **recs) char *addinfo; assert(zh); zebra_select_database(zh, "Default"); - logf(LOG_DEBUG,"going to call init"); + yaz_log(log_level,"going to call init"); i=zebra_init(zh); - logf(LOG_DEBUG,"init returned %d",i); + yaz_log(log_level,"init returned %d",i); if (i) { printf("init failed with %d\n",i); @@ -141,8 +141,8 @@ int do_query(int lineno, ZebraHandle zh, char *query, int exphits) int rc; - logf(loglevel,"======================================"); - logf(loglevel,"qry[%d]: %s", lineno, query); + yaz_log(log_level,"======================================"); + yaz_log(log_level,"qry[%d]: %s", lineno, query); odr=odr_createmem (ODR_DECODE); parser = yaz_pqf_create(); diff --git a/test/api/testlib.h b/test/api/testlib.h index 6a4c01d..e1c485c 100644 --- a/test/api/testlib.h +++ b/test/api/testlib.h @@ -1,4 +1,4 @@ -/* $Id: testlib.h,v 1.3 2004-10-29 13:02:39 heikki Exp $ +/* $Id: testlib.h,v 1.4 2004-11-19 10:27:16 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -23,10 +23,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA /** testlib - utilities for the api tests */ #include -#include +#include #include #include +int log_level; /** diff --git a/test/api/xpath1.c b/test/api/xpath1.c index 30006c7..e6ddb0d 100644 --- a/test/api/xpath1.c +++ b/test/api/xpath1.c @@ -1,4 +1,4 @@ -/* $Id: xpath1.c,v 1.1 2004-10-29 13:02:56 heikki Exp $ +/* $Id: xpath1.c,v 1.2 2004-11-19 10:27:16 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -21,7 +21,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ #include -#include #include #include "testlib.h" diff --git a/test/xpath/Makefile.am b/test/xpath/Makefile.am index caac315..2508918 100644 --- a/test/xpath/Makefile.am +++ b/test/xpath/Makefile.am @@ -1,9 +1,10 @@ -# $Id: Makefile.am,v 1.7 2004-05-25 08:49:11 adam Exp $ +# $Id: Makefile.am,v 1.8 2004-11-19 10:27:17 heikki Exp $ -check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh test5.sh +check_SCRIPTS = dummy.sh +#check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh test5.sh TESTS = $(check_SCRIPTS) -EXTRA_DIST = zebra.cfg rec.xml Zthes.abs zthes-b.est \ - simple1.xml rec4.xml rec5.xml $(check_SCRIPTS) +#EXTRA_DIST = zebra.cfg rec.xml Zthes.abs zthes-b.est \ +# simple1.xml rec4.xml rec5.xml $(check_SCRIPTS) diff --git a/test/xpath/dummy.sh b/test/xpath/dummy.sh new file mode 100755 index 0000000..b77c605 --- /dev/null +++ b/test/xpath/dummy.sh @@ -0,0 +1 @@ +echo "xpath tests moved away" diff --git a/util/charmap.c b/util/charmap.c index b36282f..fac1307 100644 --- a/util/charmap.c +++ b/util/charmap.c @@ -1,4 +1,4 @@ -/* $Id: charmap.c,v 1.30 2004-09-14 14:38:08 quinn Exp $ +/* $Id: charmap.c,v 1.31 2004-11-19 10:27:17 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -97,7 +97,7 @@ static chr_t_entry *set_map_string(chr_t_entry *root, NMEM nmem, root->target && root->target[0] && root->target[0][0] && strcmp (root->target[0], CHR_UNKNOWN)) { - yaz_log (LOG_WARN, "duplicate entry for charmap from '%s'", + yaz_log (YLOG_WARN, "duplicate entry for charmap from '%s'", from_0); } root->target = (unsigned char **) @@ -222,7 +222,7 @@ unsigned char zebra_prim(char **s) unsigned char c; unsigned int i = 0; - yaz_log (LOG_DEBUG, "prim %.3s", *s); + yaz_log (YLOG_DEBUG, "prim %.3s", *s); if (**s == '\\') { (*s)++; @@ -275,7 +275,7 @@ ucs4_t zebra_prim_w(ucs4_t **s) ucs4_t i = 0; char fmtstr[8]; - yaz_log (LOG_DEBUG, "prim_w %.3s", (char *) *s); + yaz_log (YLOG_DEBUG, "prim_w %.3s", (char *) *s); if (**s == '\\') { (*s)++; @@ -341,7 +341,7 @@ ucs4_t zebra_prim_w(ucs4_t **s) c = **s; ++(*s); } - yaz_log (LOG_DEBUG, "out %d", c); + yaz_log (YLOG_DEBUG, "out %d", c); return c; } @@ -392,7 +392,7 @@ static void fun_mkstring(const char *s, void *data, int num) res = chr_map_input(arg->map, &s, strlen(s), 0); if (*res == (char*) CHR_UNKNOWN) - logf(LOG_WARN, "Map: '%s' has no mapping", p); + yaz_log(YLOG_WARN, "Map: '%s' has no mapping", p); strncat(arg->string, *res, CHR_MAXSTR - strlen(arg->string)); arg->string[CHR_MAXSTR] = '\0'; } @@ -405,11 +405,11 @@ static void fun_add_map(const char *s, void *data, int num) chrwork *arg = (chrwork *) data; assert(arg->map->input); - logf (LOG_DEBUG, "set map %.*s", (int) strlen(s), s); + yaz_log (YLOG_DEBUG, "set map %.*s", (int) strlen(s), s); set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string, 0); for (s = arg->string; *s; s++) - logf (LOG_DEBUG, " %3d", (unsigned char) *s); + yaz_log (YLOG_DEBUG, " %3d", (unsigned char) *s); } /* @@ -420,11 +420,11 @@ static void fun_add_qmap(const char *s, void *data, int num) chrwork *arg = (chrwork *) data; assert(arg->map->q_input); - logf (LOG_DEBUG, "set qmap %.*s", (int) strlen(s), s); + yaz_log (YLOG_DEBUG, "set qmap %.*s", (int) strlen(s), s); set_map_string(arg->map->q_input, arg->map->nmem, s, strlen(s), arg->string, 0); for (s = arg->string; *s; s++) - logf (LOG_DEBUG, " %3d", (unsigned char) *s); + yaz_log (YLOG_DEBUG, " %3d", (unsigned char) *s); } static int scan_to_utf8 (yaz_iconv_t t, ucs4_t *from, size_t inlen, @@ -441,9 +441,9 @@ static int scan_to_utf8 (yaz_iconv_t t, ucs4_t *from, size_t inlen, ret = yaz_iconv (t, &inbuf, &inbytesleft, &outbuf, &outbytesleft); if (ret == (size_t) (-1)) { - yaz_log(LOG_LOG, "from: %2X %2X %2X %2X", + yaz_log(YLOG_LOG, "from: %2X %2X %2X %2X", from[0], from[1], from[2], from[3]); - yaz_log (LOG_WARN|LOG_ERRNO, "bad unicode sequence"); + yaz_log (YLOG_WARN|YLOG_ERRNO, "bad unicode sequence"); return -1; } } @@ -494,14 +494,14 @@ static int scan_string(char *s_native, begin = zebra_prim_w(&s); if (*s != '-') { - logf(LOG_FATAL, "Bad range in char-map"); + yaz_log(YLOG_FATAL, "Bad range in char-map"); return -1; } s++; end = zebra_prim_w(&s); if (end <= begin) { - logf(LOG_FATAL, "Bad range in char-map"); + yaz_log(YLOG_FATAL, "Bad range in char-map"); return -1; } s++; @@ -554,10 +554,10 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, t_utf8 = yaz_iconv_open ("UTF-8", ucs4_native); - logf (LOG_DEBUG, "maptab %s open", name); + yaz_log (YLOG_DEBUG, "maptab %s open", name); if (!(f = yaz_fopen(tabpath, name, "r", tabroot))) { - logf(LOG_WARN|LOG_ERRNO, "%s", name); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", name); return 0; } nmem = nmem_create (); @@ -604,13 +604,13 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, { if (argc != 2) { - logf(LOG_FATAL, "Syntax error in charmap"); + yaz_log(YLOG_FATAL, "Syntax error in charmap"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_addentry, res, &num) < 0) { - logf(LOG_FATAL, "Bad value-set specification"); + yaz_log(YLOG_FATAL, "Bad value-set specification"); ++errors; } res->base_uppercase = num; @@ -622,18 +622,18 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, { if (!res->base_uppercase) { - logf(LOG_FATAL, "Uppercase directive with no lowercase set"); + yaz_log(YLOG_FATAL, "Uppercase directive with no lowercase set"); ++errors; } if (argc != 2) { - logf(LOG_FATAL, "Missing arg for uppercase directive"); + yaz_log(YLOG_FATAL, "Missing arg for uppercase directive"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_addentry, res, &num) < 0) { - logf(LOG_FATAL, "Bad value-set specification"); + yaz_log(YLOG_FATAL, "Bad value-set specification"); ++errors; } } @@ -641,13 +641,13 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, { if (argc != 2) { - logf(LOG_FATAL, "Syntax error in charmap for space"); + yaz_log(YLOG_FATAL, "Syntax error in charmap for space"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_addspace, res, 0) < 0) { - logf(LOG_FATAL, "Bad space specification"); + yaz_log(YLOG_FATAL, "Bad space specification"); ++errors; } } @@ -655,13 +655,13 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, { if (argc != 2) { - logf(LOG_FATAL, "Syntax error in charmap for cut"); + yaz_log(YLOG_FATAL, "Syntax error in charmap for cut"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_addcut, res, 0) < 0) { - logf(LOG_FATAL, "Bad cut specification"); + yaz_log(YLOG_FATAL, "Bad cut specification"); ++errors; } } @@ -671,7 +671,7 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, if (argc != 3) { - logf(LOG_FATAL, "charmap directive map requires 2 args"); + yaz_log(YLOG_FATAL, "charmap directive map requires 2 args"); ++errors; } buf.map = res; @@ -679,13 +679,13 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, if (scan_string(argv[2], t_unicode, t_utf8, fun_mkstring, &buf, 0) < 0) { - logf(LOG_FATAL, "Bad map target"); + yaz_log(YLOG_FATAL, "Bad map target"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_add_map, &buf, 0) < 0) { - logf(LOG_FATAL, "Bad map source"); + yaz_log(YLOG_FATAL, "Bad map source"); ++errors; } } @@ -695,7 +695,7 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, if (argc != 3) { - logf(LOG_FATAL, "charmap directive qmap requires 2 args"); + yaz_log(YLOG_FATAL, "charmap directive qmap requires 2 args"); ++errors; } buf.map = res; @@ -703,13 +703,13 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, if (scan_string(argv[2], t_unicode, t_utf8, fun_mkstring, &buf, 0) < 0) { - logf(LOG_FATAL, "Bad qmap target"); + yaz_log(YLOG_FATAL, "Bad qmap target"); ++errors; } if (scan_string(argv[1], t_unicode, t_utf8, fun_add_qmap, &buf, 0) < 0) { - logf(LOG_FATAL, "Bad qmap source"); + yaz_log(YLOG_FATAL, "Bad qmap source"); ++errors; } } @@ -740,7 +740,7 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, } else { - logf(LOG_WARN, "Syntax error at '%s' in %s", line, name); + yaz_log(YLOG_WARN, "Syntax error at '%s' in %s", line, name); } yaz_fclose(f); @@ -749,7 +749,7 @@ chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only, chrmaptab_destroy(res); res = 0; } - logf (LOG_DEBUG, "maptab %s close %d errors", name, errors); + yaz_log (YLOG_DEBUG, "maptab %s close %d errors", name, errors); if (t_utf8 != 0) yaz_iconv_close(t_utf8); if (t_unicode != 0) diff --git a/util/passwddb.c b/util/passwddb.c index 3db6189..445d79f 100644 --- a/util/passwddb.c +++ b/util/passwddb.c @@ -1,4 +1,4 @@ -/* $Id: passwddb.c,v 1.7 2002-08-02 19:26:57 adam Exp $ +/* $Id: passwddb.c,v 1.8 2004-11-19 10:27:17 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -36,7 +36,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #endif -#include +#include #include #include @@ -122,7 +122,7 @@ void passwd_db_show (Passwd_db db) { struct passwd_entry *pe; for (pe = db->entries; pe; pe = pe->next) - logf (LOG_LOG,"%s:%s", pe->name, pe->des); + yaz_log (YLOG_LOG,"%s:%s", pe->name, pe->des); } int passwd_db_auth (Passwd_db db, const char *user, const char *pass) diff --git a/util/res-test.c b/util/res-test.c index e345a73..f74e70e 100644 --- a/util/res-test.c +++ b/util/res-test.c @@ -1,4 +1,4 @@ -/* $Id: res-test.c,v 1.8 2002-08-02 19:26:57 adam Exp $ +/* $Id: res-test.c,v 1.9 2004-11-19 10:27:18 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -28,7 +28,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA static void res_print (const char *name, const char *value) { - logf (LOG_LOG, "%s=%s", name, value); + yaz_log (YLOG_LOG, "%s=%s", name, value); } int main(int argc, char **argv) @@ -41,24 +41,24 @@ int main(int argc, char **argv) Res res; int write_flag = 0; - log_init (LOG_DEFAULT_LEVEL, prog, NULL); + log_init (YLOG_DEFAULT_LEVEL, prog, NULL); while ((ret = options ("wp:v", argv, argc, &arg)) != -2) if (ret == 0) resfile = arg; else if (ret == 'v') - log_init (LOG_ALL, prog, NULL); + log_init (YLOG_ALL, prog, NULL); else if (ret == 'p') prefix = arg; else if (ret == 'w') write_flag = 1; else { - logf (LOG_FATAL, "Unknown option '-%s'", arg); + yaz_log (YLOG_FATAL, "Unknown option '-%s'", arg); exit (1); } if (!resfile) { - logf (LOG_FATAL, "No resource file given."); + yaz_log (YLOG_FATAL, "No resource file given."); exit (1); } res = res_open (resfile); diff --git a/util/res.c b/util/res.c index 89ee5c6..6ce039c 100644 --- a/util/res.c +++ b/util/res.c @@ -1,4 +1,4 @@ -/* $Id: res.c,v 1.37 2004-07-26 13:59:25 adam Exp $ +/* $Id: res.c,v 1.38 2004-11-19 10:27:18 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -151,7 +151,7 @@ static void reread (Res r) fr = fopen (r->name, "r"); if (!fr) { - logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", r->name); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", r->name); return ; } val_buf = (char*) xmalloc (val_max); @@ -207,7 +207,7 @@ static void reread (Res r) val_size--; val_buf[val_size] = '\0'; resp->value = xstrdup_env(val_buf); - logf (LOG_DEBUG, "(name=%s,value=%s)", + yaz_log (YLOG_DEBUG, "(name=%s,value=%s)", resp->name, resp->value); break; } @@ -254,7 +254,7 @@ Res res_open (const char *name, Res def_res, Res over_res) if (access (name, R_OK)) #endif { - logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", name); + yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", name); return 0; } } @@ -340,7 +340,7 @@ const char *res_get_def (Res r, const char *name, const char *def) if (!(t = res_get (r, name))) { - logf (LOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def); + yaz_log (YLOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def); return def; } else @@ -416,7 +416,7 @@ int res_write (Res r) fr = fopen (r->name, "w"); if (!fr) { - logf (LOG_FATAL|LOG_ERRNO, "Cannot create `%s'", r->name); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Cannot create `%s'", r->name); exit (1); } diff --git a/util/zebramap.c b/util/zebramap.c index ab9ca86..df1a50c 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -1,4 +1,4 @@ -/* $Id: zebramap.c,v 1.34 2004-09-28 12:39:55 adam Exp $ +/* $Id: zebramap.c,v 1.35 2004-11-19 10:27:18 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -97,7 +97,7 @@ static void zebra_map_read (ZebraMaps zms, const char *name) if (!(f = yaz_fopen(zms->tabpath, name, "r", zms->tabroot))) { - logf(LOG_WARN|LOG_ERRNO, "%s", name); + yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", name); return ; } while ((argc = readconf_line(f, &lineno, line, 512, argv, 10))) @@ -156,7 +156,7 @@ static void zebra_map_read (ZebraMaps zms, const char *name) token->next = (*zm)->replace_tokens; (*zm)->replace_tokens = token; #if 0 - logf (LOG_LOG, "replace %s", argv[1]); + yaz_log (YLOG_LOG, "replace %s", argv[1]); #endif token->token_from = 0; if (argc >= 2) @@ -179,7 +179,7 @@ static void zebra_map_read (ZebraMaps zms, const char *name) { *dp++ = zebra_prim(&cp); #if 0 - logf (LOG_LOG, " char %2X %c", dp[-1], dp[-1]); + yaz_log (YLOG_LOG, " char %2X %c", dp[-1], dp[-1]); #endif } *dp = '\0'; @@ -262,7 +262,7 @@ chrmaptab zebra_charmap_get (ZebraMaps zms, unsigned reg_id) if (!zm) { zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(*zm)); - logf (LOG_WARN, "Unknown register type: %c", reg_id); + yaz_log (YLOG_WARN, "Unknown register type: %c", reg_id); zm->reg_id = reg_id; zm->maptab_name = nmem_strdup (zms->nmem, "@"); @@ -282,10 +282,10 @@ chrmaptab zebra_charmap_get (ZebraMaps zms, unsigned reg_id) if (!(zm->maptab = chrmaptab_create (zms->tabpath, zm->maptab_name, 0, zms->tabroot))) - logf(LOG_WARN, "Failed to read character table %s", + yaz_log(YLOG_WARN, "Failed to read character table %s", zm->maptab_name); else - logf(LOG_DEBUG, "Read character table %s", zm->maptab_name); + yaz_log(YLOG_DEBUG, "Read character table %s", zm->maptab_name); } return zm->maptab; } @@ -546,7 +546,7 @@ WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list, return zms->wrbuf_1; #if 0 - logf (LOG_LOG, "in:%.*s:", wrbuf_len(zms->wrbuf_1), + yaz_log (YLOG_LOG, "in:%.*s:", wrbuf_len(zms->wrbuf_1), wrbuf_buf(zms->wrbuf_1)); #endif for (;;) @@ -633,7 +633,7 @@ int zebra_replace_sub(ZebraMaps zms, unsigned reg_id, const char *ex_list, } } #if 0 - logf (LOG_LOG, "out:%.*s:", wrbuf_len(wrbuf), wrbuf_buf(wrbuf)); + yaz_log (YLOG_LOG, "out:%.*s:", wrbuf_len(wrbuf), wrbuf_buf(wrbuf)); #endif return no_replaces; } -- 1.7.10.4