This doesn't change `error (1' calls.
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)
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. */
if (n_read < 0)
{
error (0, errno, "%s", infile);
- exit_stat = 1;
+ exit_status = 1;
return;
}
else
{
error (0, errno, _("cannot do ioctl on `%s'"), infile);
- exit_stat = 1;
+ exit_status = 1;
newlines2 = newlines;
return;
}
if (n_read < 0)
{
error (0, errno, "%s", infile);
- exit_stat = 1;
+ exit_status = 1;
newlines2 = newlines;
return;
}
break;
default:
- usage (2);
+ usage (EXIT_FAILURE);
}
}
if (show_version)
{
printf ("cat - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (input_desc < 0)
{
error (0, errno, "%s", infile);
- exit_stat = 1;
+ exit_status = 1;
continue;
}
}
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);
&& (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;
}
if (strcmp (infile, "-") && close (input_desc) < 0)
{
error (0, errno, "%s", infile);
- exit_stat = 1;
+ exit_status = 1;
}
}
while (++argind < argc);
if (close (1) < 0)
error (1, errno, _("write error"));
- exit (exit_stat);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
remainder (i * 5 + 4), remainder (i * 5 + 5));
}
printf ("\n};\n");
- exit (0);
+ exit (EXIT_SUCCESS);
}
#else /* !CRCTAB */
--version output version information and exit\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
if (show_version)
{
printf ("cksum - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (have_read_stdin && fclose (stdin) == EOF)
error (1, errno, "-");
- exit (errors);
+ exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
#endif /* !CRCTAB */
--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
if (show_version)
{
printf ("comm - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (optind + 2 != argc)
usage (1);
- exit (compare_files (argv + optind));
+ exit (compare_files (argv + optind) == 0
+ ? EXIT_SUCCESS : EXIT_FAILURE);
}
cleanup_fatal (void)
{
cleanup ();
- exit (1);
+ exit (EXIT_FAILURE);
}
static RETSIGTYPE
dump_rest_of_file ();
close_output_file ();
}
- exit (0);
+ exit (EXIT_SUCCESS);
}
else
regexp_error (p, repetition, ignore);
dump_rest_of_file ();
close_output_file ();
}
- exit (0);
+ exit (EXIT_SUCCESS);
}
else
regexp_error (p, repetition, ignore);
if (show_version)
{
printf ("csplit - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
cleanup_fatal ();
}
- exit (0);
+ exit (EXIT_SUCCESS);
}
static void
A line OFFSET is a required `+' or `-' followed by a positive integer.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
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:
if (show_version)
{
printf ("cut - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (ferror (stdout) || fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
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
if (show_version)
{
printf ("expand - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (ferror (stdout) || fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
In -wNUMBER, the letter `w' may be omitted.\n"),
stdout);
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Decode options and launch execution. */
if (show_version)
{
printf ("fmt - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
error (0, errno, argv[optind]);
}
- exit (0);
+ exit (EXIT_SUCCESS);
}
/* Trim space from the front and back of the string P, yielding the prefix,
-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
if (show_version)
{
printf ("fold - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (errs);
+ exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
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.
if (show_version)
{
printf ("head - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
separated by CHAR.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Like memcmp, but ignore differences in case. */
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
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;
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':
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'. */
if (ferror (stdout) || fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (0);
+ exit (EXIT_SUCCESS);
}
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. */
\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Build the printf format string, based on `lineno_format'. */
if (show_version)
{
printf ("nl - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (ferror (stdout) || fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
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
}
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;
}
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;
}
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;
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':
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;
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);
}
\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
if (show_version)
{
printf ("paste - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
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);
}
if (show_version)
{
printf ("pr - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
error (1, errno, _("write error"));
if (failed_opens > 0)
exit(1);
- exit (0);
+ exit (EXIT_SUCCESS);
}
/* Parse options of the form -scNNN.
spaces. With no FILE, or when FILE is -, read standard input.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
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
if (show_version)
{
printf ("split - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (output_desc >= 0 && close (output_desc) < 0)
error (1, errno, "%s", outfile);
- exit (0);
+ exit (EXIT_SUCCESS);
}
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
if (show_version)
{
printf ("sum - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (have_read_stdin && fclose (stdin) == EOF)
error (1, errno, "-");
- exit (errors);
+ exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
--version output version information and exit\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
static void
cleanup_fatal (void)
{
cleanup ();
- exit (1);
+ exit (EXIT_FAILURE);
}
static RETSIGTYPE
if (show_version)
{
printf ("tac - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
error (1, errno, "-");
if (close (1) < 0)
error (1, errno, _("write error"));
- exit (errors);
+ exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
or -c +VALUE.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
static void
if (show_version)
{
printf ("tail - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
error (1, errno, "-");
if (fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
translation or deletion.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Return nonzero if the character C is a member of the
if (show_version)
{
printf ("tr - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
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;
}
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);
}
Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
if (show_version)
{
printf ("unexpand - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
error (1, errno, "-");
if (fclose (stdout) == EOF)
error (1, errno, _("write error"));
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
Fields are skipped before chars. \n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Given a linebuffer LINE,
if (show_version)
{
printf ("uniq - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
check_file (infile, outfile);
- exit (0);
+ exit (EXIT_SUCCESS);
}
--version output version information and exit\n\
"));
}
- exit (status);
+ exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
static void
if (show_version)
{
printf ("wc - %s\n", PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
if (have_read_stdin && close (0))
error (1, errno, "-");
- exit (exit_status);
+ exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}