[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 09/20: [xtotroff]: Tweak command-line option handling.
From: |
G. Branden Robinson |
Subject: |
[groff] 09/20: [xtotroff]: 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 4a17213d0aa188961f9d0a43b06fdaab3471e5ca
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Oct 18 18:04:54 2024 -0500
[xtotroff]: Tweak command-line option handling.
* src/utils/xtotroff/xtotroff.c (main): Emit our own diagnostic for an
invalid command-line option.
---
ChangeLog | 5 +++++
src/utils/xtotroff/xtotroff.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 6490fa6ed..0a98e47ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-18 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/utils/xtotroff/xtotroff.c (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): Emit our own diagnostic
diff --git a/src/utils/xtotroff/xtotroff.c b/src/utils/xtotroff/xtotroff.c
index ab599c722..a421b3a55 100644
--- a/src/utils/xtotroff/xtotroff.c
+++ b/src/utils/xtotroff/xtotroff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2022 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.
@@ -293,6 +293,7 @@ int main(int argc, char **argv)
program_name = argv[0];
+ opterr = 0;
while ((opt = getopt_long(argc, argv, "d:gr:s:v", long_options,
NULL)) != EOF) {
switch (opt) {
@@ -317,6 +318,8 @@ int main(int argc, char **argv)
xtotroff_exit(EXIT_SUCCESS);
break;
case '?':
+ fprintf(stderr, "%s: unrecognized command-line option '%c'\n",
+ program_name, (char) optopt);
usage(stderr);
xtotroff_exit(2);
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 09/20: [xtotroff]: Tweak command-line option handling.,
G. Branden Robinson <=