gbranden pushed a commit to branch master
in repository groff.

commit aaf560dc850f1d96150aa3b191f55b790d6e24a2
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 18 17:54:10 2024 -0500

    [groff]: Tweak command-line option handling.
    
    * src/roff/groff/groff.cpp (main): Emit our own diagnostic for an
      invalid command-line option.
---
 ChangeLog                | 5 +++++
 src/roff/groff/groff.cpp | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 759444b74..54d470f3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-18  G. Branden Robinson <[email protected]>
+
+       * src/roff/groff/groff.cpp (main): Emit our own diagnostic for
+       an invalid command-line option.
+
 2024-10-18  G. Branden Robinson <[email protected]>
 
        * src/utils/pfbtops/pfbtops.c (main): Call `assert()` to catch
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index 41bc362d7..cd4ca58ea 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
      Written by James Clark ([email protected])
 
 This file is part of groff.
@@ -170,6 +170,7 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((opt = getopt_long(
                  argc, argv,
                  "abcCd:D:eEf:F:gGhiI:jJkK:lL:m:M:"
@@ -362,6 +363,7 @@ int main(int argc, char **argv)
       need_postdriver = false;
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       xexit(2);
       break;

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to