From 26961d2bc53d304d95d0d644f2ff4146623b53fb Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 29 Jun 2014 22:12:55 +0000 Subject: Major roff_getname() cleanup. * Return the name even if it is terminated by an escape sequence, not a blank. * Skip the full escape sequence using mandoc_escape(), not just the first byte. * Make it non-destructive, return the length instead of writing a '\0'. * Let .ds and .as cope with the above changes to the internal interface. * Fix .rm and .rr to accept an escape sequence as the end of a name. * Fix .nr and .rr to not set/delete a register with an empty name. --- regress/usr.bin/mandoc/roff/ds/Makefile | 4 ++-- regress/usr.bin/mandoc/roff/ds/escname.in | 14 ++++++++++++++ regress/usr.bin/mandoc/roff/ds/escname.out_ascii | 11 +++++++++++ regress/usr.bin/mandoc/roff/nr/Makefile | 4 ++-- regress/usr.bin/mandoc/roff/nr/escname.in | 15 +++++++++++++++ regress/usr.bin/mandoc/roff/nr/escname.out_ascii | 17 +++++++++++++++++ 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 regress/usr.bin/mandoc/roff/ds/escname.in create mode 100644 regress/usr.bin/mandoc/roff/ds/escname.out_ascii create mode 100644 regress/usr.bin/mandoc/roff/nr/escname.in create mode 100644 regress/usr.bin/mandoc/roff/nr/escname.out_ascii (limited to 'regress/usr.bin/mandoc/roff') diff --git a/regress/usr.bin/mandoc/roff/ds/Makefile b/regress/usr.bin/mandoc/roff/ds/Makefile index cbb879f5580..98a93d753fd 100644 --- a/regress/usr.bin/mandoc/roff/ds/Makefile +++ b/regress/usr.bin/mandoc/roff/ds/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.4 2014/04/07 21:00:00 schwarze Exp $ +# $OpenBSD: Makefile,v 1.5 2014/06/29 22:12:54 schwarze Exp $ -REGRESS_TARGETS = append nested quoting +REGRESS_TARGETS = append escname nested quoting .include diff --git a/regress/usr.bin/mandoc/roff/ds/escname.in b/regress/usr.bin/mandoc/roff/ds/escname.in new file mode 100644 index 00000000000..6394144b552 --- /dev/null +++ b/regress/usr.bin/mandoc/roff/ds/escname.in @@ -0,0 +1,14 @@ +.Dd June 29, 2014 +.Dt DS-ESCNAME 1 +.Os OpenBSD +.Sh NAME +.Nm ds-escname +.Nd escape sequences in string names +.Sh DESCRIPTION +.ds std\\esc stdval +Now \e*[std\\esc] is +.Sq \*[std\\esc] . +.Pp +.ds esc\eesc escval +Now \e*[esc] is +.Sq \*[esc] . diff --git a/regress/usr.bin/mandoc/roff/ds/escname.out_ascii b/regress/usr.bin/mandoc/roff/ds/escname.out_ascii new file mode 100644 index 00000000000..48d6bb51a3d --- /dev/null +++ b/regress/usr.bin/mandoc/roff/ds/escname.out_ascii @@ -0,0 +1,11 @@ +DS-ESCNAME(1) OpenBSD Reference Manual DS-ESCNAME(1) + +NNAAMMEE + ddss--eessccnnaammee - escape sequences in string names + +DDEESSCCRRIIPPTTIIOONN + Now \*[std\esc] is `stdval'. + + Now \*[esc] is `'. + +OpenBSD June 29, 2014 OpenBSD diff --git a/regress/usr.bin/mandoc/roff/nr/Makefile b/regress/usr.bin/mandoc/roff/nr/Makefile index e642dadeb26..a7bc4115a14 100644 --- a/regress/usr.bin/mandoc/roff/nr/Makefile +++ b/regress/usr.bin/mandoc/roff/nr/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.5 2014/04/07 15:05:12 schwarze Exp $ +# $OpenBSD: Makefile,v 1.6 2014/06/29 22:12:54 schwarze Exp $ -REGRESS_TARGETS = argc eval int predef rr +REGRESS_TARGETS = argc eval escname int predef rr .include diff --git a/regress/usr.bin/mandoc/roff/nr/escname.in b/regress/usr.bin/mandoc/roff/nr/escname.in new file mode 100644 index 00000000000..712b1d78d33 --- /dev/null +++ b/regress/usr.bin/mandoc/roff/nr/escname.in @@ -0,0 +1,15 @@ +.TH NR-ESCNAME 1 "June 29, 2014" OpenBSD +.SH NAME +nr-escname \- escape sequences in register names +.SH DESCRIPTION +.nr first 1 +.nr second 2 +.nr first\\second 3 +.nr first\esecond 4 +\n[first] \n[second] \n[first\\second] +.PP +.rr first\esecond +\n[first] \n[second] \n[first\\second] +.PP +.rr first\\second +\n[first] \n[second] \n[first\\second] diff --git a/regress/usr.bin/mandoc/roff/nr/escname.out_ascii b/regress/usr.bin/mandoc/roff/nr/escname.out_ascii new file mode 100644 index 00000000000..facc3fd1fda --- /dev/null +++ b/regress/usr.bin/mandoc/roff/nr/escname.out_ascii @@ -0,0 +1,17 @@ +NR-ESCNAME(1) OpenBSD Reference Manual NR-ESCNAME(1) + + + +NNAAMMEE + nr-escname - escape sequences in register names + +DDEESSCCRRIIPPTTIIOONN + 1 2 3 + + 0 2 3 + + 0 2 0 + + + +OpenBSD June 29, 2014 NR-ESCNAME(1) -- cgit v1.2.3