diff -uNr flex-2.5.31/filter.c flex-2.5.31-new/filter.c --- flex-2.5.31/filter.c Tue Mar 25 11:39:08 2003 +++ flex-2.5.31-new/filter.c Tue Nov 18 15:24:12 2003 @@ -157,11 +157,15 @@ if (chain->filter_func) { int r; - /* setup streams again */ + /* setup streams again -- Removed. POSIX states that children inherit + open streams in the parent. Also, ANSI C99 states that the stdin + and stdout macors need not be modified lvalues; so this code is + broken in the first place. if ((stdin = fdopen (0, "r")) == NULL) flexfatal (_("fdopen(0) failed")); if ((stdout = fdopen (1, "w")) == NULL) flexfatal (_("fdopen(1) failed")); + */ if ((r = chain->filter_func (chain)) == -1) flexfatal (_("filter_func failed")); @@ -181,9 +185,11 @@ if (dup2 (pipes[1], 1) == -1) flexfatal (_("dup2(pipes[1],1)")); close (pipes[1]); + /* This is not legal; stfout does not need to be a modifiable + lvalue if ((stdout = fdopen (1, "w")) == NULL) flexfatal (_("fdopen(1) failed")); - + */ return true; } diff -uNr flex-2.5.31/flex.skl flex-2.5.31-new/flex.skl --- flex-2.5.31/flex.skl Mon Mar 31 20:51:38 2003 +++ flex-2.5.31-new/flex.skl Tue Nov 18 15:24:12 2003 @@ -345,19 +345,19 @@ %# yyscan_t yyscanner; %# %# Generate traditional function defs - m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) + m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]] M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) - $1 $2; + m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]] + $1 $2; [[\]] M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) - $1 $2; - $3 $4; + m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]] + $1 $2; [[\]] + $3 $4; [[\]] M4_YY_DECL_LAST_ARG]]) - m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) - $1 $2; - $3 $4; - $5 $6; + m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]] + $1 $2; [[\]] + $3 $4; [[\]] + $5 $6; [[\]] M4_YY_DECL_LAST_ARG]]) ]], [[ @@ -724,6 +724,7 @@ m4_ifdef( [[M4_YY_NO_UNISTD_H]],, [[ +#ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. @@ -734,6 +735,7 @@ %if-c++-only #include %endif +#endif ]]) #ifndef YY_EXTRA_TYPE @@ -1124,9 +1126,9 @@ m4_dnl The bison pure parser is used. Redefine yylex to m4_dnl accept the lval parameter. - m4_define( [[M4_YY_LEX_PROTO]], + m4_define( [[M4_YY_LEX_PROTO]], [[\]] [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]]) - m4_define( [[M4_YY_LEX_DECLARATION]], + m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] [[YYFARGS1(YYSTYPE *,yylval_param)]]) ]]) @@ -1134,9 +1136,9 @@ [[ m4_dnl Locations are used. yylex should also accept the ylloc parameter. - m4_define( [[M4_YY_LEX_PROTO]], + m4_define( [[M4_YY_LEX_PROTO]], [[\]] [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]]) - m4_define( [[M4_YY_LEX_DECLARATION]], + m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]]) ]]) @@ -2251,11 +2253,11 @@ * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str) +YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str) { m4_dnl M4_YY_DECL_GUTS_VAR(); - return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG); + return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG); } %endif ]]) diff -uNr flex-2.5.31/gen.c flex-2.5.31-new/gen.c --- flex-2.5.31/gen.c Sun Mar 30 14:58:44 2003 +++ flex-2.5.31-new/gen.c Tue Nov 18 15:24:12 2003 @@ -1808,21 +1808,20 @@ } if (yymore_used) { - if (!C_plus_plus) { - if (yytext_is_array) { - if (!reentrant){ - indent_puts ("static int yy_more_offset = 0;"); - }else{ - indent_puts ("static int yy_prev_more_offset = 0;"); - } - } - else if (!reentrant) { - indent_puts - ("static int yy_more_flag = 0;"); - indent_puts - ("static int yy_more_len = 0;"); - } - } + if (!C_plus_plus) { + if (yytext_is_array) { + if (!reentrant){ + indent_puts ("static int yy_more_offset = 0;"); + indent_puts ("static int yy_prev_more_offset = 0;"); + } + } + else if (!reentrant) { + indent_puts + ("static int yy_more_flag = 0;"); + indent_puts + ("static int yy_more_len = 0;"); + } + } if (yytext_is_array) { indent_puts diff -uNr flex-2.5.31/main.c flex-2.5.31-new/main.c --- flex-2.5.31/main.c Mon Mar 31 20:51:38 2003 +++ flex-2.5.31-new/main.c Tue Nov 18 15:24:12 2003 @@ -199,6 +199,7 @@ { #if ENABLE_NLS setlocale (LC_MESSAGES, ""); + setlocale (LC_CTYPE, ""); textdomain (PACKAGE); bindtextdomain (PACKAGE, LOCALEDIR); #endif @@ -1594,7 +1595,6 @@ outn ("#endif"); outn ("#else"); outn (yy_stdinit); - outn ("#endif"); outn ("#endif"); } diff -uNr flex-2.5.31/scan.c flex-2.5.31-new/scan.c --- flex-2.5.31/scan.c Tue Apr 1 11:33:17 2003 +++ flex-2.5.31-new/scan.c Tue Nov 18 15:24:12 2003 @@ -1619,11 +1619,13 @@ #define LINEDIR 18 #define CODEBLOCK_MATCH_BRACE 19 +#ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include +#endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * diff -uNr flex-2.5.31/skel.c flex-2.5.31-new/skel.c --- flex-2.5.31/skel.c Tue Apr 1 11:33:08 2003 +++ flex-2.5.31-new/skel.c Tue Nov 18 15:24:12 2003 @@ -404,16 +404,16 @@ "%# yyscan_t yyscanner;", "%#", "%# Generate traditional function defs", - " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)", + " m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\\]]", " M4_YY_DECL_LAST_ARG]])", - " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)", + " m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\\]]", " $1 $2;", " M4_YY_DECL_LAST_ARG]])", - " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)", + " m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\\]]", " $1 $2;", " $3 $4;", " M4_YY_DECL_LAST_ARG]])", - " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)", + " m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\\]]", " $1 $2;", " $3 $4;", " $5 $6;", @@ -783,6 +783,7 @@ "", "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,", "[[", + "#ifndef YY_NO_UNISTD_H", "/* Special case for \"unistd.h\", since it is non-ANSI. We include it way", " * down here because we want the user's section 1 to have been scanned first.", " * The user has a chance to override it with an option.", @@ -793,6 +794,7 @@ "%if-c++-only", "#include ", "%endif", + "#endif", "]])", "", "#ifndef YY_EXTRA_TYPE", @@ -2454,11 +2456,11 @@ " * @note If you want to scan bytes that may contain NUL values, then use", " * yy_scan_bytes() instead.", " */", - "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)", + "YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)", "{", " m4_dnl M4_YY_DECL_GUTS_VAR();", "", - " return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);", + " return yy_scan_bytes( yy_str, strlen(yy_str) M4_YY_CALL_LAST_ARG);", "}", "%endif", "]])",