gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit 9d93846b4af40ede7d82b7bd56ca6adf299b5767 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sun Apr 2 10:47:33 2023 -0500
[troff]: Revise ordinary character descriptions. * src/roff/troff/input.cpp (token::description): Revise construction of description of printable ordinary input characters (U+0021 through U+007E). This is to faciliate better diagnostics from the `rchar` request in the future. See Savannah #63985. --- ChangeLog | 8 ++++++++ src/roff/troff/input.cpp | 8 +++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bead82dad..9f31a5151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-04-02 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/roff/troff/input.cpp (token::description): Revise + construction of description of printable ordinary input + characters (U+0021 through U+007E). This is to faciliate better + diagnostics from the `rchar` request in the future. See + Savannah #63985. + 2023-04-01 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/input.cpp (chop_macro) diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 44f422723..54d8d271e 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -2402,7 +2402,8 @@ bool token::usable_as_delimiter(bool report_error) const char *token::description() { - static char buf[4]; + const size_t bufsz = strlen("character 'x'") + 1; + static char buf[bufsz]; switch (type) { case TOKEN_BACKSPACE: return "a backspace character"; @@ -2410,10 +2411,7 @@ const char *token::description() if (c == INPUT_DELETE) return "a delete character"; else { - buf[0] = '\''; - buf[1] = c; - buf[2] = '\''; - buf[3] = '\0'; + (void) snprintf(buf, bufsz, "character '%c'", c); return buf; } case TOKEN_DUMMY: _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit