aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit2b4cfb630509f9fb997584294eb9aece8a327d63 (patch)
tree7619648c6721c19fbfe4a6e92e7118a3e8f97d26 /man_macro.c
parent589f74a138ab93e81b858ebb9a8218a19d5a2017 (diff)
downloadmandoc-2b4cfb630509f9fb997584294eb9aece8a327d63.tar.gz
mandoc-2b4cfb630509f9fb997584294eb9aece8a327d63.tar.zst
mandoc-2b4cfb630509f9fb997584294eb9aece8a327d63.zip
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.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/man_macro.c b/man_macro.c
index 744167bc..b3212e68 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.59 2011/03/23 12:40:04 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.60 2011/03/23 15:33:57 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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);
+}