summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/char/space/Makefile4
-rw-r--r--regress/usr.bin/mandoc/char/space/esct-man.in34
-rw-r--r--regress/usr.bin/mandoc/char/space/esct-man.out_ascii36
-rw-r--r--regress/usr.bin/mandoc/char/space/esct-mdoc.in35
-rw-r--r--regress/usr.bin/mandoc/char/space/esct-mdoc.out_ascii34
-rw-r--r--usr.bin/mandoc/chars.c4
-rw-r--r--usr.bin/mandoc/chars.in3
-rw-r--r--usr.bin/mandoc/mandoc.c30
8 files changed, 169 insertions, 11 deletions
diff --git a/regress/usr.bin/mandoc/char/space/Makefile b/regress/usr.bin/mandoc/char/space/Makefile
index 7ce50af3cb1..578488d78ac 100644
--- a/regress/usr.bin/mandoc/char/space/Makefile
+++ b/regress/usr.bin/mandoc/char/space/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.6 2012/07/16 21:14:05 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2013/06/20 22:29:38 schwarze Exp $
REGRESS_TARGETS = leading-mdoc leading-man multiple zerowidth
-REGRESS_TARGETS += eos nobreak tab tab-man
+REGRESS_TARGETS += eos nobreak tab tab-man esct-mdoc esct-man
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/char/space/esct-man.in b/regress/usr.bin/mandoc/char/space/esct-man.in
new file mode 100644
index 00000000000..90aed2c7477
--- /dev/null
+++ b/regress/usr.bin/mandoc/char/space/esct-man.in
@@ -0,0 +1,34 @@
+.TH SPACE-ESCT-MAN 1 2013-06-20 OpenBSD
+.SH NAME
+SPACE-T-MAN \- the t escape sequence in pages with man macros
+.SH DESCRIPTION
+In plain text:
+.br
+single tab
+.br
+single\tescape-t
+.br
+double tab
+.br
+double\t\tescape-t
+.br
+\tThis line starts with escape-t and comes close to the right margin.
+\tThe next line starts with escape-t as well.
+.sp
+In a literal display:
+.nf
+single tab
+single\tescape-t
+double tab
+double\t\tescape-t
+.fi
+.sp
+After the IP macro:
+.IP single tab 3n
+text
+.IP single\tescape-t 3n
+text
+.PP
+After font macros:
+.br
+.B single\ttab
diff --git a/regress/usr.bin/mandoc/char/space/esct-man.out_ascii b/regress/usr.bin/mandoc/char/space/esct-man.out_ascii
new file mode 100644
index 00000000000..017b3b133d3
--- /dev/null
+++ b/regress/usr.bin/mandoc/char/space/esct-man.out_ascii
@@ -0,0 +1,36 @@
+SPACE-ESCT-MAN(1) OpenBSD Reference Manual SPACE-ESCT-MAN(1)
+
+
+
+NNAAMMEE
+ SPACE-T-MAN - the t escape sequence in pages with man macros
+
+DDEESSCCRRIIPPTTIIOONN
+ In plain text:
+ single tab
+ singleescape-t
+ double tab
+ doubleescape-t
+ This line starts with escape-t and comes close to the right margin.
+ The next line starts with escape-t as well.
+
+ In a literal display:
+ single tab
+ singleescape-t
+ double tab
+ doubleescape-t
+
+ After the IP macro:
+
+ single tab
+ text
+
+ single escape-t
+ text
+
+ After font macros:
+ ssiinnggllee ttaabb
+
+
+
+OpenBSD 2013-06-20 SPACE-ESCT-MAN(1)
diff --git a/regress/usr.bin/mandoc/char/space/esct-mdoc.in b/regress/usr.bin/mandoc/char/space/esct-mdoc.in
new file mode 100644
index 00000000000..6aa8c3923bc
--- /dev/null
+++ b/regress/usr.bin/mandoc/char/space/esct-mdoc.in
@@ -0,0 +1,35 @@
+.Dd $Mdocdate: June 20 2013 $
+.Dt SPACE-ESCT-MDOC 1
+.Os OpenBSD
+.Sh NAME
+.Nm space-esct-mdoc
+.Nd the t escape sequence in pages with mdoc macros
+.Sh DESCRIPTION
+In plain text:
+.Pp
+single tab
+.Pp
+single\tescape-t
+.Pp
+double tab
+.Pp
+double\t\tescape-t
+.Pp
+\tThis line starts with escape-t and comes close to the right margin.
+\tThe next line starts with escape-t as well.
+.Pp
+In an unfilled display:
+.Bd -unfilled -offset 3n
+single tab
+single\tescape-t
+double tab
+double\t\tescape-t
+.Ed
+.Pp
+In a literal display:
+.Bd -literal -offset 3n
+single tab
+single\tescape-t
+double tab
+double\t\tescape-t
+.Ed
diff --git a/regress/usr.bin/mandoc/char/space/esct-mdoc.out_ascii b/regress/usr.bin/mandoc/char/space/esct-mdoc.out_ascii
new file mode 100644
index 00000000000..b448b2a0e19
--- /dev/null
+++ b/regress/usr.bin/mandoc/char/space/esct-mdoc.out_ascii
@@ -0,0 +1,34 @@
+SPACE-ESCT-MDOC(1) OpenBSD Reference Manual SPACE-ESCT-MDOC(1)
+
+NNAAMMEE
+ ssppaaccee--eesscctt--mmddoocc - the t escape sequence in pages with mdoc macros
+
+DDEESSCCRRIIPPTTIIOONN
+ In plain text:
+
+ single tab
+
+ singleescape-t
+
+ double tab
+
+ doubleescape-t
+
+ This line starts with escape-t and comes close to the right margin. The
+ next line starts with escape-t as well.
+
+ In an unfilled display:
+
+ single tab
+ singleescape-t
+ double tab
+ doubleescape-t
+
+ In a literal display:
+
+ single tab
+ singleescape-t
+ double tab
+ doubleescape-t
+
+OpenBSD June 20, 2013 OpenBSD
diff --git a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c
index 57c0eea83ee..d8a7a1d3b23 100644
--- a/usr.bin/mandoc/chars.c
+++ b/usr.bin/mandoc/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.24 2013/05/18 16:38:54 schwarze Exp $ */
+/* $Id: chars.c,v 1.25 2013/06/20 22:29:38 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -33,7 +33,7 @@ struct ln {
int unicode;
};
-#define LINES_MAX 328
+#define LINES_MAX 329
#define CHAR(in, ch, code) \
{ NULL, (in), (ch), (code) },
diff --git a/usr.bin/mandoc/chars.in b/usr.bin/mandoc/chars.in
index e3bdbbfd760..fb905aee193 100644
--- a/usr.bin/mandoc/chars.in
+++ b/usr.bin/mandoc/chars.in
@@ -1,4 +1,4 @@
-/* $Id: chars.in,v 1.18 2011/10/09 17:59:56 schwarze Exp $ */
+/* $Id: chars.in,v 1.19 2013/06/20 22:29:38 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -42,6 +42,7 @@ CHAR("&", "", 0)
CHAR("^", "", 0)
CHAR("|", "", 0)
CHAR("}", "", 0)
+CHAR("t", "", 0)
/* Accents. */
CHAR("a\"", "\"", 779)
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index 768a23b10a0..e4903aa7b18 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.35 2012/07/07 18:27:36 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.36 2013/06/20 22:29:38 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -428,17 +428,35 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
pairs = 0;
white = 0;
for (cp = start; '\0' != *cp; cp++) {
- /* Move left after quoted quotes and escaped backslashes. */
+
+ /*
+ * Move the following text left
+ * after quoted quotes and after "\\" and "\t".
+ */
if (pairs)
cp[-pairs] = cp[0];
+
if ('\\' == cp[0]) {
- if ('\\' == cp[1]) {
- /* Poor man's copy mode. */
+ /*
+ * In copy mode, translate double to single
+ * backslashes and backslash-t to literal tabs.
+ */
+ switch (cp[1]) {
+ case ('t'):
+ cp[0] = '\t';
+ /* FALLTHROUGH */
+ case ('\\'):
pairs++;
cp++;
- } else if (0 == quoted && ' ' == cp[1])
+ break;
+ case (' '):
/* Skip escaped blanks. */
- cp++;
+ if (0 == quoted)
+ cp++;
+ break;
+ default:
+ break;
+ }
} else if (0 == quoted) {
if (' ' == cp[0]) {
/* Unescaped blanks end unquoted args. */