summaryrefslogtreecommitdiffstats
path: root/man_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-23 15:33:57 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-23 15:33:57 +0000
commit99b164cf472f394fe3688ecc1b3766ba76fe7278 (patch)
treee444ce7522fea43a6a1d2393e21925b1193fd074 /man_macro.c
parent22671958d103a1eca7f6675bff049e902034637b (diff)
downloadmandoc-99b164cf472f394fe3688ecc1b3766ba76fe7278.tar.gz
Merge man_args() into man_macro.c, the only place where it's called, and
make its return value boolean (we don't care about QWORD). We can move it into mdoc_macro.c because it's basically just a wrapper around mandoc_getarg(). Then blow away man_argv.c, which is left empty.
Diffstat (limited to 'man_macro.c')
-rw-r--r--man_macro.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/man_macro.c b/man_macro.c
index e0549822..aff3fb00 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -38,6 +38,8 @@ static int blk_close(MACRO_PROT_ARGS);
static int blk_exp(MACRO_PROT_ARGS);
static int blk_imp(MACRO_PROT_ARGS);
static int in_line_eoln(MACRO_PROT_ARGS);
+static int man_args(struct man *, int,
+ int *, char *, char **);
static int rew_scope(enum man_type,
struct man *, enum mant);
@@ -317,7 +319,7 @@ blk_exp(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
+ if ( ! man_args(m, line, pos, buf, &p))
break;
if ( ! man_word_alloc(m, line, la, p))
return(0);
@@ -367,7 +369,7 @@ blk_imp(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
+ if ( ! man_args(m, line, pos, buf, &p))
break;
if ( ! man_word_alloc(m, line, la, p))
return(0);
@@ -407,7 +409,7 @@ in_line_eoln(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
+ if ( ! man_args(m, line, pos, buf, &p))
break;
if ( ! man_word_alloc(m, line, la, p))
return(0);
@@ -470,3 +472,18 @@ man_macroend(struct man *m)
return(man_unscope(m, m->first, MANDOCERR_SCOPEEXIT));
}
+static int
+man_args(struct man *m, int line, int *pos, char *buf, char **v)
+{
+ char *start;
+
+ assert(*pos);
+ *v = start = buf + *pos;
+ assert(' ' != *start);
+
+ if ('\0' == *start)
+ return(0);
+
+ *v = mandoc_getarg(m->parse, v, line, pos);
+ return(1);
+}