From a9844262036e028323f7d11f70991b9a54447ec4 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 6 Jul 2014 19:08:58 +0000 Subject: Clean up messages related to plain text and to escape sequences. * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming. --- usr.bin/mandoc/roff.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'usr.bin/mandoc/roff.c') diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 8f6e188250e..ceec0f7a274 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.91 2014/07/06 18:46:51 schwarze Exp $ */ +/* $Id: roff.c,v 1.92 2014/07/06 19:08:56 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -538,8 +538,9 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) break; default: if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL)) - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_vmsg(MANDOCERR_ESC_BAD, + r->parse, ln, (int)(stesc - *bufp), + "%.*s", (int)(cp - stesc), stesc); continue; } @@ -584,8 +585,8 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) arg_complete = 1; for (naml = 0; 0 == maxl || naml < maxl; naml++, cp++) { if ('\0' == *cp) { - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(stesc - *bufp), stesc); arg_complete = 0; break; } @@ -627,8 +628,9 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) } if (NULL == res) { - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_vmsg(MANDOCERR_STR_UNDEF, + r->parse, ln, (int)(stesc - *bufp), + "%.*s", (int)naml, stnam); res = ""; } @@ -1890,9 +1892,8 @@ roff_tr(ROFF_ARGS) if ('\\' == *first) { esc = mandoc_escape(&p, NULL, NULL); if (ESCAPE_ERROR == esc) { - mandoc_msg(MANDOCERR_BADESCAPE, - r->parse, ln, - (int)(p - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(p - *bufp), first); return(ROFF_IGN); } fsz = (size_t)(p - first); @@ -1902,9 +1903,8 @@ roff_tr(ROFF_ARGS) if ('\\' == *second) { esc = mandoc_escape(&p, NULL, NULL); if (ESCAPE_ERROR == esc) { - mandoc_msg(MANDOCERR_BADESCAPE, - r->parse, ln, - (int)(p - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(p - *bufp), second); return(ROFF_IGN); } ssz = (size_t)(p - second); -- cgit v1.2.3