groff-commit
[Top][All Lists]
Advanced

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

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


From: G. Branden Robinson
Subject: [groff] 10/20: 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 382b2ec699992cebbc9ded44c560d63e27fa4fce
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Oct 18 18:21:55 2024 -0500

    Tweak command-line option handling.
    
    * src/devices/grodvi/dvi.cpp (main):
    * src/devices/grohtml/post-html.cpp (main):
    * src/devices/grolbp/lbp.cpp (main):
    * src/devices/grolj4/lj4.cpp (main):
    * src/devices/grops/ps.cpp (main):
    * src/devices/grotty/tty.cpp (main):
    * src/preproc/eqn/main.cpp (main):
    * src/preproc/grn/main.cpp (main):
    * src/preproc/html/pre-html.cpp (main):
    * src/preproc/pic/main.cpp (main):
    * src/preproc/preconv/preconv.cpp (main):
    * src/preproc/soelim/soelim.cpp (main):
    * src/preproc/tbl/main.cpp (main):
    * src/roff/troff/input.cpp (main):
    * src/utils/hpftodit/hpftodit.cpp (usage):
    * src/utils/indxbib/indxbib.cpp (main):
    * src/utils/lkbib/lkbib.cpp (main):
    * src/utils/lookbib/lookbib.cpp (main):
    * src/utils/tfmtodit/tfmtodit.cpp (main): Emit our own diagnostic for an
      invalid command-line option.
---
 ChangeLog                         | 23 +++++++++++++++++++++++
 src/devices/grodvi/dvi.cpp        |  8 +++++---
 src/devices/grohtml/post-html.cpp |  4 +++-
 src/devices/grolbp/lbp.cpp        |  4 +++-
 src/devices/grolj4/lj4.cpp        |  8 +++++---
 src/devices/grops/ps.cpp          |  8 +++++---
 src/devices/grotty/tty.cpp        |  6 ++++--
 src/preproc/eqn/main.cpp          |  7 ++++---
 src/preproc/grn/main.cpp          |  1 +
 src/preproc/html/pre-html.cpp     |  4 +++-
 src/preproc/pic/main.cpp          |  8 +++++---
 src/preproc/preconv/preconv.cpp   |  4 +++-
 src/preproc/soelim/soelim.cpp     |  7 +++++--
 src/preproc/tbl/main.cpp          |  4 +++-
 src/roff/troff/input.cpp          |  2 ++
 src/utils/hpftodit/hpftodit.cpp   |  7 +++++--
 src/utils/indxbib/indxbib.cpp     |  4 +++-
 src/utils/lkbib/lkbib.cpp         |  8 +++++---
 src/utils/lookbib/lookbib.cpp     |  7 +++++--
 src/utils/tfmtodit/tfmtodit.cpp   |  4 +++-
 20 files changed, 95 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0a98e47ef..47127a07e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2024-10-18  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grodvi/dvi.cpp (main):
+       * src/devices/grohtml/post-html.cpp (main):
+       * src/devices/grolbp/lbp.cpp (main):
+       * src/devices/grolj4/lj4.cpp (main):
+       * src/devices/grops/ps.cpp (main):
+       * src/devices/grotty/tty.cpp (main):
+       * src/preproc/eqn/main.cpp (main):
+       * src/preproc/grn/main.cpp (main):
+       * src/preproc/html/pre-html.cpp (main):
+       * src/preproc/pic/main.cpp (main):
+       * src/preproc/preconv/preconv.cpp (main):
+       * src/preproc/soelim/soelim.cpp (main):
+       * src/preproc/tbl/main.cpp (main):
+       * src/roff/troff/input.cpp (main):
+       * src/utils/hpftodit/hpftodit.cpp (usage):
+       * src/utils/indxbib/indxbib.cpp (main):
+       * src/utils/lkbib/lkbib.cpp (main):
+       * src/utils/lookbib/lookbib.cpp (main):
+       * src/utils/tfmtodit/tfmtodit.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/xtotroff/xtotroff.c (main): Emit our own diagnostic
diff --git a/src/devices/grodvi/dvi.cpp b/src/devices/grodvi/dvi.cpp
index 02a78c9e1..05e38c6b6 100644
--- a/src/devices/grodvi/dvi.cpp
+++ b/src/devices/grodvi/dvi.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.
@@ -923,8 +923,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((c = getopt_long(argc, argv, "dF:I:lp:vw:", long_options, NULL))
-        != EOF)
+  opterr = 0;
+  while ((c = getopt_long(argc, argv, "dF:I:lp:vw:", long_options,
+         NULL)) != EOF)
     switch(c) {
     case 'd':
       draw_flag = 0;
@@ -961,6 +962,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/devices/grohtml/post-html.cpp 
b/src/devices/grohtml/post-html.cpp
index 868236388..70c0a2748 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2024 Free Software Foundation, Inc.
  *
  *  Gaius Mulley (gaius@glam.ac.uk) wrote post-html.cpp
  *  but it owes a huge amount of ideas and raw code from
@@ -5550,6 +5550,7 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((c = getopt_long(argc, argv,
          "a:bCdD:eF:g:Ghi:I:j:lno:prs:S:vVx:y", long_options, NULL))
         != EOF)
@@ -5644,6 +5645,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index de1660fcc..111285f4c 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2024 Free Software Foundation, Inc.
      Written by Francisco Andr�s Verd� <pandres@dragonet.es> with many
      ideas taken from the other groff drivers.
 
@@ -655,6 +655,7 @@ int main(int argc, char **argv)
   // command line parsing
   int c;
   int option_index = 0;
+  opterr = 0;
   while ((c = getopt_long(argc, argv, "c:F:hI:lo:p:vw:", long_options,
                          &option_index))
         != EOF) {
@@ -721,6 +722,7 @@ int main(int argc, char **argv)
       usage(stdout);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp
index 0ebfda6ac..cb623080e 100644
--- a/src/devices/grolj4/lj4.cpp
+++ b/src/devices/grolj4/lj4.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2024 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
 This file is part of groff.
@@ -616,8 +616,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((c = getopt_long(argc, argv, "c:d:F:I:lp:vw:", long_options, NULL))
-        != EOF)
+  opterr = 0;
+  while ((c = getopt_long(argc, argv, "c:d:F:I:lp:vw:", long_options,
+         NULL)) != EOF)
     switch(c) {
     case 'l':
       landscape_flag = 1;
@@ -687,6 +688,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 5fb47d606..65fd5e953 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.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.
@@ -1803,8 +1803,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((c = getopt_long(argc, argv, "b:c:F:gI:lmp:P:vw:", long_options, 
NULL))
-        != EOF)
+  opterr = 0;
+  while ((c = getopt_long(argc, argv, "b:c:F:gI:lmp:P:vw:",
+         long_options, NULL)) != EOF)
     switch(c) {
     case 'b':
       // XXX check this
@@ -1860,6 +1861,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 82af90f7b..da29b2cf9 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -942,8 +942,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((c = getopt_long(argc, argv, "bBcdfF:hiI:oruUv", long_options, NULL))
-        != EOF)
+  opterr = 0;
+  while ((c = getopt_long(argc, argv, "bBcdfF:hiI:oruUv", long_options,
+         NULL)) != EOF)
     switch(c) {
     case 'v':
       printf("GNU grotty (groff) version %s\n", Version_string);
@@ -1002,6 +1003,7 @@ int main(int argc, char **argv)
       usage(stdout);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index f82e3800d..a190d6d6a 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2023 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.
@@ -330,9 +330,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((opt = getopt_long(argc, argv, "CNrRd:f:m:M:p:s:T:v",
-                           long_options, NULL))
-        != EOF)
+                           long_options, NULL)) != EOF)
     switch (opt) {
     case 'C':
       compatible_flag = 1;
@@ -418,6 +418,7 @@ int main(int argc, char **argv)
       exit(EXIT_SUCCESS);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index d632e897b..ffd6edd64 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -352,6 +352,7 @@ main(int argc,
        }
        if (strcmp(*argv,"--help")==0) {
       case '?':
+         error("unrecognized command-line option '%1'", char(optopt));
          usage(stdout);
          exit(2);
          break;
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 8b86add80..432e98d25 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2024 Free Software Foundation, Inc.
  * Written by Gaius Mulley (gaius@glam.ac.uk).
  *
  * This file is part of groff.
@@ -1603,6 +1603,7 @@ static int scanArguments(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { 0 /* nullptr */, 0, 0, 0 }
   };
+  opterr = 0;
   while ((c = getopt_long(argc, argv,
          "+a:bCdD:eF:g:Ghi:I:j:lno:prs:S:vVx:y", long_options,
          0 /* nullptr */))
@@ -1698,6 +1699,7 @@ static int scanArguments(int argc, char **argv)
       usage(stdout);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 6e4d27f06..51f99291d 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.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.
@@ -541,8 +541,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((opt = getopt_long(argc, argv, "T:CDSUtcvnxzpf", long_options, NULL))
-        != EOF)
+  opterr = 0;
+  while ((opt = getopt_long(argc, argv, "T:CDSUtcvnxzpf", long_options,
+         NULL)) != EOF)
     switch (opt) {
     case 'C':
       compatible_flag = 1;
@@ -600,6 +601,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 73cddcb97..dbf7b188f 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2024 Free Software Foundation, Inc.
      Written by Werner Lemberg (wl@gnu.org)
 
 This file is part of groff.
@@ -1257,6 +1257,7 @@ main(int argc, char **argv)
     { NULL, 0, 0, 0 }
   };
   // Parse the command-line options.
+  opterr = 0;
   while ((opt = getopt_long(argc, argv,
                            "dD:e:hrv", long_options, NULL)) != EOF)
     switch (opt) {
@@ -1300,6 +1301,7 @@ main(int argc, char **argv)
       usage(stdout);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 6ac8de06c..6d120927b 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.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.
@@ -63,7 +63,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((opt = getopt_long(argc, argv, "CI:rtv", long_options, NULL)) != EOF)
+  opterr = 0;
+  while ((opt = getopt_long(argc, argv, "CI:rtv", long_options, NULL))
+        != EOF)
     switch (opt) {
     case 'v':
       printf("GNU soelim (groff) version %s\n", Version_string);
@@ -86,6 +88,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index 2ac842752..b7b9aa6b1 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.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.
@@ -1648,6 +1648,7 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((opt = getopt_long(argc, argv, "vC", long_options, NULL))
          != EOF)
     switch (opt) {
@@ -1665,6 +1666,7 @@ int main(int argc, char **argv)
       exit(EXIT_SUCCESS);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index afcfb4b1b..3732f1b83 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8912,6 +8912,7 @@ int main(int argc, char **argv)
 #else
 #define DEBUG_OPTION ""
 #endif
+  opterr = 0;
   while ((c = getopt_long(argc, argv,
                          "abciI:vw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU"
                          DEBUG_OPTION, long_options, 0))
@@ -9023,6 +9024,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr, argv[0]);
       exit(2);
       break;           // never reached
diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp
index 6f7851564..c816f5fac 100644
--- a/src/utils/hpftodit/hpftodit.cpp
+++ b/src/utils/hpftodit/hpftodit.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2024 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
 This file is part of groff.
@@ -297,7 +297,9 @@ main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((opt = getopt_long(argc, argv, "adsqvi:", long_options, NULL)) != 
EOF) {
+  opterr = 0;
+  while ((opt = getopt_long(argc, argv, "adsqvi:", long_options, NULL))
+        != EOF) {
     switch (opt) {
     case 'a':
       all_flag = YES;
@@ -324,6 +326,7 @@ main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage();
       break;
     default:
diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index 63a0053c2..6999af259 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.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.
@@ -131,6 +131,7 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((opt = getopt_long(argc, argv, "c:o:h:i:k:l:t:n:c:d:f:vw",
                            long_options, NULL))
         != EOF)
@@ -184,6 +185,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/utils/lkbib/lkbib.cpp b/src/utils/lkbib/lkbib.cpp
index f73c7c1bb..7e8ba3396 100644
--- a/src/utils/lkbib/lkbib.cpp
+++ b/src/utils/lkbib/lkbib.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.
@@ -57,8 +57,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((opt = getopt_long(argc, argv, "nvVi:t:p:", long_options, NULL))
-        != EOF)
+  opterr = 0;
+  while ((opt = getopt_long(argc, argv, "nvVi:t:p:", long_options,
+         NULL)) != EOF)
     switch (opt) {
     case 'V':
       do_verify = true;
@@ -96,6 +97,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/utils/lookbib/lookbib.cpp b/src/utils/lookbib/lookbib.cpp
index c3affaec1..1eb0743b5 100644
--- a/src/utils/lookbib/lookbib.cpp
+++ b/src/utils/lookbib/lookbib.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.
@@ -59,7 +59,9 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
-  while ((opt = getopt_long(argc, argv, "vVi:t:", long_options, NULL)) != EOF)
+  opterr = 0;
+  while ((opt = getopt_long(argc, argv, "vVi:t:", long_options, NULL))
+        != EOF)
     switch (opt) {
     case 'V':
       do_verify = true;
@@ -91,6 +93,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;
diff --git a/src/utils/tfmtodit/tfmtodit.cpp b/src/utils/tfmtodit/tfmtodit.cpp
index fa0615817..6cd8c4c5c 100644
--- a/src/utils/tfmtodit/tfmtodit.cpp
+++ b/src/utils/tfmtodit/tfmtodit.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.
@@ -700,6 +700,7 @@ int main(int argc, char **argv)
     { "version", no_argument, 0, 'v' },
     { NULL, 0, 0, 0 }
   };
+  opterr = 0;
   while ((opt = getopt_long(argc, argv, "svg:k:", long_options, NULL))
         != EOF)
     switch (opt) {
@@ -730,6 +731,7 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case '?':
+      error("unrecognized command-line option '%1'", char(optopt));
       usage(stderr);
       exit(2);
       break;



reply via email to

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