Blame 0099-Replaced-plain-0-s-and-1-s-in-exit-statements-with-E.patch

073ecbe
From 7bae9038cfc1ff25a6845c050a4a0d6a98fd47a9 Mon Sep 17 00:00:00 2001
073ecbe
From: mc78 <mc78@outlook.de>
073ecbe
Date: Mon, 11 Nov 2019 16:30:09 +0100
a4f04fe
Subject: [PATCH 099/170] Replaced plain 0's and 1's in exit statements with
073ecbe
 EXIT_SUCCESS or EXIT_FAILURE
073ecbe
073ecbe
---
073ecbe
 samples/geos/getid.c       | 2 +-
073ecbe
 samples/geos/hello1.c      | 2 +-
073ecbe
 samples/geos/hello2.c      | 2 +-
073ecbe
 test/ref/hanoi.c           | 2 +-
073ecbe
 test/ref/wf1.c             | 2 +-
073ecbe
 testcode/lib/getopt-test.c | 6 ++++--
073ecbe
 testcode/lib/shift-test.c  | 6 +++---
073ecbe
 7 files changed, 12 insertions(+), 10 deletions(-)
073ecbe
073ecbe
diff --git a/samples/geos/getid.c b/samples/geos/getid.c
073ecbe
index 4331e27e..200a1478 100644
073ecbe
--- a/samples/geos/getid.c
073ecbe
+++ b/samples/geos/getid.c
073ecbe
@@ -16,7 +16,7 @@ const graphicStr Table = {
073ecbe
 
073ecbe
 void Exit(void)
073ecbe
 {
073ecbe
-    exit(0);
073ecbe
+    exit(EXIT_SUCCESS);
073ecbe
 }
073ecbe
 
073ecbe
 void Menu = {
073ecbe
diff --git a/samples/geos/hello1.c b/samples/geos/hello1.c
073ecbe
index fd46d157..8dc13d5b 100644
073ecbe
--- a/samples/geos/hello1.c
073ecbe
+++ b/samples/geos/hello1.c
073ecbe
@@ -26,7 +26,7 @@ void main (void)
073ecbe
     //  MainLoop();
073ecbe
     // we can do:
073ecbe
     //  (nothing as this is the end of main function)
073ecbe
-    //  exit(0);
073ecbe
+    //  exit(EXIT_SUCCESS);
073ecbe
     //  return;
073ecbe
 
073ecbe
     return;
073ecbe
diff --git a/samples/geos/hello2.c b/samples/geos/hello2.c
073ecbe
index d41bdb3c..3f148b0b 100644
073ecbe
--- a/samples/geos/hello2.c
073ecbe
+++ b/samples/geos/hello2.c
073ecbe
@@ -44,7 +44,7 @@ void main (void)
073ecbe
     //  MainLoop();
073ecbe
     // we can do:
073ecbe
     //  (nothing as this is the end of main function)
073ecbe
-    //  exit(0);
073ecbe
+    //  exit(EXIT_SUCCESS);
073ecbe
     //  return;
073ecbe
 
073ecbe
     return;
073ecbe
diff --git a/test/ref/hanoi.c b/test/ref/hanoi.c
073ecbe
index 5198c5c6..14bc60fa 100644
073ecbe
--- a/test/ref/hanoi.c
073ecbe
+++ b/test/ref/hanoi.c
073ecbe
@@ -62,7 +62,7 @@ int main(int argc,char **argv)
073ecbe
         #ifdef USECMDLINE
073ecbe
         if (argc < 2) {
073ecbe
                 printf("Usage: %s [duration] [disks]\n", argv[0]);
073ecbe
-                exit(1);
073ecbe
+                exit(EXIT_FAILURE);
073ecbe
         }
073ecbe
         else
073ecbe
         {
073ecbe
diff --git a/test/ref/wf1.c b/test/ref/wf1.c
073ecbe
index 1c3bfbd3..e1ed7a41 100644
073ecbe
--- a/test/ref/wf1.c
073ecbe
+++ b/test/ref/wf1.c
073ecbe
@@ -45,7 +45,7 @@ err(s) char *s; {
073ecbe
 int err(char *s) {
073ecbe
 #endif
073ecbe
         printf("? %s\n", s);
073ecbe
-        exit(1);
073ecbe
+        exit(EXIT_FAILURE);
073ecbe
 }
073ecbe
 
073ecbe
 /* getword - get next input word into buf, return 0 on EOF */
073ecbe
diff --git a/testcode/lib/getopt-test.c b/testcode/lib/getopt-test.c
073ecbe
index 2f115541..b5639b7c 100644
073ecbe
--- a/testcode/lib/getopt-test.c
073ecbe
+++ b/testcode/lib/getopt-test.c
073ecbe
@@ -22,6 +22,8 @@
073ecbe
 #define BADCH    '?'
073ecbe
 #define ENDARGS  "--"
073ecbe
 
073ecbe
+#define NUMARGS 2
073ecbe
+
073ecbe
 int main (int argc, char **argv)
073ecbe
 {
073ecbe
     char *optstring = argv[1];
073ecbe
@@ -34,9 +36,9 @@ int main (int argc, char **argv)
073ecbe
 
073ecbe
     char *opi;
073ecbe
 
073ecbe
-    if (argc == 1) {
073ecbe
+    if (argc != NUMARGS) {
073ecbe
         fprintf (stderr, "Usage: %s optstring args\n", argv0);
073ecbe
-        exit (1);
073ecbe
+        exit (EXIT_FAILURE);
073ecbe
     }
073ecbe
     argv++;
073ecbe
     argc--;
073ecbe
diff --git a/testcode/lib/shift-test.c b/testcode/lib/shift-test.c
073ecbe
index 5712f453..27c7d88a 100644
073ecbe
--- a/testcode/lib/shift-test.c
073ecbe
+++ b/testcode/lib/shift-test.c
073ecbe
@@ -58,7 +58,7 @@ static void TestUnsignedLeftShift (void)
073ecbe
                 fprintf (stderr,
073ecbe
                          "Failed: %u << %u != %u (%u)\n",
073ecbe
                          L, R, V, L << R);
073ecbe
-                exit (1);
073ecbe
+                exit (EXIT_FAILURE);
073ecbe
             }
073ecbe
             V = UnsignedShiftLeft1 (V);
073ecbe
         }
073ecbe
@@ -85,7 +85,7 @@ static void TestUnsignedRightShift (void)
073ecbe
                 fprintf (stderr,
073ecbe
                          "Failed: %u >> %u != %u (%u)\n",
073ecbe
                          L, R, V, L >> R);
073ecbe
-                exit (1);
073ecbe
+                exit (EXIT_FAILURE);
073ecbe
             }
073ecbe
             V = UnsignedShiftRight1 (V);
073ecbe
         }
073ecbe
@@ -112,7 +112,7 @@ static void TestSignedRightShift (void)
073ecbe
                 fprintf (stderr,
073ecbe
                          "Failed: %d >> %d != %d (%d)\n",
073ecbe
                          L, R, V, L >> R);
073ecbe
-                exit (1);
073ecbe
+                exit (EXIT_FAILURE);
073ecbe
             }
073ecbe
             V = SignedShiftRight1 (V);
073ecbe
         }
073ecbe
-- 
a4f04fe
2.26.0
073ecbe