let \l use the right fill character
authorschwarze <schwarze@openbsd.org>
Wed, 14 Jun 2017 18:23:26 +0000 (18:23 +0000)
committerschwarze <schwarze@openbsd.org>
Wed, 14 Jun 2017 18:23:26 +0000 (18:23 +0000)
regress/usr.bin/mandoc/roff/esc/Makefile
regress/usr.bin/mandoc/roff/esc/l.in [new file with mode: 0644]
regress/usr.bin/mandoc/roff/esc/l.out_ascii [new file with mode: 0644]
regress/usr.bin/mandoc/roff/esc/l.out_lint [new file with mode: 0644]
usr.bin/mandoc/out.c
usr.bin/mandoc/term.c

index 6d81161..dd4eb67 100644 (file)
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.12 2017/06/14 01:31:19 schwarze Exp $
+# $OpenBSD: Makefile,v 1.13 2017/06/14 18:23:26 schwarze Exp $
 
-REGRESS_TARGETS = one two multi B c c_man e f h o p w z ignore
-LINT_TARGETS   = B h w ignore
+REGRESS_TARGETS = one two multi B c c_man e f h o p w z ignore
+LINT_TARGETS   = B h w ignore
 
 .include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/esc/l.in b/regress/usr.bin/mandoc/roff/esc/l.in
new file mode 100644 (file)
index 0000000..59b9b5c
--- /dev/null
@@ -0,0 +1,22 @@
+.Dd June 14, 2017
+.Dt ESC-L 1
+.Os OpenBSD
+.Sh NAME
+.Nm esc-l
+.Nd the roff escape l sequence: horizontal line
+.Sh DESCRIPTION
+explicit scaling unit and fill char: >\l'2nf'<
+.br
+explicit scaling unit and default char: >\l'3n'<
+.br
+default unit and explicit fill char: >\l'4x'<
+.br
+default unit and char: >\l'5'<
+.br
+explicit scaling unit and escape sequence: >\l'6n\(+-'<
+.br
+default unit and escape char: >\l'7n\(at'<
+.br
+rounding: >\l'0.26ix'<
+.br
+invalid delimiter: >\h-<
diff --git a/regress/usr.bin/mandoc/roff/esc/l.out_ascii b/regress/usr.bin/mandoc/roff/esc/l.out_ascii
new file mode 100644 (file)
index 0000000..f8ab5d1
--- /dev/null
@@ -0,0 +1,16 @@
+ESC-L(1)                    General Commands Manual                   ESC-L(1)
+
+N\bNA\bAM\bME\bE
+     e\bes\bsc\bc-\b-l\bl - the roff escape l sequence: horizontal line
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+     explicit scaling unit and fill char: >ff<
+     explicit scaling unit and default char: >___<
+     default unit and explicit fill char: >xxxx<
+     default unit and char: >_____<
+     explicit scaling unit and escape sequence: >+-+-+-<
+     default unit and escape char: >@@@@@@@<
+     rounding: >xxx<
+     invalid delimiter: ><
+
+OpenBSD                          June 14, 2017                         OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/esc/l.out_lint b/regress/usr.bin/mandoc/roff/esc/l.out_lint
new file mode 100644 (file)
index 0000000..2141ef4
--- /dev/null
@@ -0,0 +1,2 @@
+mandoc: l.in:22:21: WARNING: invalid escape sequence: \h-
+mandoc: l.in:1:5: STYLE: Mdocdate missing: Dd June
index 684d6ec..a0607fd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: out.c,v 1.39 2017/06/12 22:05:41 schwarze Exp $ */
+/*     $OpenBSD: out.c,v 1.40 2017/06/14 18:23:26 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -83,10 +83,8 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
        case 'v':
                dst->unit = SCALE_VS;
                break;
-       case '\0':
-               endptr--;
-               /* FALLTHROUGH */
        default:
+               endptr--;
                if (SCALE_MAX == def)
                        return NULL;
                dst->unit = def;
index 9c93a3a..0f59fdc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: term.c,v 1.131 2017/06/14 17:50:43 schwarze Exp $ */
+/*     $OpenBSD: term.c,v 1.132 2017/06/14 18:23:26 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -545,7 +545,7 @@ term_word(struct termp *p, const char *word)
                        }
                        continue;
                case ESCAPE_HLINE:
-                       if ((seq = a2roffsu(seq, &su, SCALE_EM)) == NULL)
+                       if ((cp = a2roffsu(seq, &su, SCALE_EM)) == NULL)
                                continue;
                        uc = term_hen(p, &su);
                        if (uc <= 0) {
@@ -554,10 +554,10 @@ term_word(struct termp *p, const char *word)
                                lsz = p->tcol->rmargin - p->tcol->offset;
                        } else
                                lsz = uc;
-                       if (*seq == '\0')
+                       if (*cp == seq[-1])
                                uc = -1;
-                       else if (*seq == '\\') {
-                               seq++;
+                       else if (*cp == '\\') {
+                               seq = cp + 1;
                                esc = mandoc_escape(&seq, &cp, &sz);
                                switch (esc) {
                                case ESCAPE_UNICODE:
@@ -574,7 +574,7 @@ term_word(struct termp *p, const char *word)
                                        break;
                                }
                        } else
-                               uc = *seq;
+                               uc = *cp;
                        if (uc < 0x20 || (uc > 0x7E && uc < 0xA0))
                                uc = '_';
                        if (p->enc == TERMENC_ASCII) {