/* Write this block out. */
if (full_write (output_desc, buf, n_read) < 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
}
}
do
{
if (full_write (output_desc, wp, outsize) < 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
wp += outsize;
}
while (bpout - wp >= outsize);
int n_write = bpout - outbuf;
if (full_write (output_desc, outbuf, n_write) < 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
bpout = outbuf;
}
/* Get device, i-node number, and optimal blocksize of output. */
if (fstat (output_desc, &stat_buf) < 0)
- error (1, errno, _("standard output"));
+ error (EXIT_FAILURE, errno, _("standard output"));
outsize = ST_BLKSIZE (stat_buf);
/* Input file can be output file for non-regular files.
while (++argind < argc);
if (have_read_stdin && close (0) < 0)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (close (1) < 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
}
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
get_first_line_in_buffer (void)
{
if (head == NULL && !load_buffer ())
- error (1, errno, _("input disappeared"));
+ error (EXIT_FAILURE, errno, _("input disappeared"));
return head->first_available;
}
{
input_desc = open (name, O_RDONLY);
if (input_desc < 0)
- error (1, errno, "%s", name);
+ error (EXIT_FAILURE, errno, "%s", name);
}
}
unsigned long val;
if (*num != '-' && *num != '+')
- error (1, 0, _("%s: `+' or `-' expected after delimeter"), str);
+ error (EXIT_FAILURE, 0, _("%s: `+' or `-' expected after delimeter"), str);
if (xstrtoul (num + 1, NULL, 10, &val, NULL) != LONGINT_OK
|| val > UINT_MAX)
- error (1, 0, _("%s: integer expected after `%c'"), str, *num);
+ error (EXIT_FAILURE, 0, _("%s: integer expected after `%c'"), str, *num);
p->offset = (unsigned int) val;
if (*num == '-')
end = str + strlen (str) - 1;
if (*end != '}')
- error (1, 0, _("%s: `}' is required in repeat count"), str);
+ error (EXIT_FAILURE, 0, _("%s: `}' is required in repeat count"), str);
*end = '\0';
if (str+1 == end-1 && *(str+1) == '*')
if (xstrtoul (str + 1, NULL, 10, &val, NULL) != LONGINT_OK
|| val > UINT_MAX)
{
- error (1, 0, _("%s}: integer required between `{' and `}'"),
+ error (EXIT_FAILURE, 0,
+ _("%s}: integer required between `{' and `}'"),
global_argv[argnum]);
}
p->repeat = (unsigned int) val;
closing_delim = strrchr (str + 1, delim);
if (closing_delim == NULL)
- error (1, 0, _("%s: closing delimeter `%c' missing"), str, delim);
+ error (EXIT_FAILURE, 0,
+ _("%s: closing delimeter `%c' missing"), str, delim);
len = closing_delim - str - 1;
p = new_control_record ();
if (xstrtoul (argv[i], NULL, 10, &val, NULL) != LONGINT_OK
|| val > INT_MAX)
- error (1, 0, _("%s: invalid pattern"), argv[i]);
+ error (EXIT_FAILURE, 0, _("%s: invalid pattern"), argv[i]);
if (val == 0)
- error (1, 0, _("%s: line number must be greater than zero"),
+ error (EXIT_FAILURE, 0,
+ _("%s: line number must be greater than zero"),
argv[i]);
if (val < last_val)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("line number `%s' is smaller than preceding line number, %lu"),
argv[i], last_val);
break;
case 0:
- error (1, 0, _("missing conversion specifier in suffix"));
+ error (EXIT_FAILURE, 0, _("missing conversion specifier in suffix"));
break;
default:
if (ISPRINT (ch))
- error (1, 0, _("invalid conversion specifier in suffix: %c"), ch);
+ error (EXIT_FAILURE, 0,
+ _("invalid conversion specifier in suffix: %c"), ch);
else
- error (1, 0, _("invalid conversion specifier in suffix: \\%.3o"), ch);
+ error (EXIT_FAILURE, 0,
+ _("invalid conversion specifier in suffix: \\%.3o"), ch);
}
}
}
if (percents == 0)
- error (1, 0, _("missing %% conversion specification in suffix"));
+ error (EXIT_FAILURE, 0,
+ _("missing %% conversion specification in suffix"));
else if (percents > 1)
- error (1, 0, _("too many %% conversion specifications in suffix"));
+ error (EXIT_FAILURE, 0,
+ _("too many %% conversion specifications in suffix"));
return out_count;
}
case 'n':
if (xstrtoul (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|| val > INT_MAX)
- error (1, 0, _("%s: invalid number"), optarg);
+ error (EXIT_FAILURE, 0, _("%s: invalid number"), optarg);
digits = (int) val;
break;
exit_status = 1;
}
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
tabval = tabval * 10 + *stops - '0';
}
else
- error (1, 0, _("tab size contains an invalid character"));
+ error (EXIT_FAILURE, 0, _("tab size contains an invalid character"));
}
add_tabstop (tabval);
for (i = 0; i < entries; i++)
{
if (tabs[i] == 0)
- error (1, 0, _("tab size cannot be 0"));
+ error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
if (tabs[i] <= prev_tab)
- error (1, 0, _("tab sizes must be ascending"));
+ error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
prev_tab = tabs[i];
}
}
expand ();
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid line number increment: `%s'"),
+ error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
optarg);
max_width = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of columns: `%s'"), optarg);
+ error (EXIT_FAILURE, 0,
+ _("invalid number of columns: `%s'"), optarg);
width = (int) tmp_long;
}
break;
errs |= fold_file (argv[i], width);
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
if (bytes_read > bytes_to_write)
bytes_read = bytes_to_write;
if (fwrite (buffer, 1, bytes_read, stdout) == 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
bytes_to_write -= bytes_read;
}
return 0;
if (buffer[bytes_to_write++] == '\n' && --lines_to_write == 0)
break;
if (fwrite (buffer, 1, bytes_to_write, stdout) == 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
}
return 0;
}
/* FIXME: use xstrtoul instead. */
number = atou (optarg);
if (number == -1)
- error (1, 0, _("invalid number `%s'"), optarg);
+ error (EXIT_FAILURE, 0, _("invalid number `%s'"), optarg);
break;
case 'q':
exit_status |= head_file (argv[optind], number);
if (have_read_stdin && close (0) < 0)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
fp1 = strcmp (names[0], "-") ? fopen (names[0], "r") : stdin;
if (!fp1)
- error (1, errno, "%s", names[0]);
+ error (EXIT_FAILURE, errno, "%s", names[0]);
fp2 = strcmp (names[1], "-") ? fopen (names[1], "r") : stdin;
if (!fp2)
- error (1, errno, "%s", names[1]);
+ error (EXIT_FAILURE, errno, "%s", names[1]);
if (fp1 == fp2)
- error (1, errno, _("both files cannot be standard input"));
+ error (EXIT_FAILURE, errno, _("both files cannot be standard input"));
join (fp1, fp2);
if (fp1 != stdin && fclose (fp1) == EOF)
- error (1, errno, "%s", names[0]);
+ error (EXIT_FAILURE, errno, "%s", names[0]);
if (fp2 != stdin && fclose (fp2) == EOF)
- error (1, errno, "%s", names[1]);
+ error (EXIT_FAILURE, errno, "%s", names[1]);
if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (EXIT_SUCCESS);
}
regexp->fastmap_accurate = 0;
errmsg = re_compile_pattern (optarg, optlen, regexp);
if (errmsg)
- error (1, 0, "%s", errmsg);
+ error (EXIT_FAILURE, 0, "%s", errmsg);
break;
default:
rval = FALSE;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
/* Allow it to be negative. */
|| tmp_long > INT_MAX)
- error (1, 0, _("invalid starting line number: `%s'"),
+ error (EXIT_FAILURE, 0, _("invalid starting line number: `%s'"),
optarg);
starting_line_number = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid line number increment: `%s'"),
+ error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
optarg);
page_incr = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of blank lines: `%s'"),
+ error (EXIT_FAILURE, 0, _("invalid number of blank lines: `%s'"),
optarg);
blank_join = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid line number field width: `%s'"),
+ error (EXIT_FAILURE, 0,
+ _("invalid line number field width: `%s'"),
optarg);
lineno_width = (int) tmp_long;
}
exit_status = 1;
}
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
{
fileptr[files_open] = fopen (fnamptr[files_open], "r");
if (fileptr[files_open] == NULL)
- error (1, errno, "%s", fnamptr[files_open]);
+ error (EXIT_FAILURE, errno, "%s", fnamptr[files_open]);
else if (fileno (fileptr[files_open]) == 0)
opened_stdin = 1;
}
fileptr[files_open] = ENDLIST;
if (opened_stdin && have_read_stdin)
- error (1, 0, _("standard input is closed"));
+ error (EXIT_FAILURE, 0, _("standard input is closed"));
/* Read a line from each file and output it to stdout separated by a
delimiter, until we go through the loop without successfully
else
exit_status = paste_serial (argc - optind, &argv[optind]);
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
usage (0);
if (parallel_files && explicit_columns)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("Cannot specify number of columns when printing in parallel."));
if (parallel_files && print_across_flag)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("Cannot specify both printing across and printing in parallel."));
for ( ; optind < argc; optind++)
cleanup ();
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, _("standard input"));
+ error (EXIT_FAILURE, errno, _("standard input"));
if (ferror (stdout) || fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
if (failed_opens > 0)
exit(1);
exit (EXIT_SUCCESS);
(columns - 1) * chars_per_gutter) / columns;
if (chars_per_column < 1)
- error (1, 0, _("page width too narrow"));
+ error (EXIT_FAILURE, 0, _("page width too narrow"));
if (numbered_lines)
{
if (p->status == CLOSED)
return;
if (ferror (p->fp))
- error (1, errno, "%s", p->name);
+ error (EXIT_FAILURE, errno, "%s", p->name);
if (p->fp != stdin && fclose (p->fp) == EOF)
- error (1, errno, "%s", p->name);
+ error (EXIT_FAILURE, errno, "%s", p->name);
if (!parallel_files)
{
if (new_file_flag)
{
if (output_desc >= 0 && close (output_desc) < 0)
- error (1, errno, "%s", outfile);
+ error (EXIT_FAILURE, errno, "%s", outfile);
next_file_name ();
if (verbose)
fprintf (stderr, _("creating file `%s'\n"), outfile);
output_desc = open (outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (output_desc < 0)
- error (1, errno, "%s", outfile);
+ error (EXIT_FAILURE, errno, "%s", outfile);
}
if (full_write (output_desc, bp, bytes) < 0)
- error (1, errno, "%s", outfile);
+ error (EXIT_FAILURE, errno, "%s", outfile);
}
/* Read NCHARS bytes from the input file into BUF.
{
n_read = stdread (buf, bufsize);
if (n_read < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
bp_out = buf;
to_read = n_read;
for (;;)
{
n_read = stdread (buf, bufsize);
if (n_read < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
bp = bp_out = buf;
eob = bp + n_read;
*eob = '\n';
n_read = stdread (buf + n_buffered, nchars - n_buffered);
if (n_read < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
n_buffered += n_read;
if (n_buffered != nchars)
{
input_desc = open (infile, O_RDONLY);
if (input_desc < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
}
/* No output file is open now. */
/* Get the optimal block size of input device and make a buffer. */
if (fstat (input_desc, &stat_buf) < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
in_blk_size = ST_BLKSIZE (stat_buf);
buf = xmalloc (in_blk_size + 1);
}
if (close (input_desc) < 0)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
if (output_desc >= 0 && close (output_desc) < 0)
- error (1, errno, "%s", outfile);
+ error (EXIT_FAILURE, errno, "%s", outfile);
exit (EXIT_SUCCESS);
}
errors = 1;
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
case 's':
separator = optarg;
if (*separator == 0)
- error (1, 0, _("separator cannot be empty"));
+ error (EXIT_FAILURE, 0, _("separator cannot be empty"));
break;
default:
usage (1);
error_message = re_compile_pattern (separator, strlen (separator),
&compiled_separator);
if (error_message)
- error (1, 0, "%s", error_message);
+ error (EXIT_FAILURE, 0, "%s", error_message);
}
else
match_length = sentinel_length = strlen (separator);
output ((char *) NULL, (char *) NULL);
if (have_read_stdin && close (0) < 0)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (close (1) < 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
assert ((fd) == 1); \
assert ((n_bytes) >= 0); \
if (n_bytes > 0 && fwrite ((buffer), 1, (n_bytes), stdout) == 0) \
- error (1, errno, _("write error")); \
+ error (EXIT_FAILURE, errno, _("write error")); \
} \
while (0)
total += bytes_read;
}
if (bytes_read == -1)
- error (1, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", filename);
if (forever)
{
fflush (stdout);
tail_forever (argv + fileind, argc - fileind);
if (have_read_stdin && close (0) < 0)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
get_s1_spec_stats (s1);
if (s1->n_indefinite_repeats > 0)
{
- error (1, 0, _("the [c*] repeat construct may not appear in string1"));
+ error (EXIT_FAILURE, 0,
+ _("the [c*] repeat construct may not appear in string1"));
}
/* FIXME: it isn't clear from the POSIX spec that this is invalid,
with character classes, this seems a logical interpretation. */
if (complement && s1->has_upper_or_lower)
{
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("character classes may not be used when translating \
and complementing"));
}
get_s2_spec_stats (s2, s1->length);
if (s2->has_restricted_char_class)
{
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("when translating, the only character classes that may \
appear in\n\tstring2 are `upper' and `lower'"));
}
if (s2->n_indefinite_repeats > 1)
{
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("only one [c*] repeat construct may appear in string2"));
}
{
if (s2->has_equiv_class)
{
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("[=c=] expressions may not appear in string2 \
when translating"));
}
given or string1 is empty. */
if (s2->length == 0)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("when not truncating set1, string2 must be non-empty"));
string2_extend (s1, s2);
}
}
if (complement && s2->has_upper_or_lower)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("character classes may not be used when translating \
and complementing"));
}
/* Not translating. */
{
if (s2->n_indefinite_repeats > 0)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("the [c*] construct may appear in string2 only \
when translating"));
}
nr = (*reader) (buf, size, NULL);
if (nr < 0)
- error (1, errno, _("read error"));
+ error (EXIT_FAILURE, errno, _("read error"));
if (nr == 0)
break;
i = 0;
}
if (out_len > 0
&& fwrite ((char *) &buf[begin], 1, out_len, stdout) == 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
}
if (char_to_squeeze != NOT_A_CHAR)
int nr = safe_read (0, (char *) buf, size);
if (nr < 0)
- error (1, errno, _("read error"));
+ error (EXIT_FAILURE, errno, _("read error"));
if (nr == 0)
{
hit_eof = 1;
chars_read = safe_read (0, (char *) buf, size);
if (chars_read < 0)
- error (1, errno, _("read error"));
+ error (EXIT_FAILURE, errno, _("read error"));
if (chars_read == 0)
{
hit_eof = 1;
}
if (!delete && !squeeze_repeats && non_option_args != 2)
- error (1, 0, _("two strings must be given when translating"));
+ error (EXIT_FAILURE, 0, _("two strings must be given when translating"));
if (delete && squeeze_repeats && non_option_args != 2)
- error (1, 0, _("two strings must be given when both \
+ error (EXIT_FAILURE, 0, _("two strings must be given when both \
deleting and squeezing repeats"));
/* If --delete is given without --squeeze-repeats, then
if (posix_pedantic && non_option_args == 2)
--non_option_args;
else
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("only one string may be given when deleting \
without squeezing repeats"));
}
if (squeeze_repeats && non_option_args == 0)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("at least one string must be given when squeezing repeats"));
spec_init (s1);
{
nr = read_and_delete (io_buf, IO_BUF_SIZE, NULL);
if (nr > 0 && fwrite ((char *) io_buf, 1, nr, stdout) == 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
}
while (nr > 0);
}
c1 = get_next (s1, &class_s1);
c2 = get_next (s2, &class_s2);
if (!class_ok[(int) class_s1][(int) class_s2])
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("misaligned or mismatched upper and/or lower classes"));
/* The following should have been checked by validate... */
if (c2 == -1)
chars_read = read_and_xlate (io_buf, IO_BUF_SIZE, NULL);
if (chars_read > 0
&& fwrite ((char *) io_buf, 1, chars_read, stdout) == 0)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
}
while (chars_read > 0);
}
tabval = tabval * 10 + *stops - '0';
}
else
- error (1, 0, _("tab size contains an invalid character"));
+ error (EXIT_FAILURE, 0, _("tab size contains an invalid character"));
}
add_tabstop (tabval);
for (i = 0; i < entries; i++)
{
if (tabs[i] == 0)
- error (1, 0, _("tab size cannot be 0"));
+ error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
if (tabs[i] <= prev_tab)
- error (1, 0, _("tab sizes must be ascending"));
+ error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
prev_tab = tabs[i];
}
}
unexpand ();
if (have_read_stdin && fclose (stdin) == EOF)
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
if (fclose (stdout) == EOF)
- error (1, errno, _("write error"));
+ error (EXIT_FAILURE, errno, _("write error"));
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
else
istream = fopen (infile, "r");
if (istream == NULL)
- error (1, errno, "%s", infile);
+ error (EXIT_FAILURE, errno, "%s", infile);
if (!strcmp (outfile, "-"))
ostream = stdout;
else
ostream = fopen (outfile, "w");
if (ostream == NULL)
- error (1, errno, "%s", outfile);
+ error (EXIT_FAILURE, errno, "%s", outfile);
thisline = &lb1;
prevline = &lb2;
closefiles:
if (ferror (istream) || fclose (istream) == EOF)
- error (1, errno, _("error reading %s"), infile);
+ error (EXIT_FAILURE, errno, _("error reading %s"), infile);
if (ferror (ostream) || fclose (ostream) == EOF)
- error (1, errno, _("error writing %s"), outfile);
+ error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
free (lb1.buffer);
free (lb2.buffer);
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of fields to skip: `%s'"),
+ error (EXIT_FAILURE, 0,
+ _("invalid number of fields to skip: `%s'"),
optarg);
skip_fields = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of bytes to skip: `%s'"),
+ error (EXIT_FAILURE, 0,
+ _("invalid number of bytes to skip: `%s'"),
optarg);
skip_chars = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of bytes to compare: `%s'"),
+ error (EXIT_FAILURE, 0,
+ _("invalid number of bytes to compare: `%s'"),
optarg);
check_chars = (int) tmp_long;
}
long int tmp_long;
if (xstrtol (opt_str, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
- error (1, 0, _("invalid number of bytes to compare: `%s'"),
+ error (EXIT_FAILURE, 0,
+ _("invalid number of bytes to compare: `%s'"),
opt_str);
skip_chars = (int) tmp_long;
}
}
if (have_read_stdin && close (0))
- error (1, errno, "-");
+ error (EXIT_FAILURE, errno, "-");
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}