Exit with status EXIT_SUCCESS or EXIT_FAILURE, rather than 0 or 1.
authorJim Meyering <jim@meyering.net>
Sun, 24 Mar 1996 14:58:01 +0000 (14:58 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 24 Mar 1996 14:58:01 +0000 (14:58 +0000)
This doesn't change `error (1' calls.

23 files changed:
src/cat.c
src/cksum.c
src/comm.c
src/csplit.c
src/cut.c
src/expand.c
src/fmt.c
src/fold.c
src/head.c
src/join.c
src/md5sum.c
src/nl.c
src/od.c
src/paste.c
src/pr.c
src/split.c
src/sum.c
src/tac.c
src/tail.c
src/tr.c
src/unexpand.c
src/uniq.c
src/wc.c

index e141e4d..f899e11 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -72,7 +72,7 @@ static char *line_num_end = line_buf + 10;
 static int newlines2 = 0;
 
 /* Count of non-fatal error conditions.  */
-static int exit_stat = 0;
+static int exit_status = 0;
 
 static void
 usage (int status)
@@ -105,7 +105,7 @@ Concatenate FILE(s), or standard input, to standard output.\n\
 With no FILE, or when FILE is -, read standard input.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Compute the next line number.  */
@@ -151,7 +151,7 @@ simple_cat (
       if (n_read < 0)
        {
          error (0, errno, "%s", infile);
-         exit_stat = 1;
+         exit_status = 1;
          return;
        }
 
@@ -286,7 +286,7 @@ cat (
                  else
                    {
                      error (0, errno, _("cannot do ioctl on `%s'"), infile);
-                     exit_stat = 1;
+                     exit_status = 1;
                      newlines2 = newlines;
                      return;
                    }
@@ -307,7 +307,7 @@ cat (
              if (n_read < 0)
                {
                  error (0, errno, "%s", infile);
-                 exit_stat = 1;
+                 exit_status = 1;
                  newlines2 = newlines;
                  return;
                }
@@ -573,14 +573,14 @@ main (int argc, char **argv)
          break;
 
        default:
-         usage (2);
+         usage (EXIT_FAILURE);
        }
     }
 
   if (show_version)
     {
       printf ("cat - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -637,7 +637,7 @@ main (int argc, char **argv)
          if (input_desc < 0)
            {
              error (0, errno, "%s", infile);
-             exit_stat = 1;
+             exit_status = 1;
              continue;
            }
        }
@@ -645,7 +645,7 @@ main (int argc, char **argv)
       if (fstat (input_desc, &stat_buf) < 0)
        {
          error (0, errno, "%s", infile);
-         exit_stat = 1;
+         exit_status = 1;
          goto contin;
        }
       insize = ST_BLKSIZE (stat_buf);
@@ -660,7 +660,7 @@ main (int argc, char **argv)
          && (input_desc != fileno (stdin) || output_desc != fileno (stdout)))
        {
          error (0, 0, _("%s: input file is output file"), infile);
-         exit_stat = 1;
+         exit_status = 1;
          goto contin;
        }
 
@@ -710,7 +710,7 @@ main (int argc, char **argv)
       if (strcmp (infile, "-") && close (input_desc) < 0)
        {
          error (0, errno, "%s", infile);
-         exit_stat = 1;
+         exit_status = 1;
        }
     }
   while (++argind < argc);
@@ -720,5 +720,5 @@ main (int argc, char **argv)
   if (close (1) < 0)
     error (1, errno, _("write error"));
 
-  exit (exit_stat);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 5162597..035b44f 100644 (file)
@@ -99,7 +99,7 @@ main ()
              remainder (i * 5 + 4), remainder (i * 5 + 5));
     }
   printf ("\n};\n");
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 #else /* !CRCTAB */
@@ -276,7 +276,7 @@ Print CRC checksum and byte counts of each FILE.\n\
   --version   output version information and exit\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 int
@@ -307,7 +307,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("cksum - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -327,7 +327,7 @@ main (int argc, char **argv)
 
   if (have_read_stdin && fclose (stdin) == EOF)
     error (1, errno, "-");
-  exit (errors);
+  exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 #endif /* !CRCTAB */
index 0aaa532..cca8cc2 100644 (file)
@@ -79,7 +79,7 @@ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\
       --version   output version information and exit\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Output the line in linebuffer LINE to stream STREAM
@@ -250,7 +250,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("comm - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -259,5 +259,6 @@ main (int argc, char **argv)
   if (optind + 2 != argc)
     usage (1);
 
-  exit (compare_files (argv + optind));
+  exit (compare_files (argv + optind) == 0
+       ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 874433a..44096be 100644 (file)
@@ -259,7 +259,7 @@ static void
 cleanup_fatal (void)
 {
   cleanup ();
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 static RETSIGTYPE
@@ -904,7 +904,7 @@ process_regexp (struct control *p, int repetition)
                      dump_rest_of_file ();
                      close_output_file ();
                    }
-                 exit (0);
+                 exit (EXIT_SUCCESS);
                }
              else
                regexp_error (p, repetition, ignore);
@@ -944,7 +944,7 @@ process_regexp (struct control *p, int repetition)
                      dump_rest_of_file ();
                      close_output_file ();
                    }
-                 exit (0);
+                 exit (EXIT_SUCCESS);
                }
              else
                regexp_error (p, repetition, ignore);
@@ -1512,7 +1512,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("csplit - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -1541,7 +1541,7 @@ main (int argc, char **argv)
       cleanup_fatal ();
     }
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 static void
@@ -1580,5 +1580,5 @@ Read standard input if FILE is -.  Each PATTERN may be:\n\
 A line OFFSET is a required `+' or `-' followed by a positive integer.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 63490ce..a8681d5 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -221,7 +221,7 @@ range, or many ranges separated by commas.  Each range is one of:\n\
 With no FILE, or when FILE is -, read standard input.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* The following function was copied from getline.c, but with these changes:
@@ -737,7 +737,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("cut - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -770,5 +770,5 @@ main (int argc, char **argv)
   if (ferror (stdout) || fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 702d203..de6aaa1 100644 (file)
@@ -129,7 +129,7 @@ With no FILE, or when FILE is -, read standard input.\n\
 Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Add tab stop TABVAL to the end of `tab_list', except
@@ -368,7 +368,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("expand - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -397,5 +397,5 @@ main (int argc, char **argv)
   if (ferror (stdout) || fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index dc03b7a..48340da 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -301,7 +301,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
 In -wNUMBER, the letter `w' may be omitted.\n"),
             stdout);
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Decode options and launch execution.  */
@@ -398,7 +398,7 @@ main (register int argc, register char **argv)
   if (show_version)
     {
       printf ("fmt - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -424,7 +424,7 @@ main (register int argc, register char **argv)
            error (0, errno, argv[optind]);
        }
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 /* Trim space from the front and back of the string P, yielding the prefix,
index 5069267..548f4bb 100644 (file)
@@ -94,7 +94,7 @@ standard output.\n\
   -w, --width=WIDTH   use WIDTH columns instead of 80\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Assuming the current column is COLUMN, return the column that
@@ -309,7 +309,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("fold - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -326,5 +326,5 @@ main (int argc, char **argv)
   if (fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (errs);
+  exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index bac32c6..f3f8a9e 100644 (file)
@@ -106,7 +106,7 @@ If -VALUE is used as first OPTION, read -c VALUE when one of\n\
 multipliers bkm follows concatenated, else read -n VALUE.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Convert STR, a string of ASCII digits, into an unsigned integer.
@@ -353,7 +353,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("head - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -380,5 +380,5 @@ main (int argc, char **argv)
   if (fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 8c973ae..6e64cc1 100644 (file)
@@ -198,7 +198,7 @@ the remaining fields from FILE1, the remaining fields from FILE2, all\n\
 separated by CHAR.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Like memcmp, but ignore differences in case.  */
@@ -803,7 +803,7 @@ main (int argc, char **argv)
        case 'a':
          if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
              || (val != 1 && val != 2))
-           error (2, 0, _("invalid field number: `%s'"), optarg);
+           error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
          if (val == 1)
            print_unpairables_1 = 1;
          else
@@ -822,7 +822,8 @@ main (int argc, char **argv)
          if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
              || val <= 0 || val > INT_MAX)
            {
-             error (2, 0, _("invalid field number for file 1: `%s'"), optarg);
+             error (EXIT_FAILURE, 0,
+                    _("invalid field number for file 1: `%s'"), optarg);
            }
          join_field_1 = (int) val - 1;
          break;
@@ -830,20 +831,21 @@ main (int argc, char **argv)
        case '2':
          if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
              || val <= 0 || val > INT_MAX)
-           error (2, 0, _("invalid field number for file 2: `%s'"), optarg);
+           error (EXIT_FAILURE, 0,
+                  _("invalid field number for file 2: `%s'"), optarg);
          join_field_2 = (int) val - 1;
          break;
 
        case 'j':
          if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
              || val <= 0 || val > INT_MAX)
-           error (2, 0, _("invalid field number: `%s'"), optarg);
+           error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
          join_field_1 = join_field_2 = (int) val - 1;
          break;
 
        case 'o':
          if (add_field_list (optarg))
-           exit (1);
+           exit (EXIT_FAILURE);
          break;
 
        case 't':
@@ -854,7 +856,7 @@ main (int argc, char **argv)
          if (prev_optc == 'o' && optind <= argc - 2)
            {
              if (add_field_list (optarg))
-               exit (1);
+               exit (EXIT_FAILURE);
 
              /* Might be continuation of args to -o.  */
              continue;         /* Don't change `prev_optc'.  */
@@ -903,5 +905,5 @@ main (int argc, char **argv)
   if (ferror (stdout) || fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
index 07ad354..b15dd90 100644 (file)
@@ -118,7 +118,7 @@ a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
 text), and name for each FILE.\n"),
            program_name, program_name, program_name);
 
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* FIXME: this format loses with filenames containing newline.  */
index b4e277b..591e015 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -230,7 +230,7 @@ FORMAT is one of:\n\
 \n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Build the printf format string, based on `lineno_format'. */
@@ -578,7 +578,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("nl - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -629,5 +629,5 @@ main (int argc, char **argv)
   if (ferror (stdout) || fclose (stdout) == EOF)
     error (1, errno, _("write error"));
 
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index fb33039..31ef964 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -386,7 +386,7 @@ number implies 3.  -w without a number implies 32.  By default, od\n\
 uses -A o -t d2 -w 16.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Compute the greatest common denominator of U and V
@@ -1037,7 +1037,7 @@ skip (off_t n_skip)
     }
 
   if (n_skip != 0)
-    error (2, 0, _("cannot skip past end of combined input"));
+    error (EXIT_FAILURE, 0, _("cannot skip past end of combined input"));
 
   return err;
 }
@@ -1654,8 +1654,9 @@ main (int argc, char **argv)
              address_pad_len = 0;
              break;
            default:
-             error (2, 0,
-                    _("invalid output address radix `%c'; it must be one character from [doxn]"),
+             error (EXIT_FAILURE, 0,
+                    _("invalid output address radix `%c'; \
+it must be one character from [doxn]"),
                     optarg[0]);
              break;
            }
@@ -1679,7 +1680,8 @@ main (int argc, char **argv)
            STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err);
 
          if (tmp > OFF_T_MAX)
-           error (2, 0, _("specified number of bytes `%s' is larger than \
+           error (EXIT_FAILURE, 0,
+                  _("specified number of bytes `%s' is larger than \
 the maximum\nrepresentable value of type off_t"), optarg);
          break;
 
@@ -1697,7 +1699,7 @@ the maximum\nrepresentable value of type off_t"), optarg);
 
        case 't':
          if (decode_format_string (optarg))
-           error (2, 0, _("invalid type string `%s'"), optarg);
+           error (EXIT_FAILURE, 0, _("invalid type string `%s'"), optarg);
          break;
 
        case 'v':
@@ -1758,14 +1760,15 @@ the maximum\nrepresentable value of type off_t"), optarg);
   if (show_version)
     {
       printf ("od - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
     usage (0);
 
   if (flag_dump_strings && n_specs > 0)
-    error (2, 0, _("no type may be specified when dumping strings"));
+    error (EXIT_FAILURE, 0,
+          _("no type may be specified when dumping strings"));
 
   n_files = argc - optind;
 
@@ -1928,10 +1931,10 @@ the maximum\nrepresentable value of type off_t"), optarg);
 cleanup:;
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    error (2, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
 
   if (fclose (stdout) == EOF)
-    error (2, errno, _("write error"));
+    error (EXIT_FAILURE, errno, _("write error"));
 
-  exit (err);
+  exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index beaf62b..109f7b4 100644 (file)
@@ -426,7 +426,7 @@ With no FILE, or when FILE is -, read standard input.\n\
 \n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 int
@@ -473,7 +473,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("paste - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -492,5 +492,5 @@ main (int argc, char **argv)
     error (1, errno, "-");
   if (ferror (stdout) || fclose (stdout) == EOF)
     error (1, errno, _("write error"));
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index fb6b7c8..02a3fe8 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -617,7 +617,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("pr - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -661,7 +661,7 @@ main (int argc, char **argv)
     error (1, errno, _("write error"));
   if (failed_opens > 0)
     exit(1);
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 /* Parse options of the form -scNNN.
@@ -1884,5 +1884,5 @@ Paginate or columnate FILE(s) for printing.\n\
 spaces.  With no FILE, or when FILE is -, read standard input.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index ec2e3e1..554dcf9 100644 (file)
@@ -121,7 +121,7 @@ PREFIX is `x'.  With no INPUT, or when INPUT is -, read standard input.\n\
 SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Compute the next sequential output file name suffix and store it
@@ -454,7 +454,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("split - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -538,5 +538,5 @@ main (int argc, char **argv)
   if (output_desc >= 0 && close (output_desc) < 0)
     error (1, errno, "%s", outfile);
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
index 7995d65..267b1b1 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -75,7 +75,7 @@ Print checksum and block counts for each FILE.\n\
 With no FILE, or when FILE is -, read standard input.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Calculate and print the rotated checksum and the size in 1K blocks
@@ -235,7 +235,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("sum - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -254,6 +254,6 @@ main (int argc, char **argv)
 
   if (have_read_stdin && fclose (stdin) == EOF)
     error (1, errno, "-");
-  exit (errors);
+  exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
index 726d5ef..350578b 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -145,7 +145,7 @@ With no FILE, or when FILE is -, read standard input.\n\
       --version            output version information and exit\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 static void
@@ -158,7 +158,7 @@ static void
 cleanup_fatal (void)
 {
   cleanup ();
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 static RETSIGTYPE
@@ -622,7 +622,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("tac - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -681,5 +681,5 @@ main (int argc, char **argv)
     error (1, errno, "-");
   if (close (1) < 0)
     error (1, errno, _("write error"));
-  exit (errors);
+  exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 9989705..3df5007 100644 (file)
@@ -165,7 +165,7 @@ the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\
 or -c +VALUE.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 static void
@@ -970,7 +970,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("tail - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -1015,5 +1015,5 @@ main (int argc, char **argv)
     error (1, errno, "-");
   if (fclose (stdout) == EOF)
     error (1, errno, _("write error"));
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index e763570..19048f4 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -413,7 +413,7 @@ translating nor deleting; else squeezing uses SET2 and occurs after\n\
 translation or deletion.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Return nonzero if the character C is a member of the
@@ -1832,7 +1832,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("tr - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -1882,13 +1882,13 @@ without squeezing repeats"));
 
   spec_init (s1);
   if (parse_str ((unsigned char *) argv[optind], s1))
-    exit (1);
+    exit (EXIT_FAILURE);
 
   if (non_option_args == 2)
     {
       spec_init (s2);
       if (parse_str ((unsigned char *) argv[optind + 1], s2))
-       exit (1);
+       exit (EXIT_FAILURE);
     }
   else
     s2 = NULL;
@@ -1993,10 +1993,10 @@ without squeezing repeats"));
     }
 
   if (fclose (stdout) == EOF)
-    error (2, errno, _("write error"));
+    error (EXIT_FAILURE, errno, _("write error"));
 
   if (close (0) != 0)
-    error (2, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
index fe50d32..80e1de2 100644 (file)
@@ -373,7 +373,7 @@ With no FILE, or when FILE is -, read standard input.\n\
 Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 int
@@ -425,7 +425,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("unexpand - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -453,5 +453,5 @@ main (int argc, char **argv)
     error (1, errno, "-");
   if (fclose (stdout) == EOF)
     error (1, errno, _("write error"));
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 90265e4..a696974 100644 (file)
@@ -129,7 +129,7 @@ A field is a run of whitespace, than non-whitespace characters.\n\
 Fields are skipped before chars. \n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 /* Given a linebuffer LINE,
@@ -363,7 +363,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("uniq - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -396,5 +396,5 @@ main (int argc, char **argv)
 
   check_file (infile, outfile);
 
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
index 5338b0e..9b98d45 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -86,7 +86,7 @@ read standard input.\n\
       --version          output version information and exit\n\
 "));
     }
-  exit (status);
+  exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 static void
@@ -293,7 +293,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       printf ("wc - %s\n", PACKAGE_VERSION);
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   if (show_help)
@@ -321,5 +321,5 @@ main (int argc, char **argv)
   if (have_read_stdin && close (0))
     error (1, errno, "-");
 
-  exit (exit_status);
+  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }