From 5ca3209b44b086e21ba82f038e8b82b40c6f33cc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Oct 2002 05:07:12 +0000 Subject: [PATCH] (main): Use exit to exit with failure. Use EXIT_FAILURE and EXIT_SUCCESS rather than 1 and 0. --- src/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index b5a8e001..dc28693f 100644 --- a/src/main.c +++ b/src/main.c @@ -73,8 +73,8 @@ main (int argc, char *argv[]) reader (); timevar_pop (TV_READER); - if (complain_message_count) - exit (1); + if (complaint_issued) + exit (EXIT_FAILURE); /* Find useless nonterminals and productions and reduce the grammar. */ timevar_push (TV_REDUCE); @@ -137,8 +137,8 @@ main (int argc, char *argv[]) /* Stop if there were errors, to avoid trashing previous output files. */ - if (complain_message_count) - exit (1); + if (complaint_issued) + exit (EXIT_FAILURE); /* Lookaheads are no longer needed. */ timevar_push (TV_FREE); @@ -177,5 +177,10 @@ main (int argc, char *argv[]) timevar_stop (TV_TOTAL); timevar_print (stderr); - return complain_message_count ? EXIT_FAILURE : EXIT_SUCCESS; + /* Some ancient SunOS versions exit (0) if main returns, so use + `exit' to exit with nonzero status. */ + if (complaint_issued) + exit (EXIT_FAILURE); + + return EXIT_SUCCESS; } -- 2.47.2