gbranden pushed a commit to branch master
in repository groff.
commit 926d8df61122e3dd2c9620dc1a7fb639419f46d6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 22 18:55:06 2026 -0600
src/roff/troff/node.cpp: Add warning.
* src/roff/troff/node.cpp (set_ligature_mode_request): Throw warning in
category "range" when the ligature mode argument is out of range.
---
ChangeLog | 6 ++++++
src/roff/troff/node.cpp | 13 +++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cdea22f1d..bcb7a0028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-11-22 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp (set_ligature_mode_request): Throw
+ warning in category "range" when the ligature mode argument is
+ out of range.
+
2026-11-22 G. Branden Robinson <[email protected]>
* src/roff/troff/node.cpp: Fix code style nits.
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index f3f092bc5..9650e9588 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7615,8 +7615,17 @@ static void constantly_space_font_request() // .cs
static void set_ligature_mode_request() // .lg
{
int lig;
- if (has_arg() && read_integer(&lig) && (lig >= 0) && (lig <= 2))
- global_ligature_mode = lig;
+ if (has_arg()) {
+ if (read_integer(&lig)) {
+ if ((lig < 0) || (lig > 2)) {
+ warning(WARN_RANGE, "ligature mode must be in range 0..2,"
+ " got %1", lig);
+ skip_line();
+ return;
+ }
+ global_ligature_mode = lig;
+ }
+ }
else
global_ligature_mode = 1;
skip_line();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit