From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: If a predefined string is missing, emit a warning and make it an
Date: Thu, 26 May 2011 07:58:25 -0400 (EDT) [thread overview]
Message-ID: <201105261158.p4QBwPs9029826@krisdoz.my.domain> (raw)
Log Message:
-----------
If a predefined string is missing, emit a warning and make it an empty
string instead of passing it along to libmdoc/libman (where it'll be
printed verbatim, now). This is what groff seems to do, too (of course
without a warning).
Modified Files:
--------------
mdocml:
roff.c
Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -Lroff.c -Lroff.c -u -p -r1.141 -r1.142
--- roff.c
+++ roff.c
@@ -150,7 +150,7 @@ static const char *roff_getstrn(const st
static enum rofferr roff_line_ignore(ROFF_ARGS);
static enum rofferr roff_nr(ROFF_ARGS);
static int roff_res(struct roff *,
- char **, size_t *, int);
+ char **, size_t *, int, int);
static enum rofferr roff_rm(ROFF_ARGS);
static void roff_setstr(struct roff *,
const char *, const char *, int);
@@ -387,7 +387,7 @@ roff_alloc(struct regset *regs, struct m
* is processed.
*/
static int
-roff_res(struct roff *r, char **bufp, size_t *szp, int pos)
+roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
{
const char *stesc; /* start of an escape sequence ('\\') */
const char *stnam; /* start of the name, after "[(*" */
@@ -454,8 +454,9 @@ roff_res(struct roff *r, char **bufp, si
res = roff_getstrn(r, stnam, (size_t)i);
if (NULL == res) {
- cp -= maxl ? 1 : 0;
- continue;
+ /* TODO: keep track of the correct position. */
+ mandoc_msg(MANDOCERR_BADESCAPE, r->parse, ln, pos, NULL);
+ res = "";
}
/* Replace the escape sequence by the string. */
@@ -491,7 +492,7 @@ roff_parseln(struct roff *r, int ln, cha
* words to fill in.
*/
- if (r->first_string && ! roff_res(r, bufp, szp, pos))
+ if (r->first_string && ! roff_res(r, bufp, szp, ln, pos))
return(ROFF_REPARSE);
ppos = pos;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-05-26 11:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201105261158.p4QBwPs9029826@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).