|
|
argc--; | argc--; |
if (argc <= 0) | if (argc <= 0) |
FATAL("Expected -p <num>\n",""); | FATAL("Expected -p <num>\n",""); |
strcpy(pageno, *++argv); |
if (strlen(*++argv) >= sizeof(pageno)) |
|
FATAL("Page number too high\n",""); |
|
strcpy(pageno, *argv); |
init_page = TRUE; | init_page = TRUE; |
if (STREQ(pageno, EVEN)) { | if (STREQ(pageno, EVEN)) { |
log_given = TRUE; | log_given = TRUE; |
|
|
char tmp[STRING_MAX + 5]; | char tmp[STRING_MAX + 5]; |
| |
/* base set by last call to check_idx */ | /* base set by last call to check_idx */ |
sprintf (tmp, "%s%s", base, INDEX_STY); |
snprintf (tmp, sizeof(tmp), "%s%s", base, INDEX_STY); |
if (0 == access(tmp, R_OK)) { | if (0 == access(tmp, R_OK)) { |
open_sty (tmp); | open_sty (tmp); |
sty_given = TRUE; | sty_given = TRUE; |
|
|
STRING_MAX,totmem); | STRING_MAX,totmem); |
#endif /* DEBUG */ | #endif /* DEBUG */ |
| |
if ((idx_fn = (char *) malloc(STRING_MAX)) == NULL) |
if ((idx_fn = (char *) malloc(STRING_MAX+5)) == NULL) |
FATAL("Not enough core...abort.\n", ""); | FATAL("Not enough core...abort.\n", ""); |
sprintf(idx_fn, "%s%s", base, INDEX_IDX); |
snprintf(idx_fn, STRING_MAX+5, "%s%s", base, INDEX_IDX); |
if ((open_fn && | if ((open_fn && |
((idx_fp = OPEN_IN(idx_fn)) == NULL) | ((idx_fp = OPEN_IN(idx_fn)) == NULL) |
) || | ) || |
|
|
| |
/* index output file */ | /* index output file */ |
if (!ind_given) { | if (!ind_given) { |
sprintf(ind, "%s%s", base, INDEX_IND); |
snprintf(ind, sizeof(ind), "%s%s", base, INDEX_IND); |
ind_fn = ind; | ind_fn = ind; |
} | } |
if ((ind_fp = OPEN_OUT(ind_fn)) == NULL) | if ((ind_fp = OPEN_OUT(ind_fn)) == NULL) |
|
|
| |
/* index transcript file */ | /* index transcript file */ |
if (!ilg_given) { | if (!ilg_given) { |
sprintf(ilg, "%s%s", base, INDEX_ILG); |
snprintf(ilg, sizeof(ilg), "%s%s", base, INDEX_ILG); |
ilg_fn = ilg; | ilg_fn = ilg; |
} | } |
if ((ilg_fp = OPEN_OUT(ilg_fn)) == NULL) | if ((ilg_fp = OPEN_OUT(ilg_fn)) == NULL) |
FATAL("Can't create transcript file %s.\n", ilg_fn); | FATAL("Can't create transcript file %s.\n", ilg_fn); |
| |
if (log_given) { | if (log_given) { |
sprintf(log_fn, "%s%s", base, INDEX_LOG); |
snprintf(log_fn, sizeof(log_fn), "%s%s", base, INDEX_LOG); |
if ((log_fp = OPEN_IN(log_fn)) == NULL) { | if ((log_fp = OPEN_IN(log_fn)) == NULL) { |
FATAL("Source log file %s not found.\n", log_fn); | FATAL("Source log file %s not found.\n", log_fn); |
} else { | } else { |
|
|
if ((found = kpse_find_file (fn, kpse_ist_format, 1)) == NULL) { | if ((found = kpse_find_file (fn, kpse_ist_format, 1)) == NULL) { |
FATAL("Index style file %s not found.\n", fn); | FATAL("Index style file %s not found.\n", fn); |
} else { | } else { |
|
if (strlen(found) >= sizeof(sty_fn)) { |
|
FATAL("Style file %s too long.\n", found); |
|
} |
strcpy(sty_fn,found); | strcpy(sty_fn,found); |
if ((sty_fp = OPEN_IN(sty_fn)) == NULL) { | if ((sty_fp = OPEN_IN(sty_fn)) == NULL) { |
FATAL("Could not open style file %s.\n", sty_fn); | FATAL("Could not open style file %s.\n", sty_fn); |
|
|
} | } |
#else | #else |
if ((path = getenv(STYLE_PATH)) == NULL) { | if ((path = getenv(STYLE_PATH)) == NULL) { |
|
if (strlen(fn) >= sizeof(sty_fn)) { |
|
FATAL("Style file %s too long.\n", fn); |
|
} |
/* style input path not defined */ | /* style input path not defined */ |
strcpy(sty_fn, fn); | strcpy(sty_fn, fn); |
sty_fp = OPEN_IN(sty_fn); | sty_fp = OPEN_IN(sty_fn); |