aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-01-22 21:02:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-01-22 21:02:54 +0000
commit174c2e821dbf551a597ee65dca7d4cd7edc0c789 (patch)
treea450f4a94e8cbbdc02776b6c904911b22d785087
parentc98359b4b81cf2d518b929ed45409e33dfddbc52 (diff)
downloadmandoc-174c2e821dbf551a597ee65dca7d4cd7edc0c789.tar.gz
mandoc-174c2e821dbf551a597ee65dca7d4cd7edc0c789.tar.zst
mandoc-174c2e821dbf551a597ee65dca7d4cd7edc0c789.zip
Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual and also supported by groff. Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.
-rw-r--r--apropos_db.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/apropos_db.c b/apropos_db.c
index 786fc7bd..52b577c6 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -1,7 +1,7 @@
-/* $Id: apropos_db.c,v 1.32.2.3 2013/10/10 23:43:04 schwarze Exp $ */
+/* $Id: apropos_db.c,v 1.32.2.4 2014/01/22 21:02:54 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -259,8 +259,8 @@ norm_string(const char *val, const struct mchars *mc, char **buf)
const char *seq, *cpp;
int len, u, pos;
enum mandoc_esc esc;
- static const char res[] = { '\\', '\t',
- ASCII_NBRSP, ASCII_HYPH, '\0' };
+ static const char res[] = { '\\', '\t', ASCII_NBRSP,
+ ASCII_HYPH, ASCII_BREAK, '\0' };
/* Pre-allocate by the length of the input */
@@ -280,15 +280,23 @@ norm_string(const char *val, const struct mchars *mc, char **buf)
val += (int)sz;
}
- if (ASCII_HYPH == *val) {
+ switch (*val) {
+ case (ASCII_HYPH):
(*buf)[pos++] = '-';
val++;
continue;
- } else if ('\t' == *val || ASCII_NBRSP == *val) {
+ case ('\t'):
+ /* FALLTHROUGH */
+ case (ASCII_NBRSP):
(*buf)[pos++] = ' ';
val++;
+ /* FALLTHROUGH */
+ case (ASCII_BREAK):
continue;
- } else if ('\\' != *val)
+ default:
+ break;
+ }
+ if ('\\' != *val)
break;
/* Read past the slash. */