aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_argv.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-17 22:11:42 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-17 22:11:42 +0000
commit95356d6189f5e5d41011a7cb60176f147e1fff7d (patch)
treec923ce026d6b8f420d203f151868c8b858e4501d /mdoc_argv.c
parent114426748445942cb51394e59f2c62ad79bd974c (diff)
downloadmandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.tar.gz
mandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.tar.zst
mandoc-95356d6189f5e5d41011a7cb60176f147e1fff7d.zip
Enable the unified error/warning enumeration in mandoc.h that's
stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
Diffstat (limited to 'mdoc_argv.c')
-rw-r--r--mdoc_argv.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/mdoc_argv.c b/mdoc_argv.c
index 98d95d3c..c7ca2e64 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.48 2010/05/15 08:54:04 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.49 2010/05/17 22:11:42 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include "mandoc.h"
#include "libmdoc.h"
#include "libmandoc.h"
@@ -407,7 +408,7 @@ args(struct mdoc *m, int line, int *pos,
* is unterminated.
*/
if (MDOC_PHRASELIT & m->flags)
- if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_BADQUOTE))
return(ARGS_ERROR);
m->flags &= ~MDOC_PHRASELIT;
@@ -440,7 +441,7 @@ args(struct mdoc *m, int line, int *pos,
return(ARGS_PUNCT);
if (ARGS_NOWARN & fl)
return(ARGS_PUNCT);
- if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
return(ARGS_ERROR);
return(ARGS_PUNCT);
}
@@ -495,7 +496,7 @@ args(struct mdoc *m, int line, int *pos,
/* Whitespace check for eoln case... */
if (0 == *p && ' ' == *(p - 1) && ! (ARGS_NOWARN & fl))
- if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
return(ARGS_ERROR);
*pos += (int)(p - *v);
@@ -540,7 +541,7 @@ args(struct mdoc *m, int line, int *pos,
if ('\0' == buf[*pos]) {
if (ARGS_NOWARN & fl || MDOC_PPHRASE & m->flags)
return(ARGS_QWORD);
- if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_BADQUOTE))
return(ARGS_ERROR);
return(ARGS_QWORD);
}
@@ -555,7 +556,7 @@ args(struct mdoc *m, int line, int *pos,
(*pos)++;
if (0 == buf[*pos] && ! (ARGS_NOWARN & fl))
- if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
return(ARGS_ERROR);
return(ARGS_QWORD);
@@ -579,7 +580,7 @@ args(struct mdoc *m, int line, int *pos,
(*pos)++;
if ('\0' == buf[*pos] && ! (ARGS_NOWARN & fl))
- if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
+ if ( ! mdoc_pmsg(m, line, *pos, MANDOCERR_EOLNSPACE))
return(ARGS_ERROR);
return(ARGS_WORD);
@@ -751,10 +752,11 @@ argv_single(struct mdoc *m, int line,
ppos = *pos;
ac = args(m, line, pos, buf, 0, &p);
- if (ARGS_ERROR == ac)
+ if (ARGS_EOLN == ac) {
+ mdoc_pmsg(m, line, ppos, MANDOCERR_SYNTARGVCOUNT);
+ return(0);
+ } else if (ARGS_ERROR == ac)
return(0);
- if (ARGS_EOLN == ac)
- return(mdoc_perr(m, line, ppos, EARGVAL));
v->sz = 1;
v->value = mandoc_malloc(sizeof(char *));