Commit f7d4a1c9 by Richard Stallman

Use FATAL_EXIT_CODE rather than hardcoded 1 for fatal error.

(main): Flush stdout and and check for errors prior to termination;
end with call to exit rather than return from main, as with gen*.c.

From-SVN: r6078
parent e31f69f1
...@@ -54,6 +54,10 @@ main () ...@@ -54,6 +54,10 @@ main ()
printf ("0"); printf ("0");
printf ("}},\n"); printf ("}},\n");
} }
fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */
return 0; return 0;
} }
...@@ -68,7 +72,7 @@ xmalloc (nbytes) ...@@ -68,7 +72,7 @@ xmalloc (nbytes)
if (!tmp) if (!tmp)
{ {
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
exit (1); exit (FATAL_EXIT_CODE);
} }
return tmp; return tmp;
......
...@@ -50,6 +50,9 @@ enum bytecode_opcode\n{"); ...@@ -50,6 +50,9 @@ enum bytecode_opcode\n{");
else else
fprintf (stderr, "(Number of opcodes is %d)\n", i); fprintf (stderr, "(Number of opcodes is %d)\n", i);
fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */
return 0; return 0;
} }
...@@ -64,7 +67,7 @@ xmalloc (nbytes) ...@@ -64,7 +67,7 @@ xmalloc (nbytes)
if (!tmp) if (!tmp)
{ {
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
exit (1); exit (FATAL_EXIT_CODE);
} }
return tmp; return tmp;
......
...@@ -33,6 +33,10 @@ main() ...@@ -33,6 +33,10 @@ main()
for (d = defs; d; d = d->next) for (d = defs; d; d = d->next)
for (v = d->variations; v; v = v->next) for (v = d->variations; v; v = v->next)
printf("\"%s%s\",\n", d->basename, v->name); printf("\"%s%s\",\n", d->basename, v->name);
fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */
return 0; return 0;
} }
...@@ -47,7 +51,7 @@ xmalloc (nbytes) ...@@ -47,7 +51,7 @@ xmalloc (nbytes)
if (!tmp) if (!tmp)
{ {
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
exit (1); exit (FATAL_EXIT_CODE);
} }
return tmp; return tmp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment