diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-28 17:35:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-28 17:35:43 +0000 |
commit | e65351f6a3dd637d14b3fcf8be0e8367a1aacc0d (patch) | |
tree | 492cb187aebcd5f308bdfabec30d31afbaa8de63 /usr.bin/mandoc/term_ascii.c | |
parent | 24322f395665631cc678573c61a088bf15bc333c (diff) |
Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.
Diffstat (limited to 'usr.bin/mandoc/term_ascii.c')
-rw-r--r-- | usr.bin/mandoc/term_ascii.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c index 862c025ed10..db246938ef4 100644 --- a/usr.bin/mandoc/term_ascii.c +++ b/usr.bin/mandoc/term_ascii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term_ascii.c,v 1.24 2014/10/28 02:43:05 schwarze Exp $ */ +/* $OpenBSD: term_ascii.c,v 1.25 2014/10/28 17:35:42 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -30,7 +30,8 @@ #include "term.h" #include "main.h" -static struct termp *ascii_init(enum termenc, char *); +static struct termp *ascii_init(enum termenc, + const struct mchars *, char *); static double ascii_hspan(const struct termp *, const struct roffsu *); static size_t ascii_width(const struct termp *, int); @@ -48,7 +49,7 @@ static size_t locale_width(const struct termp *, int); static struct termp * -ascii_init(enum termenc enc, char *outopts) +ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts) { const char *toks[5]; char *v; @@ -56,6 +57,7 @@ ascii_init(enum termenc enc, char *outopts) p = mandoc_calloc(1, sizeof(struct termp)); + p->symtab = mchars; p->tabwidth = 5; p->defrmargin = p->lastrmargin = 78; @@ -121,24 +123,24 @@ ascii_init(enum termenc enc, char *outopts) } void * -ascii_alloc(char *outopts) +ascii_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_ASCII, outopts)); + return(ascii_init(TERMENC_ASCII, mchars, outopts)); } void * -utf8_alloc(char *outopts) +utf8_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_UTF8, outopts)); + return(ascii_init(TERMENC_UTF8, mchars, outopts)); } void * -locale_alloc(char *outopts) +locale_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_LOCALE, outopts)); + return(ascii_init(TERMENC_LOCALE, mchars, outopts)); } static void |