gbranden pushed a commit to branch master
in repository groff.

commit f66672e22ca8186fd03bc7a5164f9fff82d64bce
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Dec 29 05:36:58 2025 -0600

    src/roff/troff/input.cpp: Refactor.
    
    * src/roff/troff/input.cpp (abort_request): Replace open-coded logic
      duplicating an existing function with a call of `terminal_write()`.
---
 ChangeLog                |  6 ++++++
 src/roff/troff/input.cpp | 19 ++-----------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cc3244f26..c77403e8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-12-29  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp: Refactor.
+       (abort_request): Replace open-coded logic duplicating an
+       existing function with a call of `terminal_write()`.
+
 2025-12-29  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp: Trivially refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index afa58f957..20fe1b165 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -9307,23 +9307,8 @@ const char *readonly_mask_register::get_string()
 
 void abort_request()
 {
-  int c;
-  if (tok.is_eof())
-    c = EOF;
-  else if (tok.is_newline())
-    c = '\n';
-  else {
-    while ((c = read_char_in_copy_mode(0 /* nullptr */)) == ' ')
-      ;
-  }
-  if (!(c == EOF || c == '\n')) {
-    for (;
-        (c != '\n') && (c != EOF);
-        (c = read_char_in_copy_mode(0 /* nullptr */)))
-      fputs(encode_for_stream_output(c), stderr);
-    fputc('\n', stderr);
-  }
-  fflush(stderr);
+  terminal_write(true /* do append newline */ ,
+                false /* interpret leading spaces */);
   cleanup_and_exit(EXIT_FAILURE);
 }
 

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

Reply via email to