Hi,
just as subj. says, the option is documented and even shown in the usage part of an info manual
but not accepted.

This patch fixes that.

Cheers,
  Ondrej
>From 7a87ba39a6179d9203f8dedfeb0e188b932b34e4 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <[email protected]>
Date: Tue, 6 Oct 2015 09:04:00 +0200
Subject: [PATCH] csplit: honor the -m short option

* NEWS: mention the bugfix.
* src/csplit.c (main): Handle -m properly.
---
 NEWS         |  3 +++
 src/csplit.c | 11 ++---------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 9aec259..1a59d86 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  csplit now properly accepts -m as a short equivalent
+  to --suppress-matched.
+
   shred again uses defined patterns for all iteration counts.
   [bug introduced in coreutils-5.93]
 
diff --git a/src/csplit.c b/src/csplit.c
index d966df5..c7cee40 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -181,13 +181,6 @@ static size_t control_used;
 /* The set of signals that are caught.  */
 static sigset_t caught_signals;
 
-/* For long options that have no equivalent short option, use a
-   non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
-enum
-{
-  SUPPRESS_MATCHED_OPTION = CHAR_MAX + 1
-};
-
 static struct option const longopts[] =
 {
   {"digits", required_argument, NULL, 'n'},
@@ -197,7 +190,7 @@ static struct option const longopts[] =
   {"elide-empty-files", no_argument, NULL, 'z'},
   {"prefix", required_argument, NULL, 'f'},
   {"suffix-format", required_argument, NULL, 'b'},
-  {"suppress-matched", no_argument, NULL, SUPPRESS_MATCHED_OPTION},
+  {"suppress-matched", no_argument, NULL, 'm'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
@@ -1379,7 +1372,7 @@ main (int argc, char **argv)
         elide_empty_files = true;
         break;
 
-      case SUPPRESS_MATCHED_OPTION:
+      case 'm':
         suppress_matched = true;
         break;
 
-- 
2.4.3

Reply via email to