summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2010-08-18 02:38:40 +0000
committerschwarze <schwarze@openbsd.org>2010-08-18 02:38:40 +0000
commit0185943cba497582f0bcd90e02c89af679c6168d (patch)
treebfd96a435617565e93f007f3f6ac3870be1a338a
parentCorrectly display quotes around the .Lk link-name argument, (diff)
downloadwireguard-openbsd-0185943cba497582f0bcd90e02c89af679c6168d.tar.xz
wireguard-openbsd-0185943cba497582f0bcd90e02c89af679c6168d.zip
Ignore \h (local horizontal motion) and \v (local vertical motion) escapes
just in the same way as \s (font size) escapes, and handle \s escapes not having an explicit plus or minus sign. This fixes the very ugly rendering of "C++" in gcc(1). Reported by Thomas Jeunet, fixed by kristaps@.
-rw-r--r--usr.bin/mandoc/mandoc.c22
-rw-r--r--usr.bin/mandoc/out.c19
2 files changed, 23 insertions, 18 deletions
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index 68d3451042a..8f10304d336 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.16 2010/07/25 18:05:54 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.17 2010/08/18 02:38:40 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -53,8 +53,6 @@ mandoc_special(char *p)
/* FALLTHROUGH */
case ('w'):
/* FALLTHROUGH */
- case ('v'):
- /* FALLTHROUGH */
case ('S'):
/* FALLTHROUGH */
case ('R'):
@@ -87,13 +85,19 @@ mandoc_special(char *p)
term = '\'';
break;
#endif
+ case ('h'):
+ /* FALLTHROUGH */
+ case ('v'):
+ /* FALLTHROUGH */
case ('s'):
if (ASCII_HYPH == *p)
*p = '-';
- if ('+' == *p || '-' == *p)
- p++;
- i = ('s' != *(p - 1));
+ i = 0;
+ if ('+' == *p || '-' == *p) {
+ p++;
+ i = 1;
+ }
switch (*p++) {
case ('('):
@@ -106,7 +110,7 @@ mandoc_special(char *p)
term = '\'';
break;
case ('0'):
- i++;
+ i = 1;
/* FALLTHROUGH */
default:
len = 1;
@@ -117,13 +121,11 @@ mandoc_special(char *p)
if (ASCII_HYPH == *p)
*p = '-';
if ('+' == *p || '-' == *p) {
- if (i++)
+ if (i)
return(0);
p++;
}
- if (0 == i)
- return(0);
break;
#if 0
case ('Y'):
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index bbde1ea9ed7..4da5bb43634 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.6 2010/07/25 18:05:54 schwarze Exp $ */
+/* $Id: out.c,v 1.7 2010/08/18 02:38:40 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -236,11 +236,16 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz)
break;
}
break;
+ case ('h'):
+ /* FALLTHROUGH */
+ case ('v'):
+ /* FALLTHROUGH */
case ('s'):
- if ('+' == wp[i] || '-' == wp[i])
+ j = 0;
+ if ('+' == wp[i] || '-' == wp[i]) {
i++;
-
- j = ('s' != wp[i - 1]);
+ j = 1;
+ }
switch (wp[i++]) {
case ('('):
@@ -253,7 +258,7 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz)
term = '\'';
break;
case ('0'):
- j++;
+ j = 1;
/* FALLTHROUGH */
default:
i--;
@@ -262,13 +267,11 @@ a2roffdeco(enum roffdeco *d, const char **word, size_t *sz)
}
if ('+' == wp[i] || '-' == wp[i]) {
- if (j++)
+ if (j)
return(i);
i++;
}
- if (0 == j)
- return(i);
break;
case ('['):
*d = DECO_SPECIAL;