gbranden pushed a commit to branch master
in repository groff.
commit e3335548f7b1bc13d48371bcd0641499e6f8ad56
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Aug 14 22:08:48 2022 -0500
[mm]: Validate `PS` macro calls better.
* contrib/mm/m.tmac (PS): Validate better; check for 2 arguments
exactly.
Also recast diagnostic message to state expectations clearly instead of
calling arguments "bad", which is vague.
---
contrib/mm/ChangeLog | 4 ++++
contrib/mm/m.tmac | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 5f23c39f5..1e58d80e9 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,7 @@
+2022-08-14 G. Branden Robinson <[email protected]>
+
+ * m.tmac (PS): Validate better; check for 2 arguments exactly.
+
2022-08-14 G. Branden Robinson <[email protected]>
* m.tmac (PS): Refactor; drop dead code. The `pic*in` register
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index a81d621fa..e642b9a3c 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -2397,7 +2397,11 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
.de PS
.br
.SP .5
-.ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
+.ie !\\n[.$]=2 \{\
+. ds pic*msg PS: expected 2 arguments, got \\n[.$]\"
+. as pic*msg ; not preprocessed with pic?\"
+. @error \\*[pic*msg]
+.\}
.el \{\
. if r ds*format .if !\\n[ds*lvl] .ne (u;\\$1)+1v
.\}
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit