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