groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/20: [groff]: Tweak command-line option handling.


From: G. Branden Robinson
Subject: [groff] 07/20: [groff]: Tweak command-line option handling.
Date: Mon, 21 Oct 2024 20:14:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit aaf560dc850f1d96150aa3b191f55b790d6e24a2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
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 <g.branden.robinson@gmail.com>
+
+       * src/roff/groff/groff.cpp (main): Emit our own diagnostic for
+       an invalid command-line option.
+
 2024-10-18  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * 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 (jjc@jclark.com)
 
 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;



reply via email to

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