/* If the first field extends to the end of line (it is not
delimited) and we are printing all non-delimited lines,
print this one. */
- if ((unsigned char) field_1_buffer[n_bytes - 1] != delim)
+ if (to_uchar (field_1_buffer[n_bytes - 1]) != delim)
{
if (suppress_non_delimited)
{
}
/* Process file FILE to standard output.
- Return 0 if successful, 1 if not. */
+ Return true if successful. */
-static int
+static bool
cut_file (char *file)
{
FILE *stream;
if (stream == NULL)
{
error (0, errno, "%s", file);
- return 1;
+ return false;
}
}
if (ferror (stream))
{
error (0, errno, "%s", file);
- return 1;
+ return false;
}
if (STREQ (file, "-"))
clearerr (stream); /* Also clear EOF. */
else if (fclose (stream) == EOF)
{
error (0, errno, "%s", file);
- return 1;
+ return false;
}
- return 0;
+ return true;
}
int
main (int argc, char **argv)
{
- int optc, exit_status = 0;
+ int optc;
+ bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT(= NULL);
}
if (optind == argc)
- exit_status |= cut_file ("-");
+ ok = cut_file ("-");
else
- for (; optind < argc; optind++)
- exit_status |= cut_file (argv[optind]);
+ for (ok = true; optind < argc; optind++)
+ ok &= cut_file (argv[optind]);
if (range_start_ht)
hash_free (range_start_ht);
if (have_read_stdin && fclose (stdin) == EOF)
{
error (0, errno, "-");
- exit_status = 1;
+ ok = false;
}
- exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
}