[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 08/20: [pfbtops]: Tweak command-line option handling.
From: |
G. Branden Robinson |
Subject: |
[groff] 08/20: [pfbtops]: 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 69bdfa7dcd64a65ac5504b28467ea452a2e3ef3a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
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 <g.branden.robinson@gmail.com>
+
+ * src/utils/pfbtops/pfbtops.c (main): Emit our own diagnostic
+ for an invalid command-line option.
+
2024-10-18 G. Branden Robinson <g.branden.robinson@gmail.com>
* 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 (jjc@jclark.com)
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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 08/20: [pfbtops]: Tweak command-line option handling.,
G. Branden Robinson <=