gbranden pushed a commit to branch master
in repository groff.
commit 036e3b5587abb97013cd4ebd89a1e14ce42f0def
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 23 10:11:02 2026 -0600
[troff]: `ev` returns early on error (1/2).
* src/roff/troff/env.cpp (environment_switch_request): Apply the usual
`skip_line()` and `return` idiom when encountering invalid input.
This commit omits an indentation update to clarify the logic change.
---
ChangeLog | 6 ++++++
src/roff/troff/env.cpp | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f595c221b..667f5f665 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-11-23 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (environment_switch_request): Make `ev`
+ return early on error. Apply the usual `skip_line()` and
+ `return` idiom when encountering invalid input.
+
2026-11-23 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp: Revise identifier error diagnostics.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index de032231e..df23790d8 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3949,8 +3949,9 @@ static void environment_switch_request() // .ev
{
if (curenv->is_dummy()) {
error("cannot switch out of dummy environment");
+ skip_line();
+ return;
}
- else {
symbol nm = read_long_identifier();
if (nm.is_null()) {
if (env_stack == 0 /* nullptr */)
@@ -3978,7 +3979,6 @@ static void environment_switch_request() // .ev
env_stack = new env_list_node(curenv, env_stack);
curenv = e;
}
- }
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit