gbranden pushed a commit to branch master
in repository groff.

commit 3f7113e050b6d5cddb10779d5b5bcc5ea0d5faba
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 26 23:44:25 2024 -0500

    [troff]: Fix Savannah #66255 (stumpy `write` req).
    
    * src/roff/troff/input.cpp (do_write_request): Check for a second
      argument before proceeding as if it's there.  This makes `write` and
      `writec` behave more like other requests that read `contents` or
      `anything` arguments.
    
    Fixes <https://savannah.gnu.org/bugs/?66255>.
    
    This commit omits indentation changes to clarify the change.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index cc1f869ce..e9c8ea137 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-09-26  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (do_write_request): Check for a
+       second argument before proceeding as if it's there.  This makes
+       `write` and `writec` behave more like other requests that read
+       `contents` or `anything` arguments.
+
+       Fixes <https://savannah.gnu.org/bugs/?66255>.
+
 2024-09-26  G. Branden Robinson <[email protected]>
 
        [troff]: Add regression test for Savannah #66255.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 98f973fa0..71d49b520 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7509,6 +7509,7 @@ void do_write_request(int newline)
     skip_line();
     return;
   }
+  if (!tok.is_newline() && !tok.is_eof()) {
   int c;
   while ((c = get_copy(0)) == ' ')
     ;
@@ -7516,6 +7517,7 @@ void do_write_request(int newline)
     c = get_copy(0);
   for (; c != '\n' && c != EOF; c = get_copy(0))
     fputs(asciify(c), fp);
+  }
   if (newline)
     fputc('\n', fp);
   fflush(fp);

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to