diff options
Diffstat (limited to 'src/zsoelim.c')
-rw-r--r-- | src/zsoelim.c | 117 |
1 files changed, 60 insertions, 57 deletions
diff --git a/src/zsoelim.c b/src/zsoelim.c index 33fc6f1a..6a282964 100644 --- a/src/zsoelim.c +++ b/src/zsoelim.c @@ -815,6 +815,7 @@ char *yytext; #undef ACCEPT_QUOTES /* accept quoted roff requests */ #include <assert.h> +#include <stdbool.h> #include <string.h> #include <stdlib.h> #include <unistd.h> @@ -840,10 +841,12 @@ char *yytext; #define _(String) gettext (String) #include "appendstr.h" +#include "compression.h" #include "debug.h" -#include "decompress.h" #include "fatal.h" #include "glcontainers.h" + +#include "decompress.h" #include "globbing.h" #include "zsoelim.h" @@ -859,7 +862,7 @@ static char *so_name[MAX_SO_DEPTH]; static int so_line[MAX_SO_DEPTH]; static decompress *so_pipe[MAX_SO_DEPTH]; static int so_stack_ptr; -static int no_newline; +static bool no_newline; static gl_list_t so_manpathlist; static const char *so_parent_path; @@ -883,9 +886,9 @@ struct zsoelim_stdin_data { result = YY_NULL; \ } #define YY_NO_INPUT -#line 887 "zsoelim.c" +#line 890 "zsoelim.c" -#line 889 "zsoelim.c" +#line 892 "zsoelim.c" #define INITIAL 0 #define so 1 @@ -1108,10 +1111,10 @@ YY_DECL } { -#line 143 "zsoelim.l" +#line 146 "zsoelim.l" -#line 1115 "zsoelim.c" +#line 1118 "zsoelim.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1159,69 +1162,69 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 145 "zsoelim.l" +#line 148 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; BEGIN (de); /* Now we're inside of a macro definition: ends with a comment */ } YY_BREAK case 2: YY_RULE_SETUP -#line 151 "zsoelim.l" +#line 154 "zsoelim.l" { - no_newline = 1; + no_newline = true; BEGIN (so); /* Now we're in the .so environment */ } YY_BREAK case 3: YY_RULE_SETUP -#line 156 "zsoelim.l" +#line 159 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; /* Now we're in the .lf environment */ BEGIN (lfnumber); } YY_BREAK case 4: -#line 163 "zsoelim.l" +#line 166 "zsoelim.l" case 5: /* rule 5 can match eol */ -#line 164 "zsoelim.l" +#line 167 "zsoelim.l" case 6: /* rule 6 can match eol */ -#line 165 "zsoelim.l" +#line 168 "zsoelim.l" case 7: /* rule 7 can match eol */ -#line 166 "zsoelim.l" +#line 169 "zsoelim.l" case 8: /* rule 8 can match eol */ -#line 167 "zsoelim.l" +#line 170 "zsoelim.l" case 9: /* rule 9 can match eol */ -#line 168 "zsoelim.l" +#line 171 "zsoelim.l" case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 168 "zsoelim.l" +#line 171 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; } YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 173 "zsoelim.l" +#line 176 "zsoelim.l" { - no_newline = 0; + no_newline = false; putchar ('\n'); LINE++; } YY_BREAK case 12: YY_RULE_SETUP -#line 180 "zsoelim.l" +#line 183 "zsoelim.l" { /* file names including whitespace ? */ if (so_stack_ptr == MAX_SO_DEPTH - 1) fatal (0, @@ -1233,7 +1236,7 @@ YY_RULE_SETUP so_stack[so_stack_ptr++] = YY_CURRENT_BUFFER; LINE = 1; - no_newline = 0; + no_newline = false; if (zsoelim_open_file (yytext, so_manpathlist, so_parent_path)) { @@ -1257,18 +1260,18 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 212 "zsoelim.l" +#line 215 "zsoelim.l" { - no_newline = 0; + no_newline = false; BEGIN (INITIAL); } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 217 "zsoelim.l" +#line 220 "zsoelim.l" { - no_newline = 0; + no_newline = false; error (OK, 0, _("%s:%d: warning: newline in .so request, " "ignoring"), @@ -1280,36 +1283,36 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 228 "zsoelim.l" +#line 231 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; BEGIN (INITIAL); } YY_BREAK case 16: YY_RULE_SETUP -#line 234 "zsoelim.l" +#line 237 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 239 "zsoelim.l" +#line 242 "zsoelim.l" { - no_newline = 0; + no_newline = false; putchar ('\n'); LINE++; } YY_BREAK case 18: YY_RULE_SETUP -#line 246 "zsoelim.l" +#line 249 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; ZAP_QUOTES; LINE = atoi (yytext); @@ -1318,9 +1321,9 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 254 "zsoelim.l" +#line 257 "zsoelim.l" { /* file names including whitespace ?? */ - no_newline = 1; + no_newline = true; ECHO; putchar ('\n'); ZAP_QUOTES; @@ -1332,18 +1335,18 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 265 "zsoelim.l" +#line 268 "zsoelim.l" { - no_newline = 1; + no_newline = true; ECHO; } YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP -#line 270 "zsoelim.l" +#line 273 "zsoelim.l" { - no_newline = 0; + no_newline = false; putchar ('\n'); LINE++; BEGIN (INITIAL); @@ -1351,9 +1354,9 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 277 "zsoelim.l" +#line 280 "zsoelim.l" { - no_newline = 1; + no_newline = true; debug ( "%s:%d: warning: unhandled .lf request; " "line numbers may be wrong\n", @@ -1365,9 +1368,9 @@ YY_RULE_SETUP case 23: /* rule 23 can match eol */ YY_RULE_SETUP -#line 287 "zsoelim.l" +#line 290 "zsoelim.l" { - no_newline = 0; + no_newline = false; error (OK, 0, _("%s:%d: warning: newline in .lf request, " "ignoring"), @@ -1383,7 +1386,7 @@ case YY_STATE_EOF(de): case YY_STATE_EOF(end_request): case YY_STATE_EOF(lfnumber): case YY_STATE_EOF(lfname): -#line 298 "zsoelim.l" +#line 301 "zsoelim.l" { decompress_wait (PIPE); decompress_free (PIPE); @@ -1401,16 +1404,16 @@ case YY_STATE_EOF(lfname): yy_switch_to_buffer (so_stack[so_stack_ptr]); printf (".lf %d %s\n", LINE += 1, NAME); } - no_newline = 0; + no_newline = false; BEGIN (end_request); } YY_BREAK case 24: YY_RULE_SETUP -#line 318 "zsoelim.l" +#line 321 "zsoelim.l" ECHO; YY_BREAK -#line 1414 "zsoelim.c" +#line 1417 "zsoelim.c" case YY_END_OF_BUFFER: { @@ -2369,7 +2372,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 318 "zsoelim.l" +#line 321 "zsoelim.l" #ifdef ACCEPT_QUOTES @@ -2443,8 +2446,8 @@ static decompress *try_compressed (char **filename) /* This routine is used to open the specified file or uncompress a compressed version and open that instead */ -int zsoelim_open_file (const char *filename, gl_list_t manpathlist, - const char *parent_path) +bool zsoelim_open_file (const char *filename, gl_list_t manpathlist, + const char *parent_path) { decompress *decomp; @@ -2529,7 +2532,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, if (parent_path) { names = look_for_file (parent_path, sec, name, - 0, LFF_MATCHCASE); + false, LFF_MATCHCASE); GL_LIST_FOREACH (names, found_name) { decomp = decompress_open (found_name, @@ -2548,7 +2551,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, continue; names = look_for_file (mp, sec, name, - 0, LFF_MATCHCASE); + false, LFF_MATCHCASE); GL_LIST_FOREACH (names, found_name) { decomp = decompress_open (found_name, @@ -2582,7 +2585,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist, out: if (!decomp) { error (0, errno, _("can't open %s"), filename); - return 1; + return true; } } @@ -2593,7 +2596,7 @@ out: /* only used by YY_INPUT, which casts it back to 'decompress *' */ yyin = (FILE *) decomp; - return 0; + return false; } void zsoelim_stdin (void *data) |