fputs ("m4_undefine( [[M4_YY_IN_HEADER]])m4_dnl\n", to_h);
fflush (to_h);
- fclose (to_h);
+ if (ferror (to_h))
+ lerrsf (_("error writing output file %s"),
+ (char *) chain->extra);
+
+ else if (fclose (to_h))
+ lerrsf (_("error closing output file %s"),
+ (char *) chain->extra);
}
fflush (to_c);
- fclose (to_c);
+ if (ferror (to_c))
+ lerrsf (_("error writing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+ else if (fclose (to_c))
+ lerrsf (_("error closing output file %s"),
+ outfilename ? outfilename : "<stdout>");
while (wait (0) > 0) ;
lineno++;
}
fflush (stdout);
+ if (ferror (stdout))
+ lerrsf (_("error writing output file %s"),
+ outfilename ? outfilename : "<stdout>");
+
+ else if (fclose (stdout))
+ lerrsf (_("error closing output file %s"),
+ outfilename ? outfilename : "<stdout>");
return 0;
}
do_indent ();
out_str ("for ( yyl = %s; yyl < yyleng; ++yyl )\n",
yymore_used ? (yytext_is_array ? "YY_G(yy_prev_more_offset)" :
- "(yy_more_len)") : "0");
+ "YY_G(yy_more_len)") : "0");
indent_up ();
indent_puts ("if ( yytext[yyl] == '\\n' )");
indent_up ();
int argc;
char *argv[];
{
- int i, exit_status;
+ int i, exit_status, child_status;
/* Set a longjmp target. Yes, I know it's a hack, but it gets worse: The
* return value of setjmp, if non-zero, is the desired exit code PLUS ONE.
fflush(stdout);
fclose(stdout);
}
- while (wait(0) > 0){
+ while (wait(&child_status) > 0){
+ if (!WIFEXITED (child_status)
+ || WEXITSTATUS (child_status) != 0){
+ /* report an error of a child
+ */
+ if( exit_status <= 1 )
+ exit_status = 2;
+
+ }
}
- return exit_status - 1;
+ return exit_status - 1;
}
flexinit (argc, argv);
outn ("#else");
outn (yy_stdinit);
outn ("#endif");
- outn ("#endif");
}
else {