[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cut enhancement: -C as short option for --complement
From: |
Mark Krenz |
Subject: |
cut enhancement: -C as short option for --complement |
Date: |
Thu, 5 Apr 2012 14:49:22 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hello, I use the cut command a fair amount from the command line and
having to type out the full option to complement can get tedious. I
would like to suggest having -C be the short option for --complement. It
seems like C might be a good choice for the option letter, although I'm
unsure if people might start thinking that -C would be the option that
takes the arguments for fields to exclude.
I made a quick patch against the latest source that seems to work ok and
have included it below. Comments?
diff --git a/src/cut.c b/src/cut.c
index fed9616..6d9cdc1 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -162,7 +162,6 @@ static Hash_table *range_start_ht;
enum
{
OUTPUT_DELIMITER_OPTION = CHAR_MAX + 1,
- COMPLEMENT_OPTION
};
static struct option const longopts[] =
@@ -173,7 +172,7 @@ static struct option const longopts[] =
{"delimiter", required_argument, NULL, 'd'},
{"only-delimited", no_argument, NULL, 's'},
{"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION},
- {"complement", no_argument, NULL, COMPLEMENT_OPTION},
+ {"complement", no_argument, NULL, 'C'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
@@ -209,7 +208,7 @@ Mandatory arguments to long options are mandatory for short
options too.\n\
-n (ignored)\n\
"), stdout);
fputs (_("\
- --complement complement the set of selected bytes, characters\n\
+ -C, --complement complement the set of selected bytes, characters\n\
or fields\n\
"), stdout);
fputs (_("\
@@ -778,7 +777,7 @@ main (int argc, char **argv)
delim = '\0';
have_read_stdin = false;
- while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, NULL)) != -1)
+ while ((optc = getopt_long (argc, argv, "b:c:d:f:nCs", longopts, NULL)) !=
-1)
{
switch (optc)
{
@@ -824,7 +823,7 @@ main (int argc, char **argv)
suppress_non_delimited = true;
break;
- case COMPLEMENT_OPTION:
+ case 'C':
complement = true;
break;
--
Mark Krenz
address@hidden
Sent from Mutt using Linux
- cut enhancement: -C as short option for --complement,
Mark Krenz <=
- Re: cut enhancement: -C as short option for --complement, Jim Meyering, 2012/04/06
- Re: cut enhancement: -C as short option for --complement, Mark Krenz, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Jim Meyering, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Mark Krenz, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Eric Blake, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Mark Krenz, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Eric Blake, 2012/04/05
- Re: cut enhancement: -C as short option for --complement, Mark Krenz, 2012/04/05