]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
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 724976d831fd8d3a8f8e2c45024ab672563477bf..70d1c685481bd46fe0620c298ebfcab7943a41c1 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 b5e1887e6fd1609594b6b90e3de84b0fd0c61b18..a3dd81dfe430bffc4541aadfc2ecf2e2298afb2a 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 c5f4c39caded76a957bbdac680d936e95def5dc8..d79ca7bbff3dfed94dcd3aafe76181d10f7c7c1d 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 6eedd39b39344c9bcf740fdcadcd2ddd064ab809..48a11a8d82aa7d7ec2ab979635dfaef550119fa2 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 e7997fd5849a489058ac1d934432e2d7f5316edb..1c8e70eafdcecc6c0519c9136a709de98c3f73f3 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 99ce5c4f7d5b4c4aff8d2b33c78737e838ae641b..4aaaf02dbe6f6b7a7d7ac840ca56a0a0927ed0a2 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 b3cb0988c03e23fe26f5dae559f4fcd97c33b6f5..4de88036f132d0cb8c07437dd6227c643df69ad5 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 ec4d730d30d833249e30768143e3452a73386e3e..5c34f6a3e2830606a1341f236dd1b3c529aaaf91 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 48e791ac077608c20969d6e8eb6bc08ad39c26bf..7d02e068988782b25d28d815ddbee59890cedd4e 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 431c3e91a94edca7c32b2530f0163b434828d53f..c91f11782abc25767c2af6b69b069caac3773327 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 f2f0b3c64e5be7f60e97b880761385f58c91ace5..698630071bacf31c3ffbc3768fa937fafedadd7d 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 a45b6fe1011c3faa8be33c5d9171abc65cba0fca..8639b340708107da60afde54cc8a13897a66fd6b 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 250f532b73264d758eaf45257616688c73cb24c1..7208f11f219b0e7d36068d0da251d0cd96e57094 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 d425b5295dd0bcd451766cf987d391b6db33e803..b9aba04834009367cf69dfa9c06fecc53c527d37 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 1283078e700003852567997d25f9da30750cb974..46e672cc31c9a4f2390cc02d7dc6b440549134e8 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 30de5abebc6d5b914db5e22f9ed60ab2a8262682..793cf55c703e7bf80a1cbaec4f6dd2f0fd2ac385 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 8feceb6047a8f3bfcc226e0ae1bcbe0f705787c9..c6f0206b14d52500a28817ed4449631639cbf60e 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 f979afb8d331aed8842bb1d1bb63130976eb00bd..f6c11b9530f3150f0b4268917ed97eb4f08cd7f9 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 27e8d952d8b59d730ca3d4506279505e0da17914..68b7073df5117881fc0bee7846c53f9e854549c3 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 aab70db43455784952f7d9024d6238e611f1ac2a..50173565438c8c0d0c75a6e17b5314731fed0fbf 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 b484911d78cbb6de808299f8c64e363f6aaf8105..6e67ecb9b5ac09e24f84340899bd094e89238b1b 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)