csindex patch
Pavel Janik ml.
Pavel.Janik na inet.cz
Středa Červen 2 12:24:10 CEST 1999
Zdravím,
dnes jsem se díval na nový teTeX (Michale - jeho adresář už má v názvu
tetex-1.0 :-))). Vyměnil jsem si i csindex a při jeho kompilaci jsem aplikoval
tento patch. Je pouze kosmetický, ale tak zprasený program jsem už dlouho
neviděl...
Makefile | 4 +++-
csindex.c | 12 ++++++------
genind.c | 17 +++++++----------
mkind.c | 14 +++++++-------
mkind.h | 3 +++
scanid.c | 13 ++++++-------
scanid.h | 2 +-
scanst.c | 12 ++++++------
sortid.c | 4 ++--
9 files changed, 41 insertions, 40 deletions
diff -urN csindex-19980713/Makefile csindex-19990602/Makefile
--- csindex-19980713/Makefile Thu Jun 12 12:39:23 1997
+++ csindex-19990602/Makefile Wed Jun 2 12:13:33 1999
@@ -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
diff -urN csindex-19980713/csindex.c csindex-19990602/csindex.c
--- csindex-19980713/csindex.c Mon Jul 13 16:31:19 1998
+++ csindex-19990602/csindex.c Wed Jun 2 11:50:37 1999
@@ -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;
diff -urN csindex-19980713/genind.c csindex-19990602/genind.c
--- csindex-19980713/genind.c Mon Sep 23 11:59:59 1996
+++ csindex-19990602/genind.c Wed Jun 2 12:15:24 1999
@@ -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;
}
diff -urN csindex-19980713/mkind.c csindex-19990602/mkind.c
--- csindex-19980713/mkind.c Wed Jun 11 15:54:21 1997
+++ csindex-19990602/mkind.c Wed Jun 2 12:03:09 1999
@@ -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)
diff -urN csindex-19980713/mkind.h csindex-19990602/mkind.h
--- csindex-19980713/mkind.h Mon Sep 23 12:00:00 1996
+++ csindex-19990602/mkind.h Wed Jun 2 12:16:26 1999
@@ -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);
diff -urN csindex-19980713/scanid.c csindex-19990602/scanid.c
--- csindex-19980713/scanid.c Mon Sep 23 12:00:01 1996
+++ csindex-19990602/scanid.c Wed Jun 2 12:07:33 1999
@@ -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;
diff -urN csindex-19980713/scanid.h csindex-19990602/scanid.h
--- csindex-19980713/scanid.h Mon Sep 23 12:00:01 1996
+++ csindex-19990602/scanid.h Wed Jun 2 12:06:14 1999
@@ -105,7 +105,7 @@
}
#define NULL_RTN { \
- IDX_ERROR("Illegal null field.\n", NULL); \
+ IDX_ERROR("%s", "Illegal null field.\n"); \
return (FALSE); \
}
diff -urN csindex-19980713/scanst.c csindex-19990602/scanst.c
--- csindex-19980713/scanst.c Mon Sep 23 12:00:02 1996
+++ csindex-19990602/scanst.c Wed Jun 2 12:10:35 1999
@@ -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;
diff -urN csindex-19980713/sortid.c csindex-19990602/sortid.c
--- csindex-19980713/sortid.c Mon Sep 23 12:00:02 1996
+++ csindex-19990602/sortid.c Wed Jun 2 12:11:40 1999
@@ -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) &&
--
Pavel Janík ml.
Pavel.Janik na inet.cz
Další informace o konferenci Redhat-cz