Return error code from parser on normal process exit

This commit is contained in:
2007-12-31 00:48:57 +00:00
parent a4031c5ff8
commit 1f50fd27f6

View File

@@ -28,6 +28,8 @@ int yywrap()
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int rv;
argv++; /* skip over program name */ argv++; /* skip over program name */
argc--; argc--;
if (argc > 0) { if (argc > 0) {
@@ -60,10 +62,10 @@ int main(int argc, char *argv[])
err(1, "%s: Failed to open output file", "out.lc"); err(1, "%s: Failed to open output file", "out.lc");
} }
yyparse(); rv = yyparse();
fclose(binout); fclose(binout);
fclose(yyin); fclose(yyin);
return 0; return rv;
} }
%} %}