build: accommodate new syntax-check test
authorJim Meyering <meyering@redhat.com>
Fri, 30 Oct 2009 18:52:17 +0000 (19:52 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 30 Oct 2009 18:52:17 +0000 (19:52 +0100)
* amiga/tailor.c (_expand_args): Change each of three uses of
"exit(20)" to "exit(EXIT_FAILURE)".
* sample/add.c: Include <stdlib.h>.
(main): Use EXIT_FAILURE and EXIT_SUCCESS, not 1 and 0.
* sample/sub.c (main): Likewise.
* sample/zread.c (main): Likewise.

amiga/tailor.c
sample/add.c
sample/sub.c
sample/zread.c

index 50847749e53aadb72ebb5d0110ad0c1ba6e89ce4..9207999ade5ea653292b570cf2620288c5285a3b 100644 (file)
@@ -116,7 +116,7 @@ void _expand_args (oargc, oargv)
               {
                 expand_next_file (NULL);
                 fprintf (stderr,"Too many files.\n");
-                exit (20);
+                exit (EXIT_FAILURE);
               }
             else
               {
@@ -134,7 +134,7 @@ void _expand_args (oargc, oargv)
         if (argc >= MAXARGS)
           {
             fprintf (stderr,"Too many files.\n");
-            exit (20);
+            exit (EXIT_FAILURE);
           }
         else
           {
@@ -146,7 +146,7 @@ void _expand_args (oargc, oargv)
   *oargv = argv;
   if (no_match_at_all && contains_wildcards) {
     fprintf (stderr,"No match.\n");
-    exit (20);
+    exit (EXIT_FAILURE);
   }
 }
 
index cbde9152ad1f047c105ddbe5cd8497712e36df4d..cadbc3a70f13d209f8bafa844ebe255cf0f9a1f0 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #define MAGIC1    'S' /* sub data */
 #define MAGIC2    26  /* ^Z */
@@ -25,18 +26,18 @@ int main()
   if (getchar() != MAGIC1 || getchar() != MAGIC2)
   {
     fputs("add: input stream not made by sub\n", stderr);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   /* get number of differences from data */
   if ((n = getchar()) == EOF || (i = getchar()) == EOF) {
     fputs("add: unexpected end of file\n", stderr);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
   n += (i<<8);
   if (n <= 0 || n > MAX_DIST) {
     fprintf(stderr, "add: incorrect distance %d\n", n);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   /* initialize last byte */
@@ -53,6 +54,6 @@ int main()
     if (i == n)                        /* cycle on n differences */
       i = 0;
   }
-  exit(0);
+  exit(EXIT_SUCCESS);
   return 0;                    /* avoid warning */
 }
index 7ac120c4eb13eb640e87f795e6668696dae17eb2..a06cc9bef2fa239f41cfbfdfe4fa6b016e760f8b 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #define MAGIC1    'S' /* sub data */
 #define MAGIC2    26  /* ^Z */
@@ -55,7 +56,7 @@ int main(argc, argv)
   if (argc > 2)
   {
     fputs("sub: only one argument needed--# of differences\n", stderr);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
   if (argc > 1)
     n = atoi(argv[1]);
@@ -63,7 +64,7 @@ int main(argc, argv)
   if (n < 0) n = -n;   /* tolerate "sub -2" */
   if (n == 0 || n > MAX_DIST) {
     fputs("sub: incorrect distance\n", stderr);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   /* initialize last byte */
@@ -84,6 +85,6 @@ int main(argc, argv)
     if (i == n)                                /* cycle on n differences */
       i = 0;
   }
-  exit(0);
+  exit(EXIT_SUCCESS);
   return 0; /* avoid warning */
 }
index 12c5a357106904450bc683e2223bcf8c32588d34..8492dc9c8ee75ae43acec483b15a4e558518badc 100644 (file)
@@ -1,5 +1,6 @@
 #include <config.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 /* Trivial example of reading a gzip'ed file or gzip'ed standard input
  * using stdio functions fread(), getc(), etc... fseek() is not supported.
@@ -20,7 +21,7 @@ int main(argc, argv)
 
     if (argc < 1 || argc > 2) {
        fprintf(stderr, "usage: %s [file[.gz]]\n", argv[0]);
-       exit(1);
+       exit(EXIT_FAILURE);
     }
     strcpy(cmd, "gzip -dc ");  /* use "gzip -c" for zwrite */
     if (argc == 2) {
@@ -29,13 +30,13 @@ int main(argc, argv)
     infile = popen(cmd, "r");  /* use "w" for zwrite */
     if (infile == NULL) {
        fprintf(stderr, "%s: popen('%s', 'r') failed\n", argv[0], cmd);
-       exit(1);
+       exit(EXIT_FAILURE);
     }
     /* Read one byte using getc: */
     n = getc(infile);
     if (n == EOF) {
        pclose(infile);
-       exit(0);
+       exit(EXIT_SUCCESS);
     }
     putchar(n);
 
@@ -47,8 +48,8 @@ int main(argc, argv)
     }
     if (pclose(infile) != 0) {
        fprintf(stderr, "%s: pclose failed\n", argv[0]);
-       exit(1);
+       exit(EXIT_FAILURE);
     }
-    exit(0);
+    exit(EXIT_SUCCESS);
     return 0; /* just to make compiler happy */
 }