-/* $Id: argv.c,v 1.19 2009/01/20 13:05:28 kristaps Exp $ */
+/* $Id: argv.c,v 1.21 2009/01/20 13:49:36 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
#include "private.h"
+/*
+ * Parse arguments and parameters of macros. Arguments follow the
+ * syntax of `-arg [val [valN...]]', while parameters are free-form text
+ * following arguments (if any). This file must correctly handle the
+ * strange punctuation rules dictated by groff.
+ */
+
/* FIXME: .It called with -column and quoted arguments. */
-/* FIXME: if arguments are quoted, they should not be later parsed for
- * macros. */
static int lookup(int, const char *);
static int parse(struct mdoc *, int,
if ( ! mdoc_iscdelim(buf[i]))
break;
i++;
- if (0 == buf[i] || ! isspace(buf[i]))
+ if (0 == buf[i] || ! isspace((int)buf[i]))
break;
i++;
- while (buf[i] && isspace(buf[i]))
+ while (buf[i] && isspace((int)buf[i]))
i++;
}
if (0 == buf[i]) {
}
else {
while (buf[*pos]) {
- if (isspace(buf[*pos]))
+ if (isspace((int)buf[*pos]))
if ('\\' != buf[*pos - 1])
break;
(*pos)++;
return(ARGS_WORD);
if ( ! (ARGS_TABSEP & fl))
- while (buf[*pos] && isspace(buf[*pos]))
+ while (buf[*pos] && isspace((int)buf[*pos]))
(*pos)++;
if (buf[*pos])
if (0 == buf[*pos])
return(ARGS_QWORD);
- while (buf[*pos] && isspace(buf[*pos]))
+ while (buf[*pos] && isspace((int)buf[*pos]))
(*pos)++;
if (buf[*pos])
if (0 == buf[*pos])
return(ARGV_EOLN);
- assert( ! isspace(buf[*pos]));
+ assert( ! isspace((int)buf[*pos]));
if ('-' != buf[*pos])
return(ARGV_WORD);
assert(*pos > 0);
while (buf[*pos]) {
- if (isspace(buf[*pos]))
+ if (isspace((int)buf[*pos]))
if ('\\' != buf[*pos - 1])
break;
(*pos)++;
return(ARGV_WORD);
}
- while (buf[*pos] && isspace(buf[*pos]))
+ while (buf[*pos] && isspace((int)buf[*pos]))
(*pos)++;
/* FIXME: whitespace if no value. */