-/* $Id: mdoc_argv.c,v 1.24 2009/08/20 09:07:24 kristaps Exp $ */
+/* $Id: mdoc_argv.c,v 1.27 2009/10/07 14:52:35 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
ARGV_NONE, /* MDOC_Unfilled */
ARGV_NONE, /* MDOC_Literal */
ARGV_NONE, /* MDOC_File */
- ARGV_SINGLE, /* MDOC_Offset */
+ ARGV_OPT_SINGLE, /* MDOC_Offset */
ARGV_NONE, /* MDOC_Bullet */
ARGV_NONE, /* MDOC_Dash */
ARGV_NONE, /* MDOC_Hyphen */
ARGV_MULTI, /* MDOC_Column */
ARGV_SINGLE, /* MDOC_Width */
ARGV_NONE, /* MDOC_Compact */
- ARGV_OPT_SINGLE, /* MDOC_Std */
+ ARGV_NONE, /* MDOC_Std */
ARGV_NONE, /* MDOC_Filled */
ARGV_NONE, /* MDOC_Words */
ARGV_NONE, /* MDOC_Emphasis */
for (i = 0; i < (int)p->argc; i++) {
if (0 == p->argv[i].sz)
continue;
+ if (NULL == p->argv[i].value)
+ continue;
+
/* LINTED */
for (j = 0; j < (int)p->argv[i].sz; j++)
- free(p->argv[i].value[j]);
+ if (p->argv[i].value[j])
+ free(p->argv[i].value[j]);
free(p->argv[i].value);
}
static int
-argv_a2arg(int tok, const char *argv)
+argv_a2arg(int tok, const char *p)
{
/*
switch (tok) {
case (MDOC_An):
- if (0 == strcmp(argv, "split"))
+ if (0 == strcmp(p, "split"))
return(MDOC_Split);
- else if (0 == strcmp(argv, "nosplit"))
+ else if (0 == strcmp(p, "nosplit"))
return(MDOC_Nosplit);
break;
case (MDOC_Bd):
- if (0 == strcmp(argv, "ragged"))
+ if (0 == strcmp(p, "ragged"))
return(MDOC_Ragged);
- else if (0 == strcmp(argv, "unfilled"))
+ else if (0 == strcmp(p, "unfilled"))
return(MDOC_Unfilled);
- else if (0 == strcmp(argv, "filled"))
+ else if (0 == strcmp(p, "filled"))
return(MDOC_Filled);
- else if (0 == strcmp(argv, "literal"))
+ else if (0 == strcmp(p, "literal"))
return(MDOC_Literal);
- else if (0 == strcmp(argv, "file"))
+ else if (0 == strcmp(p, "file"))
return(MDOC_File);
- else if (0 == strcmp(argv, "offset"))
+ else if (0 == strcmp(p, "offset"))
return(MDOC_Offset);
- else if (0 == strcmp(argv, "compact"))
+ else if (0 == strcmp(p, "compact"))
return(MDOC_Compact);
break;
case (MDOC_Bf):
- if (0 == strcmp(argv, "emphasis"))
+ if (0 == strcmp(p, "emphasis"))
return(MDOC_Emphasis);
- else if (0 == strcmp(argv, "literal"))
+ else if (0 == strcmp(p, "literal"))
return(MDOC_Literal);
- else if (0 == strcmp(argv, "symbolic"))
+ else if (0 == strcmp(p, "symbolic"))
return(MDOC_Symbolic);
break;
case (MDOC_Bk):
- if (0 == strcmp(argv, "words"))
+ if (0 == strcmp(p, "words"))
return(MDOC_Words);
break;
case (MDOC_Bl):
- if (0 == strcmp(argv, "bullet"))
+ if (0 == strcmp(p, "bullet"))
return(MDOC_Bullet);
- else if (0 == strcmp(argv, "dash"))
+ else if (0 == strcmp(p, "dash"))
return(MDOC_Dash);
- else if (0 == strcmp(argv, "hyphen"))
+ else if (0 == strcmp(p, "hyphen"))
return(MDOC_Hyphen);
- else if (0 == strcmp(argv, "item"))
+ else if (0 == strcmp(p, "item"))
return(MDOC_Item);
- else if (0 == strcmp(argv, "enum"))
+ else if (0 == strcmp(p, "enum"))
return(MDOC_Enum);
- else if (0 == strcmp(argv, "tag"))
+ else if (0 == strcmp(p, "tag"))
return(MDOC_Tag);
- else if (0 == strcmp(argv, "diag"))
+ else if (0 == strcmp(p, "diag"))
return(MDOC_Diag);
- else if (0 == strcmp(argv, "hang"))
+ else if (0 == strcmp(p, "hang"))
return(MDOC_Hang);
- else if (0 == strcmp(argv, "ohang"))
+ else if (0 == strcmp(p, "ohang"))
return(MDOC_Ohang);
- else if (0 == strcmp(argv, "inset"))
+ else if (0 == strcmp(p, "inset"))
return(MDOC_Inset);
- else if (0 == strcmp(argv, "column"))
+ else if (0 == strcmp(p, "column"))
return(MDOC_Column);
- else if (0 == strcmp(argv, "width"))
+ else if (0 == strcmp(p, "width"))
return(MDOC_Width);
- else if (0 == strcmp(argv, "offset"))
+ else if (0 == strcmp(p, "offset"))
return(MDOC_Offset);
- else if (0 == strcmp(argv, "compact"))
+ else if (0 == strcmp(p, "compact"))
return(MDOC_Compact);
- else if (0 == strcmp(argv, "nested"))
+ else if (0 == strcmp(p, "nested"))
return(MDOC_Nested);
break;
case (MDOC_Rv):
/* FALLTHROUGH */
case (MDOC_Ex):
- if (0 == strcmp(argv, "std"))
+ if (0 == strcmp(p, "std"))
return(MDOC_Std);
break;
default: