gbranden pushed a commit to branch master
in repository groff.
commit 5a826806d0388ff6252abe1f6ae59417c0452021
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 22 23:25:57 2026 -0600
[troff]: `pev` request accepts arguments (1/2).
* src/roff/troff/env.cpp (print_environment_request): Accept
arguments; interpret each as an environment identifier, and dump the
properties thereof if it exists.
Begins fixing <https://savannah.gnu.org/bugs/?68905>.
This commit omits an indentation update to clarify the logic change.
---
ChangeLog | 6 ++++++
src/roff/troff/env.cpp | 26 ++++++++++++++++++++++----
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7278a89c4..4ba24cef6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-11-22 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (print_environment_request): Accept
+ arguments; interpret each as an environment identifier, and dump
+ the properties thereof if it exists.
+
2026-11-22 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (struct grostream): Declare new
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index bd9d2b312..ab04e1310 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3814,15 +3814,32 @@ void environment::dump()
}
// TODO: Revise to report, without arguments, only the environment stack
-// contents from top to bottom; report details only of environments
-// named in arguments.
+// contents from top to bottom, then list unstacked environments.
static void print_environment_request() // .pev
{
+ symbol s;
+ environment *e;
+ if (has_arg()) {
+ do {
+ s = read_identifier();
+ if (s.is_null()) {
+ skip_rest_of_argument();
+ continue;
+ }
+ e = static_cast<environment *>(env_dictionary.lookup(s));
+ if (e != 0 /* nullptr */) {
+ // If you end your environment name with a colon, I got no
+ // sympathy for ya.
+ errprint("environment %1:\n", s.contents());
+ fflush(stderr);
+ e->dump();
+ }
+ } while(has_arg());
+ }
+ else {
errprint("Current Environment:\n");
curenv->dump();
dictionary_iterator iter(env_dictionary);
- symbol s;
- environment *e;
while (iter.get(&s, (void **)&e)) {
assert(!s.is_null());
errprint("Environment %1:\n", s.contents());
@@ -3831,6 +3848,7 @@ static void print_environment_request() // .pev
else
errprint(" current\n");
}
+ }
fflush(stderr);
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit