summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-08-16 17:30:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-08-16 17:30:11 +0000
commitbf8f89c275e14bc95d284f7fed7a338d9b5c2f81 (patch)
tree96070a3e20c9043df55a49fb304ce9e9a651427b
parent6f1c9638ef3c94503710dae1d651c0ff277f1820 (diff)
downloadmandoc-bf8f89c275e14bc95d284f7fed7a338d9b5c2f81.tar.gz
Even though the constant ASCII_ESC is only used in the roff pre-parser roff.c,
move it to the top level include file mandoc.h to reduce the risk of causing clashes when introducing new ASCII_* constants in the future.
-rw-r--r--mandoc.h2
-rw-r--r--roff.c15
2 files changed, 8 insertions, 9 deletions
diff --git a/mandoc.h b/mandoc.h
index 79c3d8da..b0817905 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -23,6 +23,8 @@
#define ASCII_NBRZW 30 /* non-breaking zero-width space */
#define ASCII_BREAK 29 /* breakable zero-width space */
#define ASCII_HYPH 28 /* breakable hyphen */
+#define ASCII_ESC 27 /* escape sequence from copy-in processing */
+#define ASCII_TABREF 26 /* reset tab reference position */
/*
* Status level. This refers to both internal status (i.e., whilst
diff --git a/roff.c b/roff.c
index f3565f85..47ea41b5 100644
--- a/roff.c
+++ b/roff.c
@@ -40,14 +40,6 @@
#include "tbl_parse.h"
#include "eqn_parse.h"
-/*
- * ASCII_ESC is used to signal from roff_getarg() to roff_expand()
- * that an escape sequence resulted from copy-in processing and
- * needs to be checked or interpolated. As it is used nowhere
- * else, it is defined here rather than in a header file.
- */
-#define ASCII_ESC 27
-
/* Maximum number of string expansions per line, to break infinite loops. */
#define EXPAND_LIMIT 1000
@@ -1640,8 +1632,13 @@ roff_getarg(struct roff *r, char **cpp, int ln, int *pos)
cp++;
break;
case '\\':
- newesc = 1;
+ /*
+ * Signal to roff_expand() that an escape
+ * sequence resulted from copy-in processing
+ * and needs to be checked or interpolated.
+ */
cp[-pairs] = ASCII_ESC;
+ newesc = 1;
pairs++;
cp++;
break;