groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 61/80: [grn]: Fix command-line option handling.


From: G. Branden Robinson
Subject: [groff] 61/80: [grn]: Fix command-line option handling.
Date: Sat, 30 Nov 2024 04:02:26 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 431f00b5fd94522073e844409be7a96cb64c518e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 29 00:48:10 2024 -0600

    [grn]: Fix command-line option handling.
    
    * src/preproc/grn/main.cpp (main): Don't write diagnostic message when
      asked for `--help`.  Exit with status 2 on unrecognized option (for
      real this time, correcting commit 89283b0935, 18 October).
---
 ChangeLog                | 9 +++++++++
 src/preproc/grn/main.cpp | 5 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5ee507f98..3c41a87ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [grn]: Fix command-line option handling.
+
+       * src/preproc/grn/main.cpp (main): Don't write diagnostic
+       message when asked for `--help`.  Exit with status 2 on
+       unrecognized option (for real this time, correcting commit
+       89283b0935, 18 October).
+
 2024-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [gxditview]: Exit with status 2 on usage errors.
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index 0545c7248..d05b50dac 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -362,16 +362,15 @@ main(int argc,
        }
        if (strcmp(*argv,"--help")==0) {
       case '?':
-         error("unrecognized command-line option '%1'", char(optopt));
          usage(stdout);
-         exit(2);
+         exit(EXIT_SUCCESS);
          break;
        }
        // fallthrough
       default:
        error("unknown switch: %1", c);
        usage(stderr);
-       exit(1);
+       exit(2);
       }
   }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]