From c9173817bded99096dbc594042cf24715884e180 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 8 Mar 2014 04:43:40 +0000 Subject: 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 forwarded the report to me. This doesn't make the crazy Tcl*(3) macrology maze happy yet, but brings us a bit closer. --- regress/usr.bin/mandoc/roff/cond/Makefile | 4 +-- regress/usr.bin/mandoc/roff/cond/strcmp.in | 37 +++++++++++++++++++++++ regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii | 18 +++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 regress/usr.bin/mandoc/roff/cond/strcmp.in create mode 100644 regress/usr.bin/mandoc/roff/cond/strcmp.out_ascii (limited to 'regress/usr.bin') 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 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) -- cgit v1.2.3