[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 25/60: [troff]: Warn if `evc`, `ss` requests lack args.
From: |
G. Branden Robinson |
Subject: |
[groff] 25/60: [troff]: Warn if `evc`, `ss` requests lack args. |
Date: |
Wed, 11 Sep 2024 03:38:31 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 2d52e20099043b5d39dc8d11778faec202a364d7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Sep 9 15:40:41 2024 -0500
[troff]: Warn if `evc`, `ss` requests lack args.
* src/roff/troff/env.cpp (environment_copy, space_size): Check for
arguments: if none are present, throw warning in category "missing"
and skip the remainder of the input line.
---
ChangeLog | 6 ++++++
src/roff/troff/env.cpp | 20 ++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c1ea85540..2b5d80a3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/env.cpp (environment_copy, space_size):
+ Check for arguments: if none are present, throw warning in
+ category "missing" and skip the remainder of the input line.
+
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment_copy): Use C++
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index ee265a2e1..02ec02654 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1252,20 +1252,22 @@ void environment_switch()
void environment_copy()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "environment copy request expects an"
+ " argument");
+ skip_line();
+ return;
+ }
environment *e = 0 /* nullptr */;
tok.skip();
symbol nm = get_long_name();
- if (nm.is_null()) {
- error("no environment specified to copy from");
- }
- else {
- e = static_cast<environment *>(env_dictionary.lookup(nm));
+ assert(nm != 0 /* nullptr */);
+ e = static_cast<environment *>(env_dictionary.lookup(nm));
if (e != 0 /* nullptr */)
curenv->copy(e);
else
error("cannot copy from nonexistent environment '%1'",
nm.contents());
- }
skip_line();
}
@@ -1406,6 +1408,12 @@ void override_sizes()
void space_size()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "space size configuration request expects"
+ " at least one argument");
+ skip_line();
+ return;
+ }
int n;
if (get_integer(&n)) {
if (n < 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 25/60: [troff]: Warn if `evc`, `ss` requests lack args.,
G. Branden Robinson <=