| 1 |
/* |
| 2 |
* |
| 3 |
* This file is part of |
| 4 |
* MakeIndex - A formatter and format independent index processor |
| 5 |
* |
| 6 |
* Copyright (C) 1998-2026 by the TeX Live project. |
| 7 |
* Copyright (C) 1989 by Chen & Harrison International Systems, Inc. |
| 8 |
* Copyright (C) 1988 by Olivetti Research Center |
| 9 |
* Copyright (C) 1987 by Regents of the University of California |
| 10 |
* |
| 11 |
* Author: |
| 12 |
* Pehong Chen |
| 13 |
* Chen & Harrison International Systems, Inc. |
| 14 |
* Palo Alto, California |
| 15 |
* USA |
| 16 |
* |
| 17 |
* Contributors: |
| 18 |
* Please refer to the CONTRIB file that comes with this release |
| 19 |
* for a list of people who have contributed to this and/or previous |
| 20 |
* release(s) of MakeIndex. |
| 21 |
* |
| 22 |
* All rights reserved by the copyright holders. See the copyright |
| 23 |
* notice distributed with this software for a complete description of |
| 24 |
* the conditions under which it is made available. |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
#include <c-auto.h> |
| 29 |
|
| 30 |
/*********************************************************************** |
| 31 |
|
| 32 |
INSTALLATION NOTES |
| 33 |
<11-Nov-1989> |
| 34 |
|
| 35 |
At compile-time (or here, if compile-time definition is not |
| 36 |
available), set non-zero ONE OS_xxxx operating system flag, and if |
| 37 |
more than one compiler is available, ONE compiler flag: |
| 38 |
|
| 39 |
Operating Systems Compiler(s) |
| 40 |
================= =========== |
| 41 |
OS_ATARI |
| 42 |
OS_BS2000 CCD_2000 |
| 43 |
OS_BSD |
| 44 |
OS_MVSXA IBM_C370 |
| 45 |
OS_VMCMS IBM_C370 |
| 46 |
OS_PCDOS IBM_PC_MICROSOFT |
| 47 |
OS_SYSV |
| 48 |
OS_TOPS20 KCC_20 or PCC_20 |
| 49 |
OS_VAXVMS |
| 50 |
OS_XENIX |
| 51 |
================= =========== |
| 52 |
|
| 53 |
If no OS_xxxx symbol is defined, OS_BSD is assumed. |
| 54 |
|
| 55 |
Standard C prototypes are now required. |
| 56 |
|
| 57 |
All function declarations in MakeIndex are contained at the end of |
| 58 |
this file. |
| 59 |
|
| 60 |
If the host system restricts external names to 6 characters, set |
| 61 |
SHORTNAMES non-zero in the appropriate OS_xxxx section below. |
| 62 |
|
| 63 |
Installing MakeIndex under BS2000 requires at least Version 8.5 |
| 64 |
supporting Multiple Public Volume Sets (MPVS). Define WORK in this |
| 65 |
file to your CATID (default :w:) for temporary files (.ilg, .ind), |
| 66 |
in case of no MPVS support define WORK to NIL. |
| 67 |
|
| 68 |
*/ |
| 69 |
|
| 70 |
/**********************************************************************/ |
| 71 |
|
| 72 |
/* |
| 73 |
* Establish needed operating symbols (defaulting to OS_BSD if none |
| 74 |
* specified at compile time). If you add one, add it to the check |
| 75 |
* list at the end of this section, too. |
| 76 |
*/ |
| 77 |
|
| 78 |
#define SHORTNAMES 0 |
| 79 |
|
| 80 |
/**********************************************************************/ |
| 81 |
|
| 82 |
#ifndef USE_KPATHSEA |
| 83 |
#define USE_KPATHSEA 1 |
| 84 |
#endif |
| 85 |
|
| 86 |
#if USE_KPATHSEA |
| 87 |
#ifndef DEBUG /* strange logic: makeindex uses DEBUG to force debugging */ |
| 88 |
#define NO_DEBUG 1 /* kpathsea uses NO_DEBUG to suppress it. */ |
| 89 |
#endif |
| 90 |
#include <kpathsea/config.h> |
| 91 |
#include <kpathsea/c-limits.h> |
| 92 |
#include <kpathsea/c-memstr.h> |
| 93 |
#include <kpathsea/magstep.h> |
| 94 |
#include <kpathsea/proginit.h> |
| 95 |
#include <kpathsea/progname.h> |
| 96 |
#include <kpathsea/tex-glyph.h> |
| 97 |
#include <kpathsea/expand.h> |
| 98 |
#endif |
| 99 |
|
| 100 |
#include <stdio.h> |
| 101 |
|
| 102 |
#ifdef HAVE_CTYPE_H |
| 103 |
#include <ctype.h> |
| 104 |
#endif |
| 105 |
|
| 106 |
#ifndef HAVE_STRCHR |
| 107 |
#define strchr index /* convert STDC form to old K&R form */ |
| 108 |
#endif |
| 109 |
|
| 110 |
#ifndef HAVE_STRRCHR |
| 111 |
#define strrchr rindex /* convert STDC form to old K&R form */ |
| 112 |
#endif |
| 113 |
|
| 114 |
#ifdef HAVE_STRING_H |
| 115 |
#include <string.h> |
| 116 |
#else |
| 117 |
#ifdef HAVE_STRINGS_H |
| 118 |
#include <string.h> |
| 119 |
#endif |
| 120 |
#endif |
| 121 |
|
| 122 |
#ifdef HAVE_TYPES_H |
| 123 |
#include <types.h> |
| 124 |
#endif |
| 125 |
|
| 126 |
#if SHORTNAMES |
| 127 |
/* |
| 128 |
* Provide alternate external names which are unique in the first SIX |
| 129 |
* characters as required for portability (and Standard C) |
| 130 |
*/ |
| 131 |
#define check_all chk_all |
| 132 |
#define check_idx chk_idx |
| 133 |
#define check_mixsym chk_mix |
| 134 |
#define compare_one cmp_one |
| 135 |
#define compare_page cmp_page |
| 136 |
#define compare_string cmp_string |
| 137 |
#define delim_n dlm_n |
| 138 |
#define delim_p dlm_p |
| 139 |
#define delim_r dlm_r |
| 140 |
#define delim_t dlm_t |
| 141 |
#define encap_i ecp_i |
| 142 |
#define encap_p ecp_p |
| 143 |
#define encap_range ecp_range |
| 144 |
#define encap_s ecp_s |
| 145 |
#define group_skip grp_skip |
| 146 |
#define group_type grp_type |
| 147 |
#define idx_aclose idxaclose |
| 148 |
#define idx_actual idxactual |
| 149 |
#define idx_keyword idx_kwd |
| 150 |
#define indent_length ind_length |
| 151 |
#define indent_space ind_space |
| 152 |
#define headings_flag hd_flag |
| 153 |
#define heading_pre hd_pre |
| 154 |
#define heading_suf hd_suf |
| 155 |
#define symhead_pos sym_pos |
| 156 |
#define symhead_neg sym_neg |
| 157 |
#define numhead_pos num_pos |
| 158 |
#define numhead_neg num_neg |
| 159 |
#define process_idx prc_idx |
| 160 |
#define process_precedence prc_pre |
| 161 |
#define range_ptr rng_ptr |
| 162 |
#define scan_alpha_lower scnalw |
| 163 |
#define scan_alpha_upper scnaup |
| 164 |
#define scan_arabic scnarabic |
| 165 |
#define scan_arg1 scna1 |
| 166 |
#define scan_arg2 scna2 |
| 167 |
#define scan_char scnchr |
| 168 |
#define scan_field scnfld |
| 169 |
#define scan_idx scnidx |
| 170 |
#define scan_key scnkey |
| 171 |
#define scan_no scnno |
| 172 |
#define scan_roman_lower scnrlw |
| 173 |
#define scan_roman_upper scnrup |
| 174 |
#define scan_spec scnspc |
| 175 |
#define scan_string scnstr |
| 176 |
#define scan_style scnsty |
| 177 |
#define setpagelen spg_len |
| 178 |
#define setpage_close spg_close |
| 179 |
#define setpage_open spg_open |
| 180 |
#define suffix_2p suf_2p |
| 181 |
#define suffix_3p suf_3p |
| 182 |
#define suffix_mp suf_mp |
| 183 |
#endif /* SHORTNAMES */ |
| 184 |
|
| 185 |
#define EXIT exit |
| 186 |
|
| 187 |
#undef TRUE |
| 188 |
#define TRUE 1 |
| 189 |
|
| 190 |
#undef FALSE |
| 191 |
#define FALSE 0 |
| 192 |
|
| 193 |
#undef NUL |
| 194 |
#define NUL '\0' |
| 195 |
|
| 196 |
#undef NIL |
| 197 |
#define NIL "" |
| 198 |
|
| 199 |
#define TAB '\t' |
| 200 |
#define LFD '\n' |
| 201 |
#define SPC ' ' |
| 202 |
#define LSQ '[' |
| 203 |
#define RSQ ']' |
| 204 |
#define BSH '\\' |
| 205 |
|
| 206 |
#ifdef DOSISH |
| 207 |
#define ENV_SEPAR ';' |
| 208 |
#define DIR_DELIM '/' |
| 209 |
#define ALT_DIR_DELIM '\\' |
| 210 |
#define IS_DIR_DELIM(c) ((c) == DIR_DELIM || (c) == ALT_DIR_DELIM) |
| 211 |
#else /* not DOSISH */ |
| 212 |
#define ENV_SEPAR ':' |
| 213 |
#define DIR_DELIM '/' |
| 214 |
#define IS_DIR_DELIM(c) ((c) == DIR_DELIM) |
| 215 |
#endif /* not DOSISH */ |
| 216 |
|
| 217 |
#ifndef SW_PREFIX /* can override at compile time */ |
| 218 |
#define SW_PREFIX '-' |
| 219 |
#endif |
| 220 |
|
| 221 |
#define EXT_DELIM '.' |
| 222 |
#define ROMAN_SIGN '*' |
| 223 |
#define EVEN "even" |
| 224 |
#define ODD "odd" |
| 225 |
#define ANY "any" |
| 226 |
|
| 227 |
extern int mk_getc (FILE *str); /* line endings patch */ |
| 228 |
#define GET_CHAR mk_getc |
| 229 |
|
| 230 |
#define TOASCII(i) (char)((i) + 48) |
| 231 |
|
| 232 |
/* NB: The typecasts here are CRITICAL for correct sorting of entries |
| 233 |
that use characters in the range 128..255! */ |
| 234 |
#define TOLOWER(C) (isupper((unsigned char)(C)) ? \ |
| 235 |
(unsigned char)tolower((unsigned char)(C)) : (unsigned char)(C)) |
| 236 |
#define TOUPPER(C) (isupper((unsigned char)(C)) ? \ |
| 237 |
(unsigned char)(C) : (unsigned char)toupper((unsigned char)(C))) |
| 238 |
|
| 239 |
#if USE_KPATHSEA /* kpathsea defines STREQ */ |
| 240 |
#undef STREQ |
| 241 |
#undef STRNEQ |
| 242 |
#endif |
| 243 |
|
| 244 |
#define STREQ(A, B) (strcmp(A, B) == 0) |
| 245 |
#define STRNEQ(A, B) (strcmp(A, B) != 0) |
| 246 |
|
| 247 |
#define MESSAGE(F) { \ |
| 248 |
if (verbose) \ |
| 249 |
fprintf(stderr, F); \ |
| 250 |
fprintf(ilg_fp, F); \ |
| 251 |
} |
| 252 |
|
| 253 |
#define MESSAGE1(F, S) { \ |
| 254 |
if (verbose) \ |
| 255 |
fprintf(stderr, F, S); \ |
| 256 |
fprintf(ilg_fp, F, S); \ |
| 257 |
} |
| 258 |
|
| 259 |
#if USE_KPATHSEA /* kpathsea defines a different FATAL */ |
| 260 |
#undef FATAL |
| 261 |
#endif |
| 262 |
|
| 263 |
#define FATAL(F) { \ |
| 264 |
fprintf(stderr, F); \ |
| 265 |
fprintf(stderr, USAGE, pgm_fn); \ |
| 266 |
EXIT(1); \ |
| 267 |
} |
| 268 |
|
| 269 |
#if USE_KPATHSEA /* kpathsea defines a different FATAL1 */ |
| 270 |
#undef FATAL1 |
| 271 |
#endif |
| 272 |
|
| 273 |
#define FATAL1(F, S) { \ |
| 274 |
fprintf(stderr, F, S); \ |
| 275 |
fprintf(stderr, USAGE, pgm_fn); \ |
| 276 |
EXIT(1); \ |
| 277 |
} |
| 278 |
|
| 279 |
#if USE_KPATHSEA /* kpathsea defines a different FATAL2 */ |
| 280 |
#undef FATAL2 |
| 281 |
#endif |
| 282 |
|
| 283 |
#define FATAL2(F, D1, D2) { \ |
| 284 |
fprintf(stderr, F, D1, D2); \ |
| 285 |
fprintf(stderr, USAGE, pgm_fn); \ |
| 286 |
EXIT(1); \ |
| 287 |
} |
| 288 |
|
| 289 |
#define OPEN_IN(FP) fopen(FP, "rb") |
| 290 |
#define OPEN_OUT(FP) fopen(FP, "wb") |
| 291 |
#define CLOSE(FP) fclose(FP) |
| 292 |
|
| 293 |
#define ISDIGIT(C) ('0' <= C && C <= '9') |
| 294 |
#define ISSYMBOL(C) (('!' <= C && C <= '@') || \ |
| 295 |
('[' <= C && C <= '`') || \ |
| 296 |
('{' <= C && C <= '~')) |
| 297 |
|
| 298 |
/*==================================================================== |
| 299 |
Many arrays in MakeIndex are dimensioned [xxx_MAX], where the xxx_MAX |
| 300 |
values are defined below. The use of each of these is described in |
| 301 |
comments. However, no run-time check is made to ensure that these are |
| 302 |
consistent, or reasonable! Therefore, change them only with great |
| 303 |
care. |
| 304 |
|
| 305 |
If any array overflows, please report to [email protected]. |
| 306 |
======================================================================*/ |
| 307 |
|
| 308 |
#define ARABIC_MAX 99 /* maximum digits in an Arabic page */ |
| 309 |
/* number field */ |
| 310 |
|
| 311 |
#define ARGUMENT_MAX 10240 /* maximum length of sort or actual key */ |
| 312 |
/* in index entry */ |
| 313 |
|
| 314 |
#define ARRAY_MAX 1024 /* maximum length of constant values in */ |
| 315 |
/* style file */ |
| 316 |
|
| 317 |
#define FIELD_MAX 3 /* maximum levels of index entries (item, */ |
| 318 |
/* subitem, subsubitem); cannot be */ |
| 319 |
/* increased beyond 3 without */ |
| 320 |
/* significant design changes (no field */ |
| 321 |
/* names are known beyond 3 levels) */ |
| 322 |
|
| 323 |
#ifdef LINE_MAX /* IBM RS/6000 AIX has this in <sys/limits.h> */ |
| 324 |
#undef LINE_MAX |
| 325 |
#endif |
| 326 |
#define LINE_MAX 72 /* maximum output line length (longer */ |
| 327 |
/* ones wrap if possible) */ |
| 328 |
|
| 329 |
#define NUMBER_MAX 99 /* maximum digits in a Roman or Arabic */ |
| 330 |
/* page number */ |
| 331 |
/* (MAX(ARABIC_MAX,ROMAN_MAX)) */ |
| 332 |
|
| 333 |
#define PAGEFIELD_MAX 10 /* maximum fields in a composite page */ |
| 334 |
/* number */ |
| 335 |
|
| 336 |
#define PAGETYPE_MAX 5 /* fixed at 5; see use in scanst.c */ |
| 337 |
|
| 338 |
#define ROMAN_MAX 99 /* maximum length of Roman page number */ |
| 339 |
/* field */ |
| 340 |
|
| 341 |
#define STRING_MAX 999 /* maximum length of host filename */ |
| 342 |
|
| 343 |
/*====================================================================*/ |
| 344 |
|
| 345 |
#if USE_KPATHSEA |
| 346 |
#define VERSION "version 2.18 [TeX Live " TEX_LIVE_VERSION "] (kpathsea + Thai support)" |
| 347 |
#else |
| 348 |
#define VERSION "version 2.18 [12-Jan-2026] (with Thai support)" |
| 349 |
#endif |
| 350 |
|
| 351 |
#define PUT_VERSION { \ |
| 352 |
MESSAGE1("This is %s, ", pgm_fn); \ |
| 353 |
MESSAGE1("%s.\n", VERSION); \ |
| 354 |
need_version = FALSE; \ |
| 355 |
} |
| 356 |
|
| 357 |
#ifdef HAVE_SETLOCALE |
| 358 |
#define USAGE \ |
| 359 |
"Usage: %s [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]\n" |
| 360 |
#else |
| 361 |
#define USAGE \ |
| 362 |
"Usage: %s [-ilqrcg] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]\n" |
| 363 |
#endif |
| 364 |
|
| 365 |
#define STYLE_PATH "INDEXSTYLE" /* environment variable defining search */ |
| 366 |
/* path for style files */ |
| 367 |
#define INDEX_IDX ".idx" |
| 368 |
#define INDEX_ILG ".ilg" |
| 369 |
#define INDEX_IND ".ind" |
| 370 |
#define INDEX_STY ".mst" |
| 371 |
|
| 372 |
#define INDEX_LOG ".log" |
| 373 |
|
| 374 |
#define EMPTY -9999 |
| 375 |
#define ROML 0 |
| 376 |
#define ROMU 1 |
| 377 |
#define ARAB 2 |
| 378 |
#define ALPL 3 |
| 379 |
#define ALPU 4 |
| 380 |
#undef DUPLICATE /* may already be defined for WIN32 */ |
| 381 |
#define DUPLICATE 9999 |
| 382 |
|
| 383 |
#define SYMBOL -1 |
| 384 |
#define ALPHA -2 |
| 385 |
|
| 386 |
#define GERMAN 0 |
| 387 |
|
| 388 |
typedef struct KFIELD |
| 389 |
{ |
| 390 |
char *sf[FIELD_MAX]; /* sort key */ |
| 391 |
char *af[FIELD_MAX]; /* actual key */ |
| 392 |
int group; /* key group */ |
| 393 |
char lpg[NUMBER_MAX]; /* literal page */ |
| 394 |
int npg[PAGEFIELD_MAX]; /* page field array */ |
| 395 |
short count; /* page field count */ |
| 396 |
short type; /* page number type */ |
| 397 |
char *encap; /* encapsulator */ |
| 398 |
const char *fn; /* input filename */ |
| 399 |
int lc; /* line number */ |
| 400 |
} FIELD, *FIELD_PTR; |
| 401 |
|
| 402 |
typedef struct KNODE |
| 403 |
{ |
| 404 |
FIELD data; |
| 405 |
struct KNODE *next; |
| 406 |
} NODE, *NODE_PTR; |
| 407 |
|
| 408 |
extern int letter_ordering; |
| 409 |
extern int compress_blanks; |
| 410 |
extern int init_page; |
| 411 |
extern int merge_page; |
| 412 |
extern int even_odd; |
| 413 |
extern int verbose; |
| 414 |
extern int german_sort; |
| 415 |
extern int thai_sort; |
| 416 |
extern int locale_sort; |
| 417 |
|
| 418 |
extern char idx_keyword[ARRAY_MAX]; |
| 419 |
extern char idx_aopen; |
| 420 |
extern char idx_aclose; |
| 421 |
extern char idx_level; |
| 422 |
extern char idx_ropen; |
| 423 |
extern char idx_rclose; |
| 424 |
extern char idx_quote; |
| 425 |
extern char idx_actual; |
| 426 |
extern char idx_encap; |
| 427 |
extern char idx_escape; |
| 428 |
|
| 429 |
extern char page_comp[ARRAY_MAX]; |
| 430 |
extern int page_offset[PAGETYPE_MAX]; |
| 431 |
extern char page_prec[ARRAY_MAX]; |
| 432 |
|
| 433 |
extern char preamble[ARRAY_MAX]; |
| 434 |
extern char postamble[ARRAY_MAX]; |
| 435 |
extern char setpage_open[ARRAY_MAX]; |
| 436 |
extern char setpage_close[ARRAY_MAX]; |
| 437 |
extern char group_skip[ARRAY_MAX]; |
| 438 |
extern int headings_flag; |
| 439 |
extern char heading_pre[ARRAY_MAX]; |
| 440 |
extern char heading_suf[ARRAY_MAX]; |
| 441 |
extern char symhead_pos[ARRAY_MAX]; |
| 442 |
extern char symhead_neg[ARRAY_MAX]; |
| 443 |
extern char numhead_pos[ARRAY_MAX]; |
| 444 |
extern char numhead_neg[ARRAY_MAX]; |
| 445 |
extern int prelen; |
| 446 |
extern int postlen; |
| 447 |
extern int skiplen; |
| 448 |
extern int headprelen; |
| 449 |
extern int headsuflen; |
| 450 |
extern int setpagelen; |
| 451 |
|
| 452 |
extern char item_r[FIELD_MAX][ARRAY_MAX]; |
| 453 |
extern char item_u[FIELD_MAX][ARRAY_MAX]; |
| 454 |
extern char item_x[FIELD_MAX][ARRAY_MAX]; |
| 455 |
extern int ilen_r[FIELD_MAX]; |
| 456 |
extern int ilen_u[FIELD_MAX]; |
| 457 |
extern int ilen_x[FIELD_MAX]; |
| 458 |
|
| 459 |
extern char delim_p[FIELD_MAX][ARRAY_MAX]; |
| 460 |
extern char delim_n[ARRAY_MAX]; |
| 461 |
extern char delim_r[ARRAY_MAX]; |
| 462 |
extern char delim_t[ARRAY_MAX]; |
| 463 |
|
| 464 |
extern char suffix_2p[ARRAY_MAX]; |
| 465 |
extern char suffix_3p[ARRAY_MAX]; |
| 466 |
extern char suffix_mp[ARRAY_MAX]; |
| 467 |
|
| 468 |
extern char encap_p[ARRAY_MAX]; |
| 469 |
extern char encap_i[ARRAY_MAX]; |
| 470 |
extern char encap_s[ARRAY_MAX]; |
| 471 |
|
| 472 |
extern int linemax; |
| 473 |
extern char indent_space[ARRAY_MAX]; |
| 474 |
extern int indent_length; |
| 475 |
|
| 476 |
extern FILE *idx_fp; |
| 477 |
extern FILE *sty_fp; |
| 478 |
extern FILE *ind_fp; |
| 479 |
extern FILE *ilg_fp; |
| 480 |
|
| 481 |
extern const char *idx_fn; |
| 482 |
extern const char *pgm_fn; |
| 483 |
extern const char *ind_fn; |
| 484 |
extern const char *ilg_fn; |
| 485 |
|
| 486 |
#ifndef MKIND_C |
| 487 |
extern char sty_fn[]; |
| 488 |
extern char ind[]; |
| 489 |
extern char ilg[]; |
| 490 |
extern char pageno[]; |
| 491 |
|
| 492 |
#ifdef DEBUG |
| 493 |
extern long totmem; |
| 494 |
#endif /* DEBUG */ |
| 495 |
|
| 496 |
#endif |
| 497 |
|
| 498 |
extern FIELD_PTR *idx_key; |
| 499 |
extern NODE_PTR head; |
| 500 |
extern NODE_PTR tail; |
| 501 |
|
| 502 |
extern int idx_dot; |
| 503 |
extern int idx_tt; |
| 504 |
extern int idx_gt; |
| 505 |
extern int idx_et; |
| 506 |
extern int idx_dc; |
| 507 |
|
| 508 |
#define DOT "." |
| 509 |
#define DOT_MAX 1000 |
| 510 |
#define CMP_MAX 1500 |
| 511 |
|
| 512 |
#define IDX_DOT(MAX) { \ |
| 513 |
idx_dot = TRUE; \ |
| 514 |
if (idx_dc++ == 0) { \ |
| 515 |
if (verbose) \ |
| 516 |
fprintf(stderr, DOT); \ |
| 517 |
fprintf(ilg_fp, DOT); \ |
| 518 |
} \ |
| 519 |
if (idx_dc == MAX) \ |
| 520 |
idx_dc = 0; \ |
| 521 |
} |
| 522 |
|
| 523 |
#define ALL_DONE { \ |
| 524 |
if (fn_no > 0) { \ |
| 525 |
if (verbose) \ |
| 526 |
fprintf(stderr, \ |
| 527 |
"Overall %d files read (%d entries accepted, %d rejected).\n", \ |
| 528 |
fn_no+1, idx_gt, idx_et); \ |
| 529 |
fprintf(ilg_fp, \ |
| 530 |
"Overall %d files read (%d entries accepted, %d rejected).\n", \ |
| 531 |
fn_no+1, idx_gt, idx_et); \ |
| 532 |
} \ |
| 533 |
} |
| 534 |
|
| 535 |
#define DONE(A, B, C, D) { \ |
| 536 |
if (verbose) \ |
| 537 |
fprintf(stderr, "done (%d %s, %d %s).\n", (A), B, C, D); \ |
| 538 |
fprintf(ilg_fp, "done (%d %s, %d %s).\n", (A), B, C, D); \ |
| 539 |
} |
| 540 |
|
| 541 |
extern void gen_ind (void); |
| 542 |
extern int group_type (const char *str); |
| 543 |
extern void scan_idx (void); |
| 544 |
extern void scan_sty (void); |
| 545 |
extern void sort_idx (void); |
| 546 |
extern int strtoint (char *str); |
| 547 |
|
| 548 |
#ifdef HAVE_STDLIB_H |
| 549 |
#include <stdlib.h> |
| 550 |
#endif |
| 551 |
#if __NeXT__ |
| 552 |
int access (const char *, int); |
| 553 |
#else |
| 554 |
#ifdef HAVE_UNISTD_H |
| 555 |
#include <unistd.h> |
| 556 |
#endif |
| 557 |
#endif |
| 558 |
|
| 559 |
#ifndef R_OK |
| 560 |
#define R_OK 4 /* only symbol from sys/file.h */ |
| 561 |
#endif |