summaryrefslogtreecommitdiffstats
path: root/argv.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-23 14:22:11 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-23 14:22:11 +0000
commitdc4e5ca1c9fd9bd34e243dcdb884af02102c9389 (patch)
tree78f2d3ac00100e778e6832933da1ace2dab9e080 /argv.c
parentd4dba4479e3ed55fdc52b75eab00afe7ad78d5f0 (diff)
downloadmandoc-dc4e5ca1c9fd9bd34e243dcdb884af02102c9389.tar.gz
First addition of -man macro support.
Abstraction of mdoc.
Diffstat (limited to 'argv.c')
-rw-r--r--argv.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/argv.c b/argv.c
index d203be76..3d8519c7 100644
--- a/argv.c
+++ b/argv.c
@@ -25,7 +25,7 @@
#include <stdio.h>
#include <string.h>
-#include "private.h"
+#include "libmdoc.h"
/*
* Routines to parse arguments of macros. Arguments follow the syntax
@@ -294,7 +294,8 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
return(ARGV_ERROR);
if (NULL == (arg = *v)) {
- *v = xcalloc(1, sizeof(struct mdoc_arg));
+ if (NULL == (*v = calloc(1, sizeof(struct mdoc_arg))))
+ err(1, "calloc");
arg = *v;
}
@@ -792,8 +793,10 @@ argv_opt_single(struct mdoc *mdoc, int line,
return(1);
v->sz = 1;
- v->value = xcalloc(1, sizeof(char *));
- v->value[0] = xstrdup(p);
+ if (NULL == (v->value = calloc(1, sizeof(char *))))
+ err(1, "calloc");
+ if (NULL == (v->value[0] = strdup(p)))
+ err(1, "strdup");
return(1);
}
@@ -817,8 +820,10 @@ argv_single(struct mdoc *mdoc, int line,
return(perr(mdoc, line, ppos, EARGVAL));
v->sz = 1;
- v->value = xcalloc(1, sizeof(char *));
- v->value[0] = xstrdup(p);
+ if (NULL == (v->value = calloc(1, sizeof(char *))))
+ err(1, "calloc");
+ if (NULL == (v->value[0] = strdup(p)))
+ err(1, "strdup");
return(1);
}