summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/mandoc.c b/mandoc.c
index 55419dc1..156bd689 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -432,17 +432,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. */