function a parameter to suppress warnings.
-/* $Id: libmandoc.h,v 1.18 2011/04/09 15:29:40 kristaps Exp $ */
+/* $Id: libmandoc.h,v 1.19 2011/04/17 09:08:19 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
void mandoc_vmsg(enum mandocerr, struct mparse *,
int, int, const char *, ...);
char *mandoc_strdup(const char *);
-char *mandoc_getarg(struct mparse *, char **, int, int *);
+char *mandoc_getarg(struct mparse *,
+ char **, int, int, int *);
char *mandoc_normdate(struct mparse *, char *, int, int);
int mandoc_eos(const char *, size_t, int);
int mandoc_hyph(const char *, const char *);
-/* $Id: libmdoc.h,v 1.72 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: libmdoc.h,v 1.73 2011/04/17 09:08:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
enum margserr {
ARGS_ERROR,
- ARGS_EOLN,
- ARGS_WORD,
- ARGS_PUNCT,
- ARGS_QWORD,
- ARGS_PHRASE,
- ARGS_PPHRASE,
- ARGS_PEND
+ ARGS_EOLN, /* end-of-line */
+ ARGS_WORD, /* normal word */
+ ARGS_PUNCT, /* series of punctuation */
+ ARGS_QWORD, /* quoted word */
+ ARGS_PHRASE, /* Ta'd phrase (-column) */
+ ARGS_PPHRASE, /* tabbed phrase (-column) */
+ ARGS_PEND /* last phrase (-column) */
};
enum margverr {
ARGV_ERROR,
- ARGV_EOLN,
- ARGV_ARG,
- ARGV_WORD
+ ARGV_EOLN, /* end of line */
+ ARGV_ARG, /* valid argument */
+ ARGV_WORD /* normal word (or bad argument---same thing) */
};
/*
-/* $Id: man_macro.c,v 1.60 2011/03/23 15:33:57 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.61 2011/04/17 09:08:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
if ('\0' == *start)
return(0);
- *v = mandoc_getarg(m->parse, v, line, pos);
+ *v = mandoc_getarg(m->parse, v, line, 1, pos);
return(1);
}
-/* $Id: mandoc.c,v 1.46 2011/04/09 15:35:30 kristaps Exp $ */
+/* $Id: mandoc.c,v 1.47 2011/04/17 09:08:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* or to the null byte terminating the argument line.
*/
char *
-mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
+mandoc_getarg(struct mparse *parse,
+ char **cpp, int ln, int dowarn, int *pos)
{
char *start, *cp;
int quoted, pairs, white;
/* Quoting can only start with a new word. */
start = *cpp;
+ quoted = 0;
if ('"' == *start) {
quoted = 1;
start++;
- } else
- quoted = 0;
+ }
pairs = 0;
white = 0;
}
/* Quoted argument without a closing quote. */
- if (1 == quoted)
+ if (dowarn && 1 == quoted)
mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL);
/* Null-terminate this argument and move to the next one. */
*pos += (int)(cp - start) + (quoted ? 1 : 0);
*cpp = cp;
- if ('\0' == *cp && (white || ' ' == cp[-1]))
+ if (dowarn && '\0' == *cp && (white || ' ' == cp[-1]))
mandoc_msg(MANDOCERR_EOLNSPACE, parse, ln, *pos, NULL);
return(start);
-/* $Id: roff.c,v 1.134 2011/04/13 16:26:11 kristaps Exp $ */
+/* $Id: roff.c,v 1.135 2011/04/17 09:08:19 kristaps Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
cp = *bufp + pos;
for (i = 0; i < 9; i++)
arg[i] = '\0' == *cp ? "" :
- mandoc_getarg(r->parse, &cp, ln, &pos);
+ mandoc_getarg(r->parse, &cp, ln, 1, &pos);
/*
* Expand macro arguments.