diff options
author | Jim Meyering <jim@meyering.net> | 1993-10-05 18:29:39 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-10-05 18:29:39 +0000 |
commit | 712109716a7b75dda2d34751202d210acd879f6b (patch) | |
tree | 93943c37813a5b456347b7e6009ef10b9f782fba /src | |
parent | 3b5543d43131da003fcf75c5d9062da0199b3b88 (diff) | |
download | coreutils-712109716a7b75dda2d34751202d210acd879f6b.tar.xz |
merge with 1.8a
Diffstat (limited to 'src')
-rw-r--r-- | src/cat.c | 24 | ||||
-rw-r--r-- | src/cksum.c | 16 | ||||
-rw-r--r-- | src/comm.c | 16 | ||||
-rw-r--r-- | src/csplit.c | 16 | ||||
-rw-r--r-- | src/cut.c | 19 | ||||
-rw-r--r-- | src/expand.c | 16 | ||||
-rw-r--r-- | src/fold.c | 16 | ||||
-rw-r--r-- | src/head.c | 16 | ||||
-rw-r--r-- | src/join.c | 16 | ||||
-rw-r--r-- | src/nl.c | 16 | ||||
-rw-r--r-- | src/od.c | 16 | ||||
-rw-r--r-- | src/paste.c | 16 | ||||
-rw-r--r-- | src/pr.c | 16 | ||||
-rw-r--r-- | src/split.c | 16 | ||||
-rw-r--r-- | src/sum.c | 16 | ||||
-rw-r--r-- | src/tac.c | 16 | ||||
-rw-r--r-- | src/tail.c | 16 | ||||
-rw-r--r-- | src/tr.c | 16 | ||||
-rw-r--r-- | src/unexpand.c | 16 | ||||
-rw-r--r-- | src/uniq.c | 16 | ||||
-rw-r--r-- | src/wc.c | 16 |
21 files changed, 174 insertions, 173 deletions
@@ -134,10 +134,10 @@ main (argc, argv) int options = 0; /* If non-zero, display usage information and exit. */ - static int flag_help; + static int show_help; - /* If non-zero, print the version on standard error. */ - static int flag_version; + /* If non-zero, print the version on standard output then exit. */ + static int show_version; static struct option const long_options[] = { @@ -148,8 +148,8 @@ main (argc, argv) {"show-ends", no_argument, NULL, 'E'}, {"show-tabs", no_argument, NULL, 'T'}, {"show-all", no_argument, NULL, 'A'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -224,13 +224,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); output_desc = 1; @@ -511,8 +511,12 @@ cat (inbuf, insize, outbuf, outsize, quote, && ioctl (input_desc, FIONREAD, &n_to_read) < 0) { /* Ultrix returns EOPNOTSUPP on NFS; - HP-UX returns ENOTTY on pipes. */ - if (errno == EOPNOTSUPP || errno == ENOTTY) + HP-UX returns ENOTTY on pipes. + SunOS returns EINVAL and + More/BSD returns ENODEV on special files + like /dev/null. */ + if (errno == EOPNOTSUPP || errno == ENOTTY + || errno == EINVAL || errno == ENODEV) use_fionread = 0; else { diff --git a/src/cksum.c b/src/cksum.c index b5e1887e6..a3dd81dfe 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -117,15 +117,15 @@ void error (); char *program_name; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -290,13 +290,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind >= argc) diff --git a/src/comm.c b/src/comm.c index c5f4c39ca..d79ca7bbf 100644 --- a/src/comm.c +++ b/src/comm.c @@ -39,15 +39,15 @@ static int only_file_2; static int both; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -91,13 +91,13 @@ main (argc, argv) usage (); } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind + 2 != argc) diff --git a/src/csplit.c b/src/csplit.c index 6eedd39b3..48a11a8d8 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -184,10 +184,10 @@ static struct control *controls; static unsigned control_used; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { @@ -196,8 +196,8 @@ static struct option const longopts[] = {"silent", no_argument, NULL, 's'}, {"keep-files", no_argument, NULL, 'k'}, {"prefix", required_argument, NULL, 'f'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -1284,13 +1284,13 @@ main (argc, argv) usage (); } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind >= argc - 1) @@ -136,10 +136,10 @@ static unsigned char delim; static int have_read_stdin; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { @@ -148,8 +148,8 @@ static struct option const longopts[] = {"fields", required_argument, 0, 'f'}, {"delimiter", required_argument, 0, 'd'}, {"only-delimited", no_argument, 0, 's'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -224,13 +224,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (operating_mode == undefined_mode) @@ -540,9 +540,6 @@ cut_fields (stream) if (fieldfound) { /* Something was found. Print it. */ - if ((unsigned char) outbufptr[-1] == delim) - --outbufptr; /* Suppress trailing delimiter. */ - fwrite (outbuf, sizeof (char), outbufptr - outbuf, stdout); if (c == '\n') putc (c, stdout); diff --git a/src/expand.c b/src/expand.c index 99ce5c4f7..4aaaf02db 100644 --- a/src/expand.c +++ b/src/expand.c @@ -96,17 +96,17 @@ static int have_read_stdin; static int exit_status; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"tabs", required_argument, NULL, 't'}, {"initial", no_argument, NULL, 'i'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -153,13 +153,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); add_tabstop (tabval); diff --git a/src/fold.c b/src/fold.c index b3cb0988c..4de88036f 100644 --- a/src/fold.c +++ b/src/fold.c @@ -46,18 +46,18 @@ static int count_bytes; static int have_read_stdin; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"bytes", no_argument, NULL, 'b'}, {"spaces", no_argument, NULL, 's'}, {"width", required_argument, NULL, 'w'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -126,13 +126,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (argc == optind) diff --git a/src/head.c b/src/head.c index ec4d730d3..5c34f6a3e 100644 --- a/src/head.c +++ b/src/head.c @@ -77,10 +77,10 @@ char *program_name; static int have_read_stdin; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { @@ -89,8 +89,8 @@ static struct option const long_options[] = {"quiet", no_argument, NULL, 'q'}, {"silent", no_argument, NULL, 'q'}, {"verbose", no_argument, NULL, 'v'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -193,13 +193,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (number == -1) diff --git a/src/join.c b/src/join.c index 48e791ac0..7d02e0689 100644 --- a/src/join.c +++ b/src/join.c @@ -94,10 +94,10 @@ static struct outlist *outlist_end; static char tab; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; /* When using getopt_long_only, no long option can start with a character that is a short option. */ @@ -106,8 +106,8 @@ static struct option const longopts[] = {"j", required_argument, NULL, 'j'}, {"j1", required_argument, NULL, '1'}, {"j2", required_argument, NULL, '2'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -660,13 +660,13 @@ main (argc, argv) prev_optc = optc; } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (nfiles != 2) @@ -150,10 +150,10 @@ static int line_no; static int have_read_stdin; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { @@ -168,8 +168,8 @@ static struct option const longopts[] = {"number-width", required_argument, NULL, 'w'}, {"number-format", required_argument, NULL, 'n'}, {"section-delimiter", required_argument, NULL, 'd'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -262,13 +262,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); /* Initialize the section delimiters. */ @@ -272,10 +272,10 @@ static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1]; static enum size_spec fp_type_size[MAX_FP_TYPE_SIZE + 1]; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { @@ -290,8 +290,8 @@ static struct option const long_options[] = {"compatible", no_argument, NULL, 'C'}, {"strings", optional_argument, NULL, 's'}, {"width", optional_argument, NULL, 'w'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -1789,13 +1789,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (flag_dump_strings && n_specs > 0) diff --git a/src/paste.c b/src/paste.c index a45b6fe10..8639b3407 100644 --- a/src/paste.c +++ b/src/paste.c @@ -79,17 +79,17 @@ static char *delims; static char *delim_end; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"serial", no_argument, 0, 's'}, {"delimiters", required_argument, 0, 'd'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -132,13 +132,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) @@ -426,15 +426,15 @@ static int *clump_buff; static int truncate_lines = FALSE; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -610,13 +610,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (parallel_files && explicit_columns) diff --git a/src/split.c b/src/split.c index d425b5295..b9aba0483 100644 --- a/src/split.c +++ b/src/split.c @@ -67,18 +67,18 @@ static int input_desc; static int output_desc; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"bytes", required_argument, NULL, 'b'}, {"lines", required_argument, NULL, 'l'}, {"line-bytes", required_argument, NULL, 'C'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -184,13 +184,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage ((char *)0); /* Handle default case. */ @@ -40,16 +40,16 @@ static int have_read_stdin; #define ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x8000; else (c) >>= 1; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"sysv", no_argument, NULL, 's'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -94,13 +94,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); files_given = argc - optind; @@ -103,18 +103,18 @@ static unsigned buffer_size; static struct re_pattern_buffer compiled_separator; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"before", no_argument, &separator_ends_record, 0}, {"regex", no_argument, &sentinel_length, 0}, {"separator", required_argument, NULL, 's'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -166,13 +166,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (sentinel_length == 0) diff --git a/src/tail.c b/src/tail.c index 8feceb604..c6f0206b1 100644 --- a/src/tail.c +++ b/src/tail.c @@ -113,10 +113,10 @@ char *program_name; static int have_read_stdin; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { @@ -126,8 +126,8 @@ static struct option const long_options[] = {"quiet", no_argument, NULL, 'q'}, {"silent", no_argument, NULL, 'q'}, {"verbose", no_argument, NULL, 'v'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -256,13 +256,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (number == -1) @@ -288,10 +288,10 @@ static SET_TYPE in_delete_set[N_CHARS]; static char xlate[N_CHARS]; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const long_options[] = { @@ -299,8 +299,8 @@ static struct option const long_options[] = {"delete", no_argument, NULL, 'd'}, {"squeeze-repeats", no_argument, NULL, 's'}, {"truncate-set1", no_argument, NULL, 't'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -1665,13 +1665,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); posix_pedantic = (getenv ("POSIXLY_CORRECT") != NULL); diff --git a/src/unexpand.c b/src/unexpand.c index 27e8d952d..68b7073df 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -98,17 +98,17 @@ static int have_read_stdin; static int exit_status; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { {"tabs", required_argument, NULL, 't'}, {"all", no_argument, NULL, 'a'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -156,13 +156,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); add_tabstop (tabval); diff --git a/src/uniq.c b/src/uniq.c index aab70db43..501735654 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -70,10 +70,10 @@ enum output_mode static enum output_mode mode; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exit. */ +static int show_version; static struct option const longopts[] = { @@ -83,8 +83,8 @@ static struct option const longopts[] = {"skip-fields", required_argument, NULL, 'f'}, {"skip-chars", required_argument, NULL, 's'}, {"check-chars", required_argument, NULL, 'w'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -153,13 +153,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind >= 2 && strcmp (argv[optind - 1], "--") != 0) @@ -49,10 +49,10 @@ static int have_read_stdin; static int exit_status; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; -/* If non-zero, print the version on standard error. */ -static int flag_version; +/* If non-zero, print the version on standard output then exits. */ +static int show_version; static struct option const longopts[] = { @@ -60,8 +60,8 @@ static struct option const longopts[] = {"chars", no_argument, NULL, 'c'}, {"lines", no_argument, NULL, 'l'}, {"words", no_argument, NULL, 'w'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -110,13 +110,13 @@ main (argc, argv) usage (); } - if (flag_version) + if (show_version) { - fprintf (stderr, "%s\n", version_string); + printf ("%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (print_lines + print_words + print_chars == 0) |