m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/src/Attic/builtin.c,v [branch-1_4]


From: Eric Blake
Subject: Changes to m4/src/Attic/builtin.c,v [branch-1_4]
Date: Mon, 24 Jul 2006 20:02:18 +0000

CVSROOT:        /sources/m4
Module name:    m4
Branch:         branch-1_4
Changes by:     Eric Blake <ericb>      06/07/24 20:02:16

Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.26
retrieving revision 1.1.1.1.2.27
diff -u -b -r1.1.1.1.2.26 -r1.1.1.1.2.27
--- src/builtin.c       17 Jul 2006 16:35:12 -0000      1.1.1.1.2.26
+++ src/builtin.c       24 Jul 2006 20:02:16 -0000      1.1.1.1.2.27
@@ -1257,13 +1257,29 @@
 static void
 m4_m4exit (struct obstack *obs, int argc, token_data **argv)
 {
-  int exit_code = 0;
+  int exit_code = EXIT_SUCCESS;
 
-  if (bad_argc (argv[0], argc, 1, 2))
-    return;
+  /* Warn on bad arguments, but still exit.  */
+  bad_argc (argv[0], argc, 1, 2);
   if (argc >= 2  && !numeric_arg (argv[0], ARG (1), &exit_code))
-    exit_code = 0;
-
+    exit_code = EXIT_FAILURE;
+  if (exit_code < 0 || exit_code > 255)
+    {
+      M4ERROR ((warning_status, 0,
+                "exit status out of range: `%d'", exit_code));
+      exit_code = EXIT_FAILURE;
+    }
+  if (close_stream (stdout) != 0)
+    {
+      M4ERROR ((warning_status, errno, "write error"));
+      if (exit_code == 0)
+        exit_code = EXIT_FAILURE;
+    }
+  /* Change debug stream back to stderr, to force flushing debug stream and
+     detect any errors it might have encountered.  */
+  debug_set_output (NULL);
+  if (exit_code == 0 && retcode != 0)
+    exit_code = retcode;
   exit (exit_code);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]