[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 04/44: [troff]: Ignore more invalid request invocations.
From: |
G. Branden Robinson |
Subject: |
[groff] 04/44: [troff]: Ignore more invalid request invocations. |
Date: |
Tue, 3 Sep 2024 08:05:39 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit d2d638a68a697484666d7fa488bfd57576b3964c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 1 01:20:53 2024 -0500
[troff]: Ignore more invalid request invocations.
* src/roff/troff/env.cpp (title):
* src/roff/troff/input.cpp (copy_file, vjustify [0], transparent_file):
Throw warning in category "missing" and ignore the request if given no
arguments, instead of starting the document and producing
device-independent output.
---
ChangeLog | 8 ++++++++
src/roff/troff/env.cpp | 6 ++++++
src/roff/troff/input.cpp | 18 ++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0d37dcf2b..b64090e7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/env.cpp (title):
+ * src/roff/troff/input.cpp (copy_file, vjustify [0])
+ (transparent_file): Throw warning in category "missing" and
+ ignore the request if given no arguments, instead of starting
+ the document and producing device-independent output.
+
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (has_arg): Improve and slightly
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 0ea46efb0..94daff478 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2557,6 +2557,12 @@ static void break_with_adjustment()
void title()
{
+ if (!has_arg(true /* peek */)) {
+ warning(WARN_MISSING, "title line request expects a delimited"
+ " argument");
+ skip_line();
+ return;
+ }
if (curdiv == topdiv && topdiv->before_first_page) {
handle_initial_title();
return;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2828a178d..79e0fb714 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8165,6 +8165,12 @@ void system_request()
void copy_file()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "file throughput request expects a file name"
+ " as argument");
+ skip_line();
+ return;
+ }
if (curdiv == topdiv && topdiv->before_first_page) {
handle_initial_request(COPY_FILE_REQUEST);
return;
@@ -8183,6 +8189,12 @@ void copy_file()
void vjustify()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "vertical adjustment request expects an"
+ " argument");
+ skip_line();
+ return;
+ }
if (curdiv == topdiv && topdiv->before_first_page) {
handle_initial_request(VJUSTIFY_REQUEST);
return;
@@ -8197,6 +8209,12 @@ void vjustify()
void transparent_file()
{
+ if (!has_arg()) {
+ warning(WARN_MISSING, "transparent file throughput request expects"
+ " a file name as argument");
+ skip_line();
+ return;
+ }
if (curdiv == topdiv && topdiv->before_first_page) {
handle_initial_request(TRANSPARENT_FILE_REQUEST);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 04/44: [troff]: Ignore more invalid request invocations.,
G. Branden Robinson <=