X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=index%2Fkinput.c;h=7db3a017ad05adb3c4e4462246c1bc5d3f774c8e;hb=eb4e33573a00795f2b1c0dfebb51ab59ffd5a0d9;hp=9e6a773cb343c8c19baecf60e02eb07deb62ae44;hpb=b879b04a092d5b00cc866cf16f755e55053d2e89;p=idzebra-moved-to-github.git diff --git a/index/kinput.c b/index/kinput.c index 9e6a773..7db3a01 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -1,10 +1,19 @@ /* - * Copyright (C) 1995, Index Data I/S + * Copyright (C) 1994-1995, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: kinput.c,v $ - * Revision 1.2 1995-09-04 12:33:42 adam + * Revision 1.5 1995-09-29 14:01:43 adam + * Bug fixes. + * + * Revision 1.4 1995/09/28 14:22:57 adam + * Sort uses smaller temporary files. + * + * Revision 1.3 1995/09/06 16:11:17 adam + * Option: only one word key per file. + * + * Revision 1.2 1995/09/04 12:33:42 adam * Various cleanup. YAZ util used instead. * * Revision 1.1 1995/09/04 09:10:37 adam @@ -36,7 +45,6 @@ static int read_one (FILE *inf, char *name, char *key) { int c; int i = 0; - name[0] = 0; do { if ((c=getc(inf)) == EOF) @@ -59,6 +67,7 @@ static int inp (Dict dict, ISAM isam, const char *name) int key_buf_ptr; char *next_key; char *key_buf; + int more; next_key = xmalloc (KEY_SIZE); key_buf = xmalloc (key_buf_size * (KEY_SIZE)); @@ -67,16 +76,16 @@ static int inp (Dict dict, ISAM isam, const char *name) logf (LOG_FATAL|LOG_ERRNO, "cannot open `%s'", name); exit (1); } - read_one (inf, cur_name, key_buf); - while (cur_name[0]) /* EOF ? */ + more = read_one (inf, cur_name, key_buf); + while (more) /* EOF ? */ { int nmemb; key_buf_ptr = KEY_SIZE; while (1) { - if (!read_one (inf, next_name, next_key)) + if (!(more = read_one (inf, next_name, next_key))) break; - if (strcmp (next_name, cur_name)) + if (*next_name && strcmp (next_name, cur_name)) break; memcpy (key_buf + key_buf_ptr, next_key, KEY_SIZE); key_buf_ptr += KEY_SIZE; @@ -130,7 +139,7 @@ void key_input (const char *dict_fname, const char *isam_fname, logf (LOG_FATAL, "dict_open fail of `%s'", dict_fname); exit (1); } - isam = is_open (isam_fname, key_compare, 1); + isam = is_open (isam_fname, key_compare, 1, sizeof(struct it_key)); if (!isam) { logf (LOG_FATAL, "is_open fail of `%s'", isam_fname);