summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-08 04:43:40 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-08 04:43:40 +0000
commitc9173817bded99096dbc594042cf24715884e180 (patch)
treec4a0aeb5a32b77b22bf9693f2fb97fdfc1fb0220 /regress/usr.bin
parent9a80470cd3802448eae1127e6d22b15319fc4e95 (diff)
Improve .if/.ie condition handling.
* Support string comparisons. * Support negation not only for numerical, but for all conditions. * Switch the `o' condition from false to true. * Handle the `c', `d', and `r' conditions as false for now. * Use int for boolean data instead of rolling our own "enum roffrule"; needed such that we can use the standard ! and == operators. Havard Eidnes reported via the NetBSD bug tracking system that some Tcl*(3) manuals need this, and Thomas Klausner <wiz at NetBSD> forwarded the report to me. This doesn't make the crazy Tcl*(3) macrology maze happy yet, but brings us a bit closer.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/mandoc/roff/cond/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/cond/strcmp.in37
-rw-r--r--regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii18
3 files changed, 57 insertions, 2 deletions
diff --git a/regress/usr.bin/mandoc/roff/cond/Makefile b/regress/usr.bin/mandoc/roff/cond/Makefile
index 6f4f653b392..11511142584 100644
--- a/regress/usr.bin/mandoc/roff/cond/Makefile
+++ b/regress/usr.bin/mandoc/roff/cond/Makefile
@@ -1,5 +1,5 @@
-# $OpenBSD: Makefile,v 1.4 2013/10/04 02:19:47 schwarze Exp $
+# $OpenBSD: Makefile,v 1.5 2014/03/08 04:43:39 schwarze Exp $
-REGRESS_TARGETS = if ie close numeric before-Dd
+REGRESS_TARGETS = if ie close numeric strcmp before-Dd
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/cond/strcmp.in b/regress/usr.bin/mandoc/roff/cond/strcmp.in
new file mode 100644
index 00000000000..eabe80ffe63
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/cond/strcmp.in
@@ -0,0 +1,37 @@
+.TH COND-STRCMP 1 "March 8, 2014" OpenBSD
+.SH NAME
+cond-strcmp \- roff conditions involving string comparison
+.SH DESCRIPTION
+empty:
+.ie """ (t)
+.el (f)
+one char:
+.ie xaxax (t)
+.el (f)
+three chars:
+.ie xabcxabcx (t)
+.el (f)
+.br
+mismatch:
+.ie xabcxabdx (t)
+.el (f)
+longer:
+.ie xabcxabcdx (t)
+.el (f)
+shorter:
+.ie xabcdxabcx (t)
+.el (f)
+.br
+no middle:
+.ie xabc (t)
+.el (f)
+no end:
+.ie xabcxabc
+.el (f)
+.SS Negation
+match:
+.ie !xabcxabcx (t)
+.el (f)
+mismatch:
+.ie !xaxbx (t)
+.el (f)
diff --git a/regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii b/regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii
new file mode 100644
index 00000000000..d96b51b527a
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii
@@ -0,0 +1,18 @@
+COND-STRCMP(1) OpenBSD Reference Manual COND-STRCMP(1)
+
+
+
+NNAAMMEE
+ cond-strcmp - roff conditions involving string comparison
+
+DDEESSCCRRIIPPTTIIOONN
+ empty: (t) one char: (t) three chars: (t)
+ mismatch: (f) longer: (f) shorter: (f)
+ no middle: (f) no end: (f)
+
+ NNeeggaattiioonn
+ match: (f) mismatch: (t)
+
+
+
+OpenBSD March 8, 2014 COND-STRCMP(1)