csindex/csindex-19980713.dif

312 lines
8.1 KiB
Plaintext

--- Makefile
+++ Makefile 2000/12/18 11:25:28
@@ -1,9 +1,11 @@
DEFS=-DOS_SYSV
OBJS=csindex.o genind.o mkind.o qsort.o scanid.o scanst.o sortid.o
-CFLAGS= -O2 $(DEFS)
+CFLAGS= -Wall -O2 $(DEFS)
all: csindex
csindex: $(OBJS)
$(CC) -o csindex $(DEFS) $(OBJS) -lm
+clean:
+ rm -rf $(OBJS) csindex
--- csindex.c
+++ csindex.c 2000/12/18 11:25:33
@@ -195,7 +195,7 @@
case 221:
case 253: return 221; break;
default:
-if (p = strchr((char*)Same, ch)) ch = SameAs[p-(char*)Same];
+if ((p = strchr((char*)Same, ch))) ch = SameAs[p-(char*)Same];
if (ch & 0x80) return isupper(ch&0x7f) ? ch : ch ^ 32;
return tolower(ch);
}
@@ -210,7 +210,7 @@
case 221:
case 253: return 253; break;
default:
-if (p = strchr((char*)Same, ch)) ch = SameAs[p-(char*)Same];
+if ((p = strchr((char*)Same, ch))) ch = SameAs[p-(char*)Same];
if (ch & 0x80) return isupper(ch&0x7f) ? ch ^ 32 : ch;
else return toupper(ch);
}
@@ -254,19 +254,19 @@
#endif
if (d1 < 193) x1 = d1;
else
- if (p = strchr((char*)Same, d1))
+ if ((p = strchr((char*)Same, d1)))
x1 = pass ? p - (char*)Same + 128 : SameAs[p-(char*)Same];
else
- if (p = strchr((char*)After, d1)) {
+ if ((p = strchr((char*)After, d1))) {
x1 = Before[p-(char*)After]; st1 = 1;
}
else x1 = d1;
if (d2 < 193) x2 = d2;
else
- if (p = strchr((char*)Same, d2))
+ if ((p = strchr((char*)Same, d2)))
x2 = pass ? p - (char*)Same + 128 : SameAs[p-(char*)Same];
else
- if (p = strchr((char*)After, d2)) {
+ if ((p = strchr((char*)After, d2))) {
x2 = Before[p-(char*)After]; st2 = 1;
}
else x2 = d2;
--- genind.c
+++ genind.c 2000/12/18 11:25:33
@@ -197,7 +197,7 @@
static void
new_entry()
{
- int let;
+ int let=0;
FIELD_PTR ptr;
if (in_range) {
@@ -257,17 +257,14 @@
} else {
flush_line(FALSE);
if ((diff == 0) && (prev->type == curr->type)) {
-IND_ERROR(
-"Conflicting entries: multiple encaps for the same page under same key.\n",
-"");
+IND_ERROR("%s",
+"Conflicting entries: multiple encaps for the same page under same key.\n");
} else if (in_range && (prev->type != curr->type)) {
-IND_ERROR(
-"Illegal range formation: starting & ending pages are of different types.\n",
-"");
+IND_ERROR("%s",
+"Illegal range formation: starting & ending pages are of different types.\n");
} else if (in_range && (diff == -1)) {
-IND_ERROR(
-"Illegal range formation: starting & ending pages cross chap/sec breaks.\n",
-"");
+IND_ERROR("%s",
+"Illegal range formation: starting & ending pages cross chap/sec breaks.\n");
}
SAVE;
}
--- mkind.c
+++ mkind.c 2000/12/18 11:25:33
@@ -179,7 +179,7 @@
case 's':
argc--;
if (argc <= 0)
- FATAL("Expected -s <stylefile>\n","");
+ FATAL("%s", "Expected -s <stylefile>\n");
open_sty(*++argv);
sty_given = TRUE;
break;
@@ -188,7 +188,7 @@
case 'o':
argc--;
if (argc <= 0)
- FATAL("Expected -o <ind>\n","");
+ FATAL("%s", "Expected -o <ind>\n");
ind_fn = *++argv;
ind_given = TRUE;
break;
@@ -197,7 +197,7 @@
case 't':
argc--;
if (argc <= 0)
- FATAL("Expected -t <logfile>\n","");
+ FATAL("%s", "Expected -t <logfile>\n");
ilg_fn = *++argv;
ilg_given = TRUE;
break;
@@ -206,7 +206,7 @@
case 'p':
argc--;
if (argc <= 0)
- FATAL("Expected -p <num>\n","");
+ FATAL("%s", "Expected -p <num>\n");
strcpy(pageno, *++argv);
init_page = TRUE;
if (STREQ(pageno, EVEN)) {
@@ -294,10 +294,10 @@
#endif /* DEBUG */
if (head == (NODE_PTR)NULL)
- FATAL("No valid index entries collected.\n", "");
+ FATAL("%s", "No valid index entries collected.\n");
if ((idx_key = (FIELD_PTR *) calloc(idx_gt, sizeof(FIELD_PTR))) == NULL) {
- FATAL("Not enough core...abort.\n", "");
+ FATAL("%s", "Not enough core...abort.\n");
}
for (i = 0; i < idx_gt; i++) {
idx_key[i] = &(ptr->data);
@@ -473,7 +473,7 @@
#endif /* DEBUG */
if ((idx_fn = (char *) malloc(STRING_MAX)) == NULL)
- FATAL("Not enough core...abort.\n", "");
+ FATAL("%s", "Not enough core...abort.\n");
sprintf(idx_fn, "%s%s", base, INDEX_IDX);
if ((open_fn &&
((idx_fp = OPEN_IN(idx_fn)) == NULL)
--- mkind.h
+++ mkind.h 2000/12/18 11:25:35
@@ -189,6 +189,7 @@
#include <stdio.h>
#include <ctype.h>
+#include <unistd.h>
#if (CCD_2000 | OS_SYSV | OS_PCDOS | __STDC__ | _AIX | ardent)
#include <string.h>
@@ -743,3 +744,5 @@
*/
#include "csindex.h"
+
+char *strlwr(char *a);
--- scanid.c
+++ scanid.c 2000/12/18 11:25:33
@@ -95,8 +95,7 @@
IDX_DOT(DOT_MAX);
arg_count = -1;
} else if (arg_count > -1) {
- IDX_ERROR("Missing arguments -- need two (premature LFD).\n",
- NULL);
+ IDX_ERROR("%s", "Missing arguments -- need two (premature LFD).\n");
arg_count = -1;
}
case TAB:
@@ -187,7 +186,7 @@
#endif /* DEBUG */
if ((ptr = (NODE_PTR) malloc(sizeof(NODE))) == NULL)
- FATAL("Not enough core...abort.\n", "");
+ FATAL("%s", "Not enough core...abort.\n");
for (i = 0; i < FIELD_MAX; i++)
{
@@ -234,7 +233,7 @@
{
(*ppstr) = (char*)malloc(n);
if ((*ppstr) == (char*)NULL)
- FATAL("Not enough core...abort.\n", "");
+ FATAL("%s", "Not enough core...abort.\n");
(*ppstr)[0] = NUL;
}
}
@@ -670,7 +669,7 @@
{
case LFD:
idx_lc++;
- IDX_ERROR("Incomplete first argument (premature LFD).\n", "");
+ IDX_ERROR("%s", "Incomplete first argument (premature LFD).\n");
return (FALSE);
case TAB:
case SPC:
@@ -713,7 +712,7 @@
switch (a) {
case LFD:
idx_lc++;
-IDX_ERROR("Incomplete second argument (premature LFD).\n", "");
+IDX_ERROR("%s", "Incomplete second argument (premature LFD).\n");
return (FALSE);
case TAB:
case SPC:
@@ -723,7 +722,7 @@
if (hit_blank) {
flush_to_eol(); /* Skip to end of line */
idx_lc++;
-IDX_ERROR("Illegal space within numerals in second argument.\n", "");
+IDX_ERROR("%s", "Illegal space within numerals in second argument.\n");
return (FALSE);
}
no[i++] = (char) a;
--- scanid.h
+++ scanid.h 2000/12/18 11:25:35
@@ -105,7 +105,7 @@
}
#define NULL_RTN { \
- IDX_ERROR("Illegal null field.\n", NULL); \
+ IDX_ERROR("%s", "Illegal null field.\n"); \
return (FALSE); \
}
--- scanst.c
+++ scanst.c 2000/12/18 11:25:33
@@ -380,7 +380,7 @@
break;
default:
STY_SKIPLINE;
- STY_ERROR("No opening delimiter.\n", "");
+ STY_ERROR("%s", "No opening delimiter.\n");
return (FALSE);
}
return (TRUE); /* function value no longer used */
@@ -398,12 +398,12 @@
switch (clone = GET_CHAR(sty_fp)) {
case CHR_DELIM:
STY_SKIPLINE;
- STY_ERROR("Premature closing delimiter.\n", "");
+ STY_ERROR("%s", "Premature closing delimiter.\n");
return (FALSE);
case LFD:
sty_lc++;
case EOF:
- STY_ERROR("No character (premature EOF).\n", "");
+ STY_ERROR("%s", "No character (premature EOF).\n");
return (FALSE);
case BSH:
clone = GET_CHAR(sty_fp);
@@ -412,7 +412,7 @@
*c = (char) clone;
return (TRUE);
} else {
- STY_ERROR("No closing delimiter or too many letters.\n", "");
+ STY_ERROR("%s", "No closing delimiter or too many letters.\n");
return (FALSE);
}
}
@@ -422,7 +422,7 @@
break;
default:
STY_SKIPLINE;
- STY_ERROR("No opening delimiter.\n", "");
+ STY_ERROR("%s", "No opening delimiter.\n");
return (FALSE);
}
return (TRUE); /* function value no longer used */
@@ -501,7 +501,7 @@
}
if (page_prec[i] != NUL) {
STY_SKIPLINE;
- STY_ERROR("Page precedence specification string too long.\n", "");
+ STY_ERROR("%s", "Page precedence specification string too long.\n");
return (FALSE);
}
last = i;
--- sortid.c
+++ sortid.c 2000/12/18 11:25:33
@@ -40,7 +40,7 @@
void
sort_idx()
{
- MESSAGE("Sorting entries...", "");
+ MESSAGE("%s", "Sorting entries...");
idx_dc = 0;
idx_gc = 0L;
qqsort((char *) idx_key, (int) idx_gt, (int) sizeof(FIELD_PTR), compare);
@@ -204,7 +204,7 @@
FIELD_PTR *a;
FIELD_PTR *b;
{
- int m;
+ int m=0;
short i = 0;
while ((i < (*a)->count) && (i < (*b)->count) &&