summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2022-08-16 17:29:19 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2022-08-16 17:29:19 +0000
commit061e52ca23a19767789adf70d0effd6dd1e160be (patch)
tree527695f8c02530fbd29299d7a73f959986a5371e /usr.bin/mandoc/roff.c
parent2e746f0a1bc59e334b9c96c8a378d569e71df973 (diff)
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.
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r--usr.bin/mandoc/roff.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 856adb9ae57..3512ceda94c 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.266 2022/06/07 09:41:22 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.267 2022/08/16 17:29:18 schwarze Exp $ */
/*
* Copyright (c) 2010-2015, 2017-2022 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -38,14 +38,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
@@ -1638,8 +1630,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;