merge with 1.8a
authorJim Meyering <jim@meyering.net>
Tue, 5 Oct 1993 18:29:39 +0000 (18:29 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 5 Oct 1993 18:29:39 +0000 (18:29 +0000)
21 files changed:
src/cat.c
src/cksum.c
src/comm.c
src/csplit.c
src/cut.c
src/expand.c
src/fold.c
src/head.c
src/join.c
src/nl.c
src/od.c
src/paste.c
src/pr.c
src/split.c
src/sum.c
src/tac.c
src/tail.c
src/tr.c
src/unexpand.c
src/uniq.c
src/wc.c

index 724976d..70d1c68 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -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
                    {
index b5e1887..a3dd81d 100644 (file)
@@ -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)
index c5f4c39..d79ca7b 100644 (file)
@@ -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)
index 6eedd39..48a11a8 100644 (file)
@@ -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)
index e7997fd..1c8e70e 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -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);
index 99ce5c4..4aaaf02 100644 (file)
@@ -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);
index b3cb098..4de8803 100644 (file)
@@ -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}
 };
 \f
@@ -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)
index ec4d730..5c34f6a 100644 (file)
@@ -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)
index 48e791a..7d02e06 100644 (file)
@@ -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)
index 431c3e9..c91f117 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -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.  */
index f2f0b3c..6986300 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -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)
index a45b6fe..8639b34 100644 (file)
@@ -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)
index 250f532..7208f11 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -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)
index d425b52..b9aba04 100644 (file)
@@ -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.  */
index 1283078..46e672c 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -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;
index 30de5ab..793cf55 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -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)
index 8feceb6..c6f0206 100644 (file)
@@ -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)
index f979afb..f6c11b9 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -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}
 };
 \f
@@ -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);
index 27e8d95..68b7073 100644 (file)
@@ -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);
index aab70db..5017356 100644 (file)
@@ -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}
 };
 \f
@@ -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)
index b484911..6e67ecb 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -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)