=================================================================== RCS file: /cvs/mandoc/man_validate.c,v retrieving revision 1.85 retrieving revision 1.90 diff -u -p -r1.85 -r1.90 --- mandoc/man_validate.c 2012/11/17 00:26:33 1.85 +++ mandoc/man_validate.c 2014/03/30 19:47:48 1.90 @@ -1,7 +1,7 @@ -/* $Id: man_validate.c,v 1.85 2012/11/17 00:26:33 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.90 2014/03/30 19:47:48 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012 Ingo Schwarze + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -32,6 +32,7 @@ #include "man.h" #include "mandoc.h" +#include "mandoc_aux.h" #include "libman.h" #include "libmandoc.h" @@ -49,6 +50,7 @@ static int check_eq2(CHKARGS); static int check_le1(CHKARGS); static int check_ge2(CHKARGS); static int check_le5(CHKARGS); +static int check_head1(CHKARGS); static int check_par(CHKARGS); static int check_part(CHKARGS); static int check_root(CHKARGS); @@ -80,6 +82,7 @@ static v_check posts_sec[] = { post_sec, NULL }; static v_check posts_sp[] = { post_vs, check_le1, NULL }; static v_check posts_th[] = { check_ge2, check_le5, post_TH, NULL }; static v_check posts_uc[] = { post_UC, NULL }; +static v_check posts_ur[] = { check_head1, check_part, NULL }; static v_check pres_sec[] = { pre_sec, NULL }; static const struct man_valid man_valids[MAN_MAX] = { @@ -119,6 +122,9 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_eq2 }, /* OP */ { NULL, posts_nf }, /* EX */ { NULL, posts_fi }, /* EE */ + { NULL, posts_ur }, /* UR */ + { NULL, NULL }, /* UE */ + { NULL, NULL }, /* ll */ }; @@ -207,8 +213,8 @@ check_root(CHKARGS) man->meta.title = mandoc_strdup("unknown"); man->meta.msec = mandoc_strdup("1"); - man->meta.date = mandoc_normdate - (man->parse, NULL, n->line, n->pos); + man->meta.date = man->quick ? mandoc_strdup("") : + mandoc_normdate(man->parse, NULL, n->line, n->pos); } return(1); @@ -246,6 +252,17 @@ INEQ_DEFINE(2, >=, ge2) INEQ_DEFINE(5, <=, le5) static int +check_head1(CHKARGS) +{ + + if (MAN_HEAD == n->type && 1 != n->nchild) + mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, + n->pos, "line arguments eq 1 (have %d)", n->nchild); + + return(1); +} + +static int post_ft(CHKARGS) { char *cp; @@ -380,7 +397,6 @@ static int post_TH(CHKARGS) { const char *p; - int line, pos; free(man->meta.title); free(man->meta.vol); @@ -388,8 +404,6 @@ post_TH(CHKARGS) free(man->meta.msec); free(man->meta.date); - line = n->line; - pos = n->pos; man->meta.title = man->meta.vol = man->meta.date = man->meta.msec = man->meta.source = NULL; @@ -423,9 +437,10 @@ post_TH(CHKARGS) if (n) n = n->next; if (n && n->string && '\0' != n->string[0]) { - pos = n->pos; - man->meta.date = mandoc_normdate - (man->parse, n->string, line, pos); + man->meta.date = man->quick ? + mandoc_strdup(n->string) : + mandoc_normdate(man->parse, n->string, + n->line, n->pos); } else man->meta.date = mandoc_strdup("");