gbranden pushed a commit to branch master
in repository groff.
commit 69bdfa7dcd64a65ac5504b28467ea452a2e3ef3a
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 18 18:04:22 2024 -0500
[pfbtops]: Tweak command-line option handling.
* src/utils/pfbtops/pfbtops.c (main): Emit our own diagnostic for an
invalid command-line option.
---
ChangeLog | 5 +++++
src/utils/pfbtops/pfbtops.c | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 54d470f3d..6490fa6ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-18 G. Branden Robinson <[email protected]>
+
+ * src/utils/pfbtops/pfbtops.c (main): Emit our own diagnostic
+ for an invalid command-line option.
+
2024-10-18 G. Branden Robinson <[email protected]>
* src/roff/groff/groff.cpp (main): Emit our own diagnostic for
diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c
index 8479739cb..0e3cbd796 100644
--- a/src/utils/pfbtops/pfbtops.c
+++ b/src/utils/pfbtops/pfbtops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
Written by James Clark ([email protected])
This file is part of groff.
@@ -180,7 +180,9 @@ int main(int argc, char **argv)
program_name = argv[0];
- while ((opt = getopt_long(argc, argv, "v", long_options, NULL)) != EOF) {
+ opterr = 0;
+ while ((opt = getopt_long(argc, argv, "v", long_options, NULL))
+ != EOF) {
switch (opt) {
case 'v':
printf("GNU pfbtops (groff) version %s\n", Version_string);
@@ -191,6 +193,8 @@ int main(int argc, char **argv)
exit(EXIT_SUCCESS);
break;
case '?':
+ fprintf(stderr, "%s: error: unrecognized command-line option"
+ " '%c'\n", program_name, (char) optopt);
usage(stderr);
exit(2);
break;
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit