aboutsummaryrefslogtreecommitdiffstats
path: root/z33.c
diff options
context:
space:
mode:
Diffstat (limited to 'z33.c')
-rw-r--r--z33.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/z33.c b/z33.c
index 3cc568e..c867838 100644
--- a/z33.c
+++ b/z33.c
@@ -848,6 +848,7 @@ BOOLEAN DbRetrieve(OBJECT db, BOOLEAN gall, OBJECT sym, FULL_CHAR *tag,
BOOLEAN DbRetrieveNext(OBJECT db, BOOLEAN *gall, OBJECT *sym, FULL_CHAR *tag,
FULL_CHAR *seq, FILE_NUM *dfnum, long *dfpos, int *dlnum, long *cont)
{ FULL_CHAR line[MAX_BUFF], *cline, fname[MAX_BUFF]; int symnum;
+ char format[MAX_FORMAT];
ifdebug(DPP, D, ProfileOn("DbRetrieveNext"));
debug2(DBS, DD, "DbRetrieveNext( %s, %ld )", string(db), *cont);
assert(reading(db), "DbRetrieveNext: not reading");
@@ -859,6 +860,8 @@ BOOLEAN DbRetrieveNext(OBJECT db, BOOLEAN *gall, OBJECT *sym, FULL_CHAR *tag,
return FALSE;
}
+ sprintf(format, "%%d&%%%d[^\t]\t%%%d[^\t]\t%%*[^\t]\t%%ld\t%%d\t%%%d[^\n\f]", MAX_BUFF-1, MAX_BUFF-1, MAX_BUFF-1);
+
if( in_memory(db) )
{
/* get next entry from internal database */
@@ -869,7 +872,7 @@ BOOLEAN DbRetrieveNext(OBJECT db, BOOLEAN *gall, OBJECT *sym, FULL_CHAR *tag,
}
cline = (FULL_CHAR *) db_lines(db)[*cont];
*gall = (cline[0] == '0' ? 1 : 0);
- sscanf((char *)&cline[*gall], "%d&%[^\t]\t%[^\t]\t%*[^\t]\t%ld\t%d\t%[^\n\f]",
+ sscanf((char *)&cline[*gall], format,
&symnum, tag, seq, dfpos, dlnum, fname);
*cont = *cont + 1;
}
@@ -883,7 +886,7 @@ BOOLEAN DbRetrieveNext(OBJECT db, BOOLEAN *gall, OBJECT *sym, FULL_CHAR *tag,
return FALSE;
}
*gall = (line[0] == '0' ? 1 : 0);
- sscanf((char *)&line[*gall], "%d&%[^\t]\t%[^\t]\t%*[^\t]\t%ld\t%d\t%[^\n\f]",
+ sscanf((char *)&line[*gall], format,
&symnum, tag, seq, dfpos, dlnum, fname);
*cont = ftell(db_filep(db));
}