/* If non-zero, print the version on standard output then exit. */
static int show_version;
+/* If non-zero, print a diagnostic on standard error just before each
+ output file is opened. */
+static int verbose;
+
static struct option const longopts[] =
{
{"bytes", required_argument, NULL, 'b'},
{"lines", required_argument, NULL, 'l'},
{"line-bytes", required_argument, NULL, 'C'},
+ {"verbose", no_argument, NULL, 2},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
-C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\
-b, --bytes=SIZE put SIZE bytes per output file\n\
-l, --lines=NUMBER put NUMBER lines per output file\n\
+ --verbose print a diagnostic to standard error just\n\
+ before each output file is opened\n\
-NUMBER same as -l NUMBER\n\
--help display this help and exit\n\
--version output version information and exit\n\
error (1, 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);
int this_optind = optind ? optind : 1;
long int tmp_long;
- c = getopt_long (argc, argv, "0123456789b:l:C:", longopts, (int *) 0);
+ c = getopt_long (argc, argv, "0123456789vb:l:C:", longopts, (int *) 0);
if (c == EOF)
break;
accum = accum * 10 + c - '0';
break;
+ case 2:
+ verbose = 1;
+ break;
+
default:
usage (2, (char *)0);
}