[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 04/10: [troff]: Handle invalid `-o` argument better.
From: |
G. Branden Robinson |
Subject: |
[groff] 04/10: [troff]: Handle invalid `-o` argument better. |
Date: |
Thu, 17 Oct 2024 20:39:41 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 913dcac60e0fcfe11644c70fce61292ad4147807
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Oct 17 10:28:27 2024 -0500
[troff]: Handle invalid `-o` argument better.
* src/roff/troff/input.cpp (parse_output_page_list): Enhance diagnostic
message when `-o` option argument is nonsense; report the invalid
expression and inform user that it's being ignored.
Exhibit:
$ echo hello | ./build/test-groff -z -o 99x
troff: error: ignoring invalid output page list argument '99x'
---
ChangeLog | 6 ++++++
src/roff/troff/input.cpp | 5 +++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 51311f5f9..a80ec8925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-10-17 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/input.cpp (parse_output_page_list): Enhance
+ diagnostic message when `-o` option argument is nonsense; report
+ the invalid expression and inform user that it's being ignored.
+
2024-10-17 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (in_output_page_list): Demote return
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 48e2707f7..b5d616ea3 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8598,6 +8598,7 @@ bool in_output_page_list(int n)
static void parse_output_page_list(const char *p)
{
+ const char *pstart = p; // for diagnostic message
for (;;) {
int i;
if (*p == '-')
@@ -8632,8 +8633,8 @@ static void parse_output_page_list(const char *p)
++p;
}
if (*p != '\0') {
- error("bad output page list");
- output_page_list = 0;
+ error("ignoring invalid output page list argument '%1'", pstart);
+ output_page_list = 0 /* nullptr */;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 04/10: [troff]: Handle invalid `-o` argument better.,
G. Branden Robinson <=