aboutsummaryrefslogtreecommitdiffstatshomepage
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
commiteae8f4ff2cd357d92c5e6aa901cf82cc4d344470 (patch)
tree9643abd856c3d831edcab779e5dbf9e0ade9912f /argv.c
parentca91d8f3ace59249bb9ba5e96567d230e6a0afde (diff)
downloadmandoc-eae8f4ff2cd357d92c5e6aa901cf82cc4d344470.tar.gz
mandoc-eae8f4ff2cd357d92c5e6aa901cf82cc4d344470.tar.zst
mandoc-eae8f4ff2cd357d92c5e6aa901cf82cc4d344470.zip
First addition of -man macro support.
Abstraction of mdoc.
Diffstat (limited to 'argv.c')
-rw-r--r--argv.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/argv.c b/argv.c
index ead3cd9a..db5b7ea4 100644
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.55 2009/03/21 21:09:00 kristaps Exp $ */
+/* $Id: argv.c,v 1.56 2009/03/23 14:22:11 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -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);
}