| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1aaf1b3 commit fb27ec0
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,7 +56,7 @@ | |||
| 56 | 56 | #include "ansichek.h" | |
| 57 | 57 | #include "stdfn.h" | |
| 58 | 58 | ||
| 59 | - #define MAX_LINE_LEN 256 | ||
| 59 | + #define MAX_LINE_LEN 255 | ||
| 60 | 60 | #ifdef TRUE | |
| 61 | 61 | # undef TRUE | |
| 62 | 62 | # undef FALSE | |
@@ -77,7 +77,7 @@ int main(argc, argv) | |||
| 77 | 77 | int argc; | |
| 78 | 78 | char **argv; | |
| 79 | 79 | { | |
| 80 | - char line[MAX_LINE_LEN + 1]; | ||
| 80 | + char line[MAX_LINE_LEN+1]; | ||
| 81 | 81 | FILE *infile; | |
| 82 | 82 | FILE *outfile; | |
| 83 | 83 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,7 @@ static char *RCSid = "$Id: doc2hlp.c,v 1.15 1998/04/14 00:16:58 drd Exp $"; | |||
| 55 | 55 | #include "ansichek.h" | |
| 56 | 56 | #include "stdfn.h" | |
| 57 | 57 | ||
| 58 | - #define MAX_LINE_LEN 256 | ||
| 58 | + #define MAX_LINE_LEN 255 | ||
| 59 | 59 | #ifdef TRUE | |
| 60 | 60 | # undef TRUE | |
| 61 | 61 | # undef FALSE | |
@@ -76,7 +76,7 @@ int main(argc, argv) | |||
| 76 | 76 | int argc; | |
| 77 | 77 | char **argv; | |
| 78 | 78 | { | |
| 79 | - char line[MAX_LINE_LEN + 1]; | ||
| 79 | + char line[MAX_LINE_LEN+1]; | ||
| 80 | 80 | FILE *infile; | |
| 81 | 81 | FILE *outfile; | |
| 82 | 82 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,10 +56,9 @@ | |||
| 56 | 56 | ||
| 57 | 57 | #include "ansichek.h" | |
| 58 | 58 | #include "stdfn.h" | |
| 59 | - #include "xref.h" | ||
| 60 | 59 | ||
| 61 | - #undef MAX_LINE_LEN | ||
| 62 | 60 | #define MAX_LINE_LEN 255 | |
| 61 | + #include "xref.h" | ||
| 63 | 62 | ||
| 64 | 63 | struct BUFFER { /* buffer to reformat paragraphs with xrefs */ | |
| 65 | 64 | char *content; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,8 +53,8 @@ static char *RCSid = "$Id: doc2ipf.c,v 1.20 1998/04/14 00:16:59 drd Exp $"; | |||
| 53 | 53 | ||
| 54 | 54 | #include "ansichek.h" | |
| 55 | 55 | #include "stdfn.h" | |
| 56 | + #include "xref.h" | ||
| 56 | 57 | ||
| 57 | - #define MAX_LINE_LEN 1023 | ||
| 58 | 58 | #define MAX_COL 6 | |
| 59 | 59 | #ifdef TRUE | |
| 60 | 60 | # undef TRUE | |
@@ -63,8 +63,13 @@ static char *RCSid = "$Id: doc2ipf.c,v 1.20 1998/04/14 00:16:59 drd Exp $"; | |||
| 63 | 63 | #define TRUE 1 | |
| 64 | 64 | #define FALSE 0 | |
| 65 | 65 | ||
| 66 | - #include "termdoc.c" | ||
| 67 | - #include "xref.c" | ||
| 66 | + /* Replase the previous #ifdef */ | ||
| 67 | + int single_top_level = 0; | ||
| 68 | + | ||
| 69 | + /* We are using the fgets() replacement from termdoc.c */ | ||
| 70 | + extern char *get_line __PROTO((char *, int, FILE *)); | ||
| 71 | + /* From xref.c */ | ||
| 72 | + extern void *xmalloc __PROTO((size_t)); | ||
| 68 | 73 | ||
| 69 | 74 | void convert __PROTO((FILE * a, FILE * b)); | |
| 70 | 75 | void process_line __PROTO((char *line, FILE * b)); | |
@@ -76,12 +81,10 @@ struct TABENTRY { /* may have MAX_COL column tables */ | |||
| 76 | 81 | char col[MAX_COL][256]; | |
| 77 | 82 | }; | |
| 78 | 83 | ||
| 79 | - struct TABENTRY table = | ||
| 80 | - {NULL}; | ||
| 84 | + struct TABENTRY table = { NULL }; | ||
| 81 | 85 | struct TABENTRY *tableins = &table; | |
| 82 | 86 | int tablecols = 0; | |
| 83 | - int tablewidth[MAX_COL] = | ||
| 84 | - {0, 0, 0, 0, 0, 0}; /* there must be the correct */ | ||
| 87 | + int tablewidth[MAX_COL] = {0, 0, 0, 0, 0, 0}; /* there must be the correct */ | ||
| 85 | 88 | int tablelines = 0; /* number of zeroes here */ | |
| 86 | 89 | ||
| 87 | 90 | int debug = FALSE; | |
@@ -98,20 +101,22 @@ char **argv; | |||
| 98 | 101 | ||
| 99 | 102 | if (argc != 3 && !debug) { | |
| 100 | 103 | fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); | |
| 101 | - return (1); | ||
| 104 | + exit(EXIT_FAILURE); | ||
| 102 | 105 | } | |
| 103 | 106 | if ((infile = fopen(argv[1], "r")) == (FILE *) NULL) { | |
| 104 | 107 | fprintf(stderr, "%s: Can't open %s for reading\n", | |
| 105 | 108 | argv[0], argv[1]); | |
| 106 | - return (1); | ||
| 109 | + exit(EXIT_FAILURE); | ||
| 107 | 110 | } | |
| 108 | 111 | if ((outfile = fopen(argv[2], "w")) == (FILE *) NULL) { | |
| 109 | 112 | fprintf(stderr, "%s: Can't open %s for writing\n", | |
| 110 | 113 | argv[0], argv[2]); | |
| 114 | + fclose(infile); | ||
| 115 | + exit(EXIT_FAILURE); | ||
| 111 | 116 | } | |
| 112 | 117 | parse(infile); | |
| 113 | 118 | convert(infile, outfile); | |
| 114 | - return (0); | ||
| 119 | + exit(EXIT_SUCCESS); | ||
| 115 | 120 | } | |
| 116 | 121 | ||
| 117 | 122 | void convert(a, b) | |
@@ -174,12 +179,12 @@ FILE *b; | |||
| 174 | 179 | nblanks = 0; | |
| 175 | 180 | while (line[nblanks] == ' ') | |
| 176 | 181 | ++nblanks; | |
| 177 | - while (line[i] != '\0') { | ||
| 182 | + while (line[i] != NUL) { | ||
| 178 | 183 | if (introffheader) { | |
| 179 | 184 | if (line[i] != '\n') | |
| 180 | 185 | line2[j] = line[i]; | |
| 181 | 186 | else | |
| 182 | - line2[j] = '\0'; | ||
| 187 | + line2[j] = NUL; | ||
| 183 | 188 | } else | |
| 184 | 189 | switch (line[i]) { | |
| 185 | 190 | case '$': | |
@@ -275,7 +280,7 @@ FILE *b; | |||
| 275 | 280 | fprintf(stderr, "Possible missing link character (`) near above line number\n"); | |
| 276 | 281 | abort(); | |
| 277 | 282 | } | |
| 278 | - line2[j] = '\0'; | ||
| 283 | + line2[j] = NUL; | ||
| 279 | 284 | } | |
| 280 | 285 | ||
| 281 | 286 | i = 1; | |
@@ -364,7 +369,7 @@ FILE *b; | |||
| 364 | 369 | tabledelim[1] = tablechar; | |
| 365 | 370 | line2[0] = tablechar; | |
| 366 | 371 | while ((pt = strtok(tablerow, tabledelim + 1)) != NULL) { | |
| 367 | - if (*pt != '\0') { /* ignore null columns */ | ||
| 372 | + if (*pt != NUL) { /* ignore null columns */ | ||
| 368 | 373 | /* this fails on format line */ | |
| 369 | 374 | assert(j < MAX_COL); | |
| 370 | 375 | strcpy(tableins->col[j], pt); | |
@@ -378,7 +383,7 @@ FILE *b; | |||
| 378 | 383 | } | |
| 379 | 384 | } | |
| 380 | 385 | for (j; j < MAX_COL; j++) | |
| 381 | - tableins->col[j][0] = '\0'; | ||
| 386 | + tableins->col[j][0] = NUL; | ||
| 382 | 387 | } | |
| 383 | 388 | break; /* ignore */ | |
| 384 | 389 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -285,7 +285,7 @@ FILE *file; | |||
| 285 | 285 | { | |
| 286 | 286 | static boolean inquote = FALSE; | |
| 287 | 287 | ||
| 288 | - while (*s != '\0') { | ||
| 288 | + while (*s != NUL) { | ||
| 289 | 289 | switch (*s) { | |
| 290 | 290 | case '`':{ /* backquote -> boldface */ | |
| 291 | 291 | if (inquote) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments