From: Jim Meyering Date: Tue, 7 Nov 1995 04:56:08 +0000 (+0000) Subject: New option: --verbose. X-Git-Tag: TEXTUTILS-1_13F~94 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7df779b8bbac7d3744d398b2e39f8db4ad067d1;p=platform%2Fupstream%2Fcoreutils.git New option: --verbose. (main): Recognize it. (usage): Document it. From Marty Leisner . --- diff --git a/src/split.c b/src/split.c index 043d7ad..9df7e69 100644 --- a/src/split.c +++ b/src/split.c @@ -76,11 +76,16 @@ static int show_help; /* 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} @@ -108,6 +113,8 @@ PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input.\n\ -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\ @@ -173,6 +180,8 @@ cwrite (int new_file_flag, const char *bp, int bytes) 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); @@ -373,7 +382,7 @@ main (int argc, char **argv) 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; @@ -431,6 +440,10 @@ main (int argc, char **argv) accum = accum * 10 + c - '0'; break; + case 2: + verbose = 1; + break; + default: usage (2, (char *)0); }