diff options
author | Jim Meyering <jim@meyering.net> | 1996-03-24 14:58:01 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-03-24 14:58:01 +0000 |
commit | 47f70113d4342682a6408f85337676f1ccb7e8fe (patch) | |
tree | e0a69d9a12ac5b336364cc0191f2390d5061fd50 /src | |
parent | 2fa0c16e5e11ff23fb4e57246a21d9d0ef731caa (diff) | |
download | coreutils-47f70113d4342682a6408f85337676f1ccb7e8fe.tar.xz |
Exit with status EXIT_SUCCESS or EXIT_FAILURE, rather than 0 or 1.
This doesn't change `error (1' calls.
Diffstat (limited to 'src')
-rw-r--r-- | src/cat.c | 24 | ||||
-rw-r--r-- | src/cksum.c | 8 | ||||
-rw-r--r-- | src/comm.c | 7 | ||||
-rw-r--r-- | src/csplit.c | 12 | ||||
-rw-r--r-- | src/cut.c | 6 | ||||
-rw-r--r-- | src/expand.c | 6 | ||||
-rw-r--r-- | src/fmt.c | 6 | ||||
-rw-r--r-- | src/fold.c | 6 | ||||
-rw-r--r-- | src/head.c | 6 | ||||
-rw-r--r-- | src/join.c | 18 | ||||
-rw-r--r-- | src/md5sum.c | 2 | ||||
-rw-r--r-- | src/nl.c | 6 | ||||
-rw-r--r-- | src/od.c | 25 | ||||
-rw-r--r-- | src/paste.c | 6 | ||||
-rw-r--r-- | src/pr.c | 6 | ||||
-rw-r--r-- | src/split.c | 6 | ||||
-rw-r--r-- | src/sum.c | 6 | ||||
-rw-r--r-- | src/tac.c | 8 | ||||
-rw-r--r-- | src/tail.c | 6 | ||||
-rw-r--r-- | src/tr.c | 14 | ||||
-rw-r--r-- | src/unexpand.c | 6 | ||||
-rw-r--r-- | src/uniq.c | 6 | ||||
-rw-r--r-- | src/wc.c | 6 |
23 files changed, 104 insertions, 98 deletions
@@ -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); } diff --git a/src/cksum.c b/src/cksum.c index 51625972f..035b44f9c 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -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 */ diff --git a/src/comm.c b/src/comm.c index 0aaa532a0..cca8cc20d 100644 --- a/src/comm.c +++ b/src/comm.c @@ -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); } diff --git a/src/csplit.c b/src/csplit.c index 874433a69..44096be2c 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -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); } @@ -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); } diff --git a/src/expand.c b/src/expand.c index 702d2034c..de6aaa1c8 100644 --- a/src/expand.c +++ b/src/expand.c @@ -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); } @@ -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, diff --git a/src/fold.c b/src/fold.c index 5069267f3..548f4bbee 100644 --- a/src/fold.c +++ b/src/fold.c @@ -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); } diff --git a/src/head.c b/src/head.c index bac32c6d1..f3f8a9ee5 100644 --- a/src/head.c +++ b/src/head.c @@ -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); } diff --git a/src/join.c b/src/join.c index 8c973ae62..6e64cc172 100644 --- a/src/join.c +++ b/src/join.c @@ -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); } diff --git a/src/md5sum.c b/src/md5sum.c index 07ad35488..b15dd90ac 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -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. */ @@ -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); } @@ -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); } diff --git a/src/paste.c b/src/paste.c index beaf62b95..109f7b4f4 100644 --- a/src/paste.c +++ b/src/paste.c @@ -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); } @@ -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); } diff --git a/src/split.c b/src/split.c index ec2e3e1cf..554dcf947 100644 --- a/src/split.c +++ b/src/split.c @@ -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); } @@ -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); } @@ -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); } diff --git a/src/tail.c b/src/tail.c index 998970561..3df500788 100644 --- a/src/tail.c +++ b/src/tail.c @@ -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); } @@ -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); } diff --git a/src/unexpand.c b/src/unexpand.c index fe50d324e..80e1de223 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -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); } diff --git a/src/uniq.c b/src/uniq.c index 90265e410..a696974bb 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -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); } @@ -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); } |