gbranden pushed a commit to branch master
in repository groff.
commit cf9d14998639ad91966af5db29b9ca865e3a416c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Oct 17 18:23:40 2026 -0500
[troff]: `pm` request advances past invalid args.
* src/roff/troff/input.cpp (print_macro_request): If a request argument
is an invalid identifier, skip over it instead of giving up on the
control line. Apart from maintaining a consistent symmetry with `rm`
request behavior, if there's a troublesome `rm` control line (perhaps
involving constructed register identifiers), this way you can
duplicate the `rm` line, change `rm` to `pm`, and isolate the
troublesome argument(s) by its/their absence in the list. (We don't
report the names of invalid identifiers because we have defined no
convention for encoding unprintable characters in this context.)
---
ChangeLog | 15 +++++++++++++++
src/roff/troff/input.cpp | 6 ++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 62bd9c033..99e65c61b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-10-17 G. Branden Robinson <[email protected]>
+
+ [troff]: `pm` request advances past invalid args.
+
+ * src/roff/troff/input.cpp (print_macro_request): If a request
+ argument is an invalid identifier, skip over it instead of
+ giving up on the control line. Apart from maintaining a
+ consistent symmetry with `rm` request behavior, if there's a
+ troublesome `rm` control line (perhaps involving constructed
+ register identifiers), this way you can duplicate the `rm` line,
+ change `rm` to `pm`, and isolate the troublesome argument(s) by
+ its/their absence in the list. (We don't report the names of
+ invalid identifiers because we have defined no convention for
+ encoding unprintable characters in this context.)
+
2026-10-17 G. Branden Robinson <[email protected]>
[troff]: `pnr` request advances past invalid args.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index b91afb51b..8ce17d919 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4393,8 +4393,10 @@ static void print_macro_request() // .pm
if (has_arg()) {
do {
s = read_identifier();
- if (s.is_null())
- break;
+ if (s.is_null()) {
+ skip_rest_of_argument();
+ continue;
+ }
rm = static_cast<request_or_macro *>(request_dictionary.lookup(s));
if (rm != 0 /* nullptr */)
m = rm->to_macro();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit