summaryrefslogtreecommitdiffstatshomepage
path: root/man.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 11:16:21 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 11:16:21 +0000
commit7a53781f31374425f91901919904a537c832a699 (patch)
treeaf7de31c08d32a63b7059ddadfcf245ac67c0b5a /man.c
parent48c75ac0d363231aad256b8377a73bc1f8d158d5 (diff)
downloadmandoc-7a53781f31374425f91901919904a537c832a699.tar.gz
mandoc-7a53781f31374425f91901919904a537c832a699.tar.zst
mandoc-7a53781f31374425f91901919904a537c832a699.zip
Fixed inheritence of initial macro into man_macro.
Removed warnxs from man_macro (man_vwarn).
Diffstat (limited to 'man.c')
-rw-r--r--man.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/man.c b/man.c
index 898abd8e..d424570f 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.9 2009/03/26 09:55:39 kristaps Exp $ */
+/* $Id: man.c,v 1.10 2009/03/26 11:16:21 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -275,7 +275,7 @@ man_ptext(struct man *m, int line, char *buf)
int
man_pmacro(struct man *m, int ln, char *buf)
{
- int i, j, c;
+ int i, j, c, ppos;
char mac[5];
/* Comments and empties are quickly ignored. */
@@ -293,16 +293,18 @@ man_pmacro(struct man *m, int ln, char *buf)
return(1);
}
+ ppos = i;
+
if (buf[i] && '\\' == buf[i])
if (buf[i + 1] && '\"' == buf[i + 1])
return(1);
/* Copy the first word into a nil-terminated buffer. */
- for (j = 0; j < 4; j++) {
- if (0 == (mac[j] = buf[j + i]))
+ for (j = 0; j < 4; j++, i++) {
+ if (0 == (mac[j] = buf[i]))
break;
- else if (' ' == buf[j + i])
+ else if (' ' == buf[i])
break;
}
@@ -310,22 +312,24 @@ man_pmacro(struct man *m, int ln, char *buf)
if (j == 4 || j < 1) {
if ( ! (MAN_IGN_MACRO & m->pflags)) {
- (void)man_verr(m, ln, i,
+ (void)man_verr(m, ln, ppos,
"ill-formed macro: %s", mac);
goto err;
}
- if ( ! man_vwarn(m, ln, 0, "ill-formed macro: %s", mac))
+ if ( ! man_vwarn(m, ln, ppos,
+ "ill-formed macro: %s", mac))
goto err;
return(1);
}
if (MAN_MAX == (c = man_hash_find(m->htab, mac))) {
if ( ! (MAN_IGN_MACRO & m->pflags)) {
- (void)man_verr(m, ln, i,
+ (void)man_verr(m, ln, ppos,
"unknown macro: %s", mac);
goto err;
}
- if ( ! man_vwarn(m, ln, i, "unknown macro: %s", mac))
+ if ( ! man_vwarn(m, ln, ppos,
+ "unknown macro: %s", mac))
goto err;
return(1);
}
@@ -337,7 +341,7 @@ man_pmacro(struct man *m, int ln, char *buf)
/* Begin recursive parse sequence. */
- if ( ! man_macro(m, c, ln, 1, &i, buf))
+ if ( ! man_macro(m, c, ln, ppos, &i, buf))
goto err;
return(1);