summaryrefslogtreecommitdiff
path: root/src/cut.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-05 18:29:39 +0000
committerJim Meyering <jim@meyering.net>1993-10-05 18:29:39 +0000
commit712109716a7b75dda2d34751202d210acd879f6b (patch)
tree93943c37813a5b456347b7e6009ef10b9f782fba /src/cut.c
parent3b5543d43131da003fcf75c5d9062da0199b3b88 (diff)
downloadcoreutils-712109716a7b75dda2d34751202d210acd879f6b.tar.xz
merge with 1.8a
Diffstat (limited to 'src/cut.c')
-rw-r--r--src/cut.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/cut.c b/src/cut.c
index e7997fd58..1c8e70eaf 100644
--- 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);