diff options
author | 2014-09-12 00:53:21 +0000 | |
---|---|---|
committer | 2014-09-12 00:53:21 +0000 | |
commit | 7e92c0628d1367cdcfc9a865b096e1987462a551 (patch) | |
tree | 9a02352f11628332e6af6c985a08ca0050178a2e /usr.bin/mandoc/mdoc_validate.c | |
parent | fix the only .Xr ordering and punctuation issue i could find (diff) | |
download | wireguard-openbsd-7e92c0628d1367cdcfc9a865b096e1987462a551.tar.xz wireguard-openbsd-7e92c0628d1367cdcfc9a865b096e1987462a551.zip |
warn about commas in function arguments; inspired by mdoclint(1)
Diffstat (limited to 'usr.bin/mandoc/mdoc_validate.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 2c5c7e1f149..2cc58af547e 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.165 2014/09/11 23:52:47 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.166 2014/09/12 00:53:21 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -99,6 +99,7 @@ static int post_en(POST_ARGS); static int post_es(POST_ARGS); static int post_eoln(POST_ARGS); static int post_ex(POST_ARGS); +static int post_fa(POST_ARGS); static int post_fo(POST_ARGS); static int post_hyph(POST_ARGS); static int post_hyphtext(POST_ARGS); @@ -156,10 +157,10 @@ static const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Er */ { NULL, NULL }, /* Ev */ { pre_std, post_ex }, /* Ex */ - { NULL, NULL }, /* Fa */ + { NULL, post_fa }, /* Fa */ { NULL, ewarn_ge1 }, /* Fd */ { NULL, NULL }, /* Fl */ - { NULL, NULL }, /* Fn */ + { NULL, post_fa }, /* Fn */ { NULL, NULL }, /* Ft */ { NULL, NULL }, /* Ic */ { NULL, ewarn_eq1 }, /* In */ @@ -1007,6 +1008,28 @@ post_fo(POST_ARGS) } static int +post_fa(POST_ARGS) +{ + const struct mdoc_node *n; + const char *cp; + + for (n = mdoc->last->child; n != NULL; n = n->next) { + for (cp = n->string; *cp != '\0'; cp++) { + /* Ignore callbacks and alterations. */ + if (*cp == '(' || *cp == '{') + break; + if (*cp != ',') + continue; + mandoc_msg(MANDOCERR_FA_COMMA, mdoc->parse, + n->line, n->pos + (cp - n->string), + n->string); + break; + } + } + return(1); +} + +static int post_vt(POST_ARGS) { const struct mdoc_node *n; |