2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.50 1996-02-12 18:45:36 adam
8 * New fileVerboseFlag in record group control.
10 * Revision 1.49 1996/02/05 12:29:57 adam
11 * Logging reduced a bit.
12 * The remaining running time is estimated during register merge.
14 * Revision 1.48 1996/02/01 20:53:26 adam
15 * The temporary per-record keys are compacted a little, and duplication
16 * of the per-records keys are avoided when they are saved in the record
19 * Revision 1.47 1996/01/17 14:57:48 adam
20 * Prototype changed for reader functions in extract/retrieve. File
21 * is identified by 'void *' instead of 'int.
23 * Revision 1.46 1995/12/15 14:57:16 adam
26 * Revision 1.45 1995/12/15 12:37:41 adam
27 * In addRecordKeyAny: Writes key only when attrSet != -1.
29 * Revision 1.44 1995/12/12 16:00:54 adam
30 * System call sync(2) used after update/commit.
31 * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
34 * Revision 1.43 1995/12/11 09:12:46 adam
35 * The rec_get function returns NULL if record doesn't exist - will
36 * happen in the server if the result set records have been deleted since
37 * the creation of the set (i.e. the search).
38 * The server saves a result temporarily if it is 'volatile', i.e. the
39 * set is register dependent.
41 * Revision 1.42 1995/12/07 17:38:46 adam
42 * Work locking mechanisms for concurrent updates/commit.
44 * Revision 1.41 1995/12/06 16:06:42 adam
45 * Better diagnostics. Work on 'real' dictionary deletion.
47 * Revision 1.40 1995/12/05 16:57:40 adam
48 * More work on regular patterns.
50 * Revision 1.39 1995/12/05 13:20:18 adam
51 * Bug fix: file_read sometimes returned early EOF.
53 * Revision 1.38 1995/12/04 17:59:21 adam
54 * More work on regular expression conversion.
56 * Revision 1.37 1995/12/04 14:22:27 adam
57 * Extra arg to recType_byName.
58 * Started work on new regular expression parsed input to
61 * Revision 1.36 1995/11/30 08:34:29 adam
62 * Started work on commit facility.
63 * Changed a few malloc/free to xmalloc/xfree.
65 * Revision 1.35 1995/11/28 14:26:21 adam
66 * Bug fix: recordId with constant wasn't right.
67 * Bug fix: recordId dictionary entry wasn't deleted when needed.
69 * Revision 1.34 1995/11/28 09:09:38 adam
70 * Zebra config renamed.
71 * Use setting 'recordId' to identify record now.
72 * Bug fix in recindex.c: rec_release_blocks was invokeded even
73 * though the blocks were already released.
74 * File traversal properly deletes records when needed.
76 * Revision 1.33 1995/11/27 09:56:20 adam
77 * Record info elements better enumerated. Internal store of records.
79 * Revision 1.32 1995/11/25 10:24:05 adam
80 * More record fields - they are enumerated now.
81 * New options: flagStoreData flagStoreKey.
83 * Revision 1.31 1995/11/24 11:31:35 adam
84 * Commands add & del read filenames from stdin if source directory is
86 * Match criteria supports 'constant' strings.
88 * Revision 1.30 1995/11/22 17:19:16 adam
89 * Record management uses the bfile system.
91 * Revision 1.29 1995/11/21 15:01:14 adam
92 * New general match criteria implemented.
93 * New feature: document groups.
95 * Revision 1.28 1995/11/21 09:20:30 adam
96 * Yet more work on record match.
98 * Revision 1.27 1995/11/20 16:59:45 adam
99 * New update method: the 'old' keys are saved for each records.
101 * Revision 1.26 1995/11/20 11:56:24 adam
102 * Work on new traversal.
104 * Revision 1.25 1995/11/16 15:34:54 adam
105 * Uses new record management system in both indexer and server.
107 * Revision 1.24 1995/11/15 19:13:08 adam
108 * Work on record management.
110 * Revision 1.23 1995/10/27 14:00:10 adam
111 * Implemented detection of database availability.
113 * Revision 1.22 1995/10/17 18:02:07 adam
114 * New feature: databases. Implemented as prefix to words in dictionary.
116 * Revision 1.21 1995/10/10 12:24:38 adam
117 * Temporary sort files are compressed.
119 * Revision 1.20 1995/10/06 13:52:05 adam
120 * Bug fixes. Handler may abort further scanning.
122 * Revision 1.19 1995/10/04 12:55:16 adam
123 * Bug fix in ranked search. Use=Any keys inserted.
125 * Revision 1.18 1995/10/04 09:37:08 quinn
128 * Revision 1.17 1995/10/03 14:28:57 adam
129 * Buffered read in extract works.
131 * Revision 1.16 1995/10/03 14:28:45 adam
132 * Work on more effecient read handler in extract.
134 * Revision 1.15 1995/10/02 15:42:53 adam
135 * Extract uses file descriptors instead of FILE pointers.
137 * Revision 1.14 1995/10/02 15:29:13 adam
138 * More logging in file_extract.
140 * Revision 1.13 1995/09/29 14:01:39 adam
143 * Revision 1.12 1995/09/28 14:22:56 adam
144 * Sort uses smaller temporary files.
146 * Revision 1.11 1995/09/28 12:10:31 adam
147 * Bug fixes. Field prefix used in queries.
149 * Revision 1.10 1995/09/28 09:19:41 adam
150 * xfree/xmalloc used everywhere.
151 * Extract/retrieve method seems to work for text records.
153 * Revision 1.9 1995/09/27 12:22:28 adam
154 * More work on extract in record control.
155 * Field name is not in isam keys but in prefix in dictionary words.
157 * Revision 1.8 1995/09/14 07:48:22 adam
158 * Record control management.
160 * Revision 1.7 1995/09/11 13:09:32 adam
161 * More work on relevance feedback.
163 * Revision 1.6 1995/09/08 14:52:27 adam
164 * Minor changes. Dictionary is lower case now.
166 * Revision 1.5 1995/09/06 16:11:16 adam
167 * Option: only one word key per file.
169 * Revision 1.4 1995/09/05 15:28:39 adam
170 * More work on search engine.
172 * Revision 1.3 1995/09/04 12:33:41 adam
173 * Various cleanup. YAZ util used instead.
175 * Revision 1.2 1995/09/04 09:10:34 adam
176 * More work on index add/del/update.
177 * Merge sort implemented.
178 * Initial work on z39 server.
180 * Revision 1.1 1995/09/01 14:06:35 adam
181 * Split of work into more files.
190 #include <alexutil.h>
194 #include "recindex.h"
196 static Dict matchDict;
198 static Records records = NULL;
200 static char **key_buf;
201 static size_t ptr_top;
203 static size_t key_buf_used;
204 static int key_file_no;
206 static int records_inserted = 0;
207 static int records_updated = 0;
208 static int records_deleted = 0;
210 void key_open (int mem)
214 key_buf = xmalloc (mem);
215 ptr_top = mem/sizeof(char*);
221 if (!(matchDict = dict_open (GMATCH_DICT, 50, 1)))
223 logf (LOG_FATAL, "dict_open fail of %s", GMATCH_DICT);
227 records = rec_open (1);
236 void encode_key_init (struct encode_info *i)
242 char *encode_key_int (int d, char *bp)
251 else if (d <= 4194303)
253 *bp++ = 128 + (d>>16);
254 *bp++ = (d>>8) & 255;
259 *bp++ = 192 + (d>>24);
260 *bp++ = (d>>16) & 255;
261 *bp++ = (d>>8) & 255;
267 void encode_key_write (char *k, struct encode_info *i, FILE *outf)
272 while ((*bp++ = *k++))
274 memcpy (&key, k+1, sizeof(struct it_key));
275 bp = encode_key_int ( (key.sysno - i->sysno) * 2 + *k, bp);
276 if (i->sysno != key.sysno)
278 i->sysno = key.sysno;
281 bp = encode_key_int (key.seqno - i->seqno, bp);
282 i->seqno = key.seqno;
283 if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
285 logf (LOG_FATAL|LOG_ERRNO, "fwrite");
290 void key_flush (void)
295 struct encode_info encode_info;
301 logf (LOG_LOG, "sorting section %d", key_file_no);
302 qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
303 sprintf (out_fname, TEMP_FNAME, key_file_no);
305 if (!(outf = fopen (out_fname, "w")))
307 logf (LOG_FATAL|LOG_ERRNO, "fopen (4) %s", out_fname);
310 logf (LOG_LOG, "writing section %d", key_file_no);
311 prevcp = cp = key_buf[ptr_top-ptr_i];
313 encode_key_init (&encode_info);
314 encode_key_write (cp, &encode_info, outf);
317 cp = key_buf[ptr_top-ptr_i];
318 if (strcmp (cp, prevcp))
320 encode_key_init (&encode_info);
321 encode_key_write (cp, &encode_info, outf);
325 encode_key_write (cp + strlen(cp), &encode_info, outf);
329 logf (LOG_FATAL|LOG_ERRNO, "fclose %s", out_fname);
332 logf (LOG_LOG, "finished section %d", key_file_no);
341 rec_close (&records);
342 dict_close (matchDict);
344 logf (LOG_LOG, "Records inserted %6d", records_inserted);
345 logf (LOG_LOG, "Records updated %6d", records_updated);
346 logf (LOG_LOG, "Records deleted %6d", records_deleted);
350 static void wordInit (RecWord *p)
354 p->which = Word_String;
365 static void addRecordKey (const RecWord *p)
373 if (reckeys.buf_used+1024 > reckeys.buf_max)
377 b = xmalloc (reckeys.buf_max += 128000);
378 if (reckeys.buf_used > 0)
379 memcpy (b, reckeys.buf, reckeys.buf_used);
383 dst = reckeys.buf + reckeys.buf_used;
385 attrSet = p->attrSet;
386 if (reckeys.buf_used > 0 && reckeys.prevAttrSet == attrSet)
389 reckeys.prevAttrSet = attrSet;
390 attrUse = p->attrUse;
391 if (reckeys.buf_used > 0 && reckeys.prevAttrUse == attrUse)
394 reckeys.prevAttrUse = attrUse;
403 memcpy (dst, &attrSet, sizeof(attrSet));
404 dst += sizeof(attrSet);
408 memcpy (dst, &attrUse, sizeof(attrUse));
409 dst += sizeof(attrUse);
411 for (i = 0; p->u.string[i]; i++)
412 *dst++ = p->u.string[i];
415 memcpy (dst, &p->seqno, sizeof(p->seqno));
416 dst += sizeof(p->seqno);
422 reckeys.buf_used = dst - reckeys.buf;
425 static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys,
426 const char *databaseName)
431 while (off < reckeys->buf_used)
433 const char *src = reckeys->buf + off;
441 memcpy (&attrSet, src, sizeof(attrSet));
442 src += sizeof(attrSet);
446 memcpy (&attrUse, src, sizeof(attrUse));
447 src += sizeof(attrUse);
449 if (key_buf_used + 1024 > (ptr_top-ptr_i)*sizeof(char*))
452 key_buf[ptr_top-ptr_i] = (char*)key_buf + key_buf_used;
453 key_buf_used += index_word_prefix ((char*)key_buf + key_buf_used,
454 attrSet, attrUse, databaseName);
456 ((char*)key_buf) [key_buf_used++] = index_char_cvt (*src++);
458 ((char*)key_buf) [key_buf_used++] = '\0';
460 ((char*) key_buf)[key_buf_used++] = cmd;
462 memcpy (&key.seqno, src, sizeof(key.seqno));
463 src += sizeof(key.seqno);
465 memcpy ((char*)key_buf + key_buf_used, &key, sizeof(key));
466 key_buf_used += sizeof(key);
467 off = src - reckeys->buf;
469 assert (off == reckeys->buf_used);
472 static const char **searchRecordKey (struct recKeys *reckeys,
473 int attrSetS, int attrUseS)
475 static const char *ws[32];
480 for (i = 0; i<32; i++)
483 while (off < reckeys->buf_used)
485 const char *src = reckeys->buf + off;
491 memcpy (&attrSet, src, sizeof(attrSet));
492 src += sizeof(attrSet);
494 memcpy (&attrUse, src, sizeof(attrUse));
495 src += sizeof(attrUse);
501 memcpy (&seqno, src, sizeof(seqno));
502 src += sizeof(seqno);
505 logf (LOG_LOG, "(%d,%d) %d %s", attrSet, attrUse, seqno, wstart);
507 if (attrUseS == attrUse && attrSetS == attrSet)
514 woff = seqno - startSeq;
515 if (woff >= 0 && woff < 31)
519 off = src - reckeys->buf;
521 assert (off == reckeys->buf_used);
525 static void addRecordKeyAny (const RecWord *p)
527 if (p->attrSet != 1 || p->attrUse != 1016)
531 memcpy (&w, p, sizeof(w));
536 if (p->attrSet != -1)
540 #define FILE_READ_BUFSIZE 4096
541 struct file_read_info {
544 #if FILE_READ_BUFSIZE
551 static struct file_read_info *file_read_start (int fd)
553 struct file_read_info *fi = xmalloc (sizeof(*fi));
557 #if FILE_READ_BUFSIZE
559 fi->file_buf = xmalloc (FILE_READ_BUFSIZE);
560 fi->file_bufsize = read (fd, fi->file_buf, FILE_READ_BUFSIZE);
565 static void file_read_stop (struct file_read_info *fi)
568 #if FILE_READ_BUFSIZE
569 xfree (fi->file_buf);
575 static int file_read (void *handle, char *buf, size_t count)
577 struct file_read_info *p = handle;
579 #if FILE_READ_BUFSIZE
580 int l = p->file_bufsize - p->file_offset;
586 memcpy (buf, p->file_buf + p->file_offset, l);
588 if (count > FILE_READ_BUFSIZE)
590 if ((r = read (fd, buf + l, count)) == -1)
592 logf (LOG_FATAL|LOG_ERRNO, "read");
597 p->file_noread += l+r;
600 p->file_bufsize = r = read (fd, p->file_buf, FILE_READ_BUFSIZE);
603 logf (LOG_FATAL|LOG_ERRNO, "read");
609 memcpy (buf + l, p->file_buf, r);
610 p->file_noread += l+r;
615 p->file_offset = count;
616 memcpy (buf + l, p->file_buf, count - l);
617 p->file_noread += count;
621 memcpy (buf, p->file_buf + p->file_offset, count);
622 p->file_offset += count;
623 p->file_noread += count;
627 r = read (fd, buf, count);
634 static int atois (const char **s)
637 while ( (c=**s) >= '0' && c <= '9')
639 val = val*10 + c - '0';
645 static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
649 static char dstBuf[2048];
651 const char *s = spec;
652 static const char **w;
657 while (*s == ' ' || *s == '\t')
664 int attrSet, attrUse;
668 attrSet = atois (&s);
671 logf (LOG_WARN, "Missing , in match criteria %s in group %s",
672 spec, rGroup->groupName ? rGroup->groupName : "none");
676 attrUse = atois (&s);
677 w = searchRecordKey (reckeys, attrSet, attrUse);
682 for (i = 0; i<32; i++)
687 logf (LOG_WARN, "Missing ) in match criteria %s in group %s",
688 spec, rGroup->groupName ? rGroup->groupName : "none");
693 for (i = 0; i<32; i++)
694 if (matchFlag[i] && w[i])
706 logf (LOG_WARN, "Record didn't contain match"
707 " fields in (%d,%d)", attrSet, attrUse);
715 const char *spec_src = NULL;
716 const char *s1 = ++s;
717 while (*s1 && *s1 != ' ' && *s1 != '\t')
723 memcpy (special, s, spec_len);
724 special[spec_len] = '\0';
727 if (!strcmp (special, "group"))
728 spec_src = rGroup->groupName;
729 else if (!strcmp (special, "database"))
730 spec_src = rGroup->databaseName;
731 else if (!strcmp (special, "filename"))
733 else if (!strcmp (special, "type"))
734 spec_src = rGroup->recordType;
739 strcpy (dst, spec_src);
740 dst += strlen (spec_src);
743 else if (*s == '\"' || *s == '\'')
745 int stopMarker = *s++;
749 while (*s && *s != stopMarker)
752 tmpString[i++] = *s++;
757 strcpy (dst, tmpString);
758 dst += strlen (tmpString);
762 logf (LOG_WARN, "Syntax error in match criteria %s in group %s",
763 spec, rGroup->groupName ? rGroup->groupName : "none");
770 logf (LOG_WARN, "No match criteria for record %s in group %s",
771 fname, rGroup->groupName ? rGroup->groupName : "none");
777 struct recordLogInfo {
780 struct recordGroup *rGroup;
783 static void recordLogPreamble (int level, const char *msg, void *info)
785 struct recordLogInfo *p = info;
786 FILE *outf = log_file ();
791 fprintf (outf, "%s of ", p->op);
792 fprintf (outf, "%s type %s\n", p->rGroup->recordType, p->fname);
793 log_event_start (NULL, NULL);
796 static int recordExtract (SYSNO *sysno, const char *fname,
797 struct recordGroup *rGroup, int deleteFlag,
798 struct file_read_info *fi, RecType recType,
801 struct recExtractCtrl extractCtrl;
806 struct recordLogInfo logInfo;
808 logInfo.fname = fname;
810 logInfo.rGroup = rGroup;
811 log_event_start (recordLogPreamble, &logInfo);
817 extractCtrl.subType = subType;
818 extractCtrl.init = wordInit;
819 extractCtrl.add = addRecordKeyAny;
821 reckeys.buf_used = 0;
822 reckeys.prevAttrUse = -1;
823 reckeys.prevAttrSet = -1;
824 extractCtrl.readf = file_read;
825 r = (*recType->extract)(&extractCtrl);
829 logf (LOG_WARN, "Couldn't extract file %s, code %d", fname, r);
834 /* perform match if sysno not known and if match criteria is specified */
841 if (rGroup->recordId && *rGroup->recordId)
845 matchStr = fileMatchStr (&reckeys, rGroup, fname,
849 rinfo = dict_lookup (matchDict, matchStr);
851 memcpy (sysno, rinfo+1, sizeof(*sysno));
855 logf (LOG_WARN, "Bad match criteria");
866 logf (LOG_LOG, "Cannot delete new record");
870 if (rGroup->fileVerboseFlag)
871 logf (LOG_LOG, "add %s %s", rGroup->recordType, fname);
872 rec = rec_new (records);
877 dict_insert (matchDict, matchStr, sizeof(*sysno), sysno);
879 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
885 struct recKeys delkeys;
887 rec = rec_get (records, *sysno);
889 delkeys.buf_used = rec->size[recInfo_delKeys];
890 delkeys.buf = rec->info[recInfo_delKeys];
891 flushRecordKeys (*sysno, 0, &delkeys, rec->info[recInfo_databaseName]);
894 logInfo.op = "delete";
895 if (!delkeys.buf_used)
897 logf (LOG_WARN, "cannot delete; storeKeys false");
901 if (rGroup->fileVerboseFlag)
902 logf (LOG_LOG, "delete %s %s", rGroup->recordType, fname);
905 dict_delete (matchDict, matchStr);
906 rec_del (records, &rec);
912 logInfo.op = "update";
913 if (!delkeys.buf_used)
915 logf (LOG_WARN, "cannot update; storeKeys false");
919 if (rGroup->fileVerboseFlag)
920 logf (LOG_LOG, "update %s %s", rGroup->recordType, fname);
921 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
926 xfree (rec->info[recInfo_fileType]);
927 rec->info[recInfo_fileType] =
928 rec_strdup (rGroup->recordType, &rec->size[recInfo_fileType]);
930 xfree (rec->info[recInfo_filename]);
931 rec->info[recInfo_filename] =
932 rec_strdup (fname, &rec->size[recInfo_filename]);
934 xfree (rec->info[recInfo_delKeys]);
935 if (reckeys.buf_used > 0 && rGroup->flagStoreKeys == 1)
938 rec->size[recInfo_delKeys] = reckeys.buf_used;
939 rec->info[recInfo_delKeys] = reckeys.buf;
943 rec->info[recInfo_delKeys] = xmalloc (reckeys.buf_used);
944 rec->size[recInfo_delKeys] = reckeys.buf_used;
945 memcpy (rec->info[recInfo_delKeys], reckeys.buf,
946 rec->size[recInfo_delKeys]);
951 rec->info[recInfo_delKeys] = NULL;
952 rec->size[recInfo_delKeys] = 0;
955 xfree (rec->info[recInfo_storeData]);
956 if (rGroup->flagStoreData == 1)
958 rec->size[recInfo_storeData] = fi->file_noread;
959 rec->info[recInfo_storeData] = xmalloc (fi->file_noread);
960 #if FILE_READ_BUFSIZE
961 if (fi->file_noread < FILE_READ_BUFSIZE)
962 memcpy (rec->info[recInfo_storeData], fi->file_buf,
967 if (lseek (fi->fd, 0L, SEEK_SET) < 0)
969 logf (LOG_ERRNO|LOG_FATAL, "seek to 0 in %s", fname);
972 if (read (fi->fd, rec->info[recInfo_storeData], fi->file_noread)
975 logf (LOG_ERRNO|LOG_FATAL, "read %d bytes of %s",
976 fi->file_noread, fname);
983 rec->info[recInfo_storeData] = NULL;
984 rec->size[recInfo_storeData] = 0;
986 xfree (rec->info[recInfo_databaseName]);
987 rec->info[recInfo_databaseName] =
988 rec_strdup (rGroup->databaseName, &rec->size[recInfo_databaseName]);
990 rec_put (records, &rec);
991 log_event_start (NULL, NULL);
995 int fileExtract (SYSNO *sysno, const char *fname,
996 const struct recordGroup *rGroupP, int deleteFlag)
1004 struct recordGroup rGroupM;
1005 struct recordGroup *rGroup = &rGroupM;
1006 struct file_read_info *fi;
1008 memcpy (rGroup, rGroupP, sizeof(*rGroupP));
1010 if (!rGroup->groupName || !*rGroup->groupName)
1013 sprintf (gprefix, "%s.", rGroup->groupName);
1015 logf (LOG_DEBUG, "fileExtract %s", fname);
1017 /* determine file extension */
1018 for (i = strlen(fname); --i >= 0; )
1019 if (fname[i] == '/')
1024 else if (fname[i] == '.')
1026 strcpy (ext, fname+i+1);
1029 /* determine file type - depending on extension */
1030 if (!rGroup->recordType)
1032 sprintf (ext_res, "%srecordType.%s", gprefix, ext);
1033 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1035 sprintf (ext_res, "%srecordType", gprefix);
1036 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1038 if (rGroup->fileVerboseFlag)
1039 logf (LOG_LOG, "? %s", fname);
1044 if (!rGroup->recordType)
1046 if (rGroup->fileVerboseFlag)
1047 logf (LOG_LOG, "? record %s", fname);
1050 if (!(recType = recType_byName (rGroup->recordType, subType)))
1052 logf (LOG_WARN, "No such record type: %s", rGroup->recordType);
1056 /* determine match criteria */
1057 if (!rGroup->recordId)
1059 sprintf (ext_res, "%srecordId.%s", gprefix, ext);
1060 rGroup->recordId = res_get (common_resource, ext_res);
1063 /* determine database name */
1064 if (!rGroup->databaseName)
1066 sprintf (ext_res, "%sdatabase.%s", gprefix, ext);
1067 if (!(rGroup->databaseName = res_get (common_resource, ext_res)))
1069 sprintf (ext_res, "%sdatabase", gprefix);
1070 rGroup->databaseName = res_get (common_resource, ext_res);
1073 if (!rGroup->databaseName)
1074 rGroup->databaseName = "Default";
1076 if (rGroup->flagStoreData == -1)
1079 sprintf (ext_res, "%sstoreData.%s", gprefix, ext);
1080 if (!(sval = res_get (common_resource, ext_res)))
1082 sprintf (ext_res, "%sstoreData", gprefix);
1083 sval = res_get (common_resource, ext_res);
1086 rGroup->flagStoreData = atoi (sval);
1088 if (rGroup->flagStoreData == -1)
1089 rGroup->flagStoreData = 0;
1091 if (rGroup->flagStoreKeys == -1)
1095 sprintf (ext_res, "%sstoreKeys.%s", gprefix, ext);
1096 if (!(sval = res_get (common_resource, ext_res)))
1098 sprintf (ext_res, "%sstoreKeys", gprefix);
1099 sval = res_get (common_resource, ext_res);
1102 rGroup->flagStoreKeys = atoi (sval);
1104 if (rGroup->flagStoreKeys == -1)
1105 rGroup->flagStoreKeys = 0;
1107 if (sysno && deleteFlag)
1111 if ((fd = open (fname, O_RDONLY)) == -1)
1113 logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
1117 fi = file_read_start (fd);
1118 recordExtract (sysno, fname, rGroup, deleteFlag, fi, recType, subType);
1119 file_read_stop (fi);