=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_validate.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -r1.39 -r1.40 *** src/usr.bin/mandoc/man_validate.c 2011/01/16 19:27:25 1.39 --- src/usr.bin/mandoc/man_validate.c 2011/01/17 00:15:19 1.40 *************** *** 1,4 **** ! /* $Id: man_validate.c,v 1.39 2011/01/16 19:27:25 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze --- 1,4 ---- ! /* $Id: man_validate.c,v 1.40 2011/01/17 00:15:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze *************** *** 50,56 **** static int check_root(CHKARGS); static int check_sec(CHKARGS); static int check_text(CHKARGS); - static int check_title(CHKARGS); static int post_AT(CHKARGS); static int post_fi(CHKARGS); --- 50,55 ---- *************** *** 67,73 **** static v_check posts_par[] = { check_par, NULL }; static v_check posts_part[] = { check_part, NULL }; static v_check posts_sec[] = { check_sec, NULL }; ! static v_check posts_th[] = { check_ge2, check_le5, check_title, post_TH, NULL }; static v_check posts_uc[] = { post_UC, NULL }; static v_check pres_bline[] = { check_bline, NULL }; --- 66,72 ---- static v_check posts_par[] = { check_par, NULL }; static v_check posts_part[] = { check_part, NULL }; static v_check posts_sec[] = { check_sec, NULL }; ! static v_check posts_th[] = { check_ge2, check_le5, post_TH, NULL }; static v_check posts_uc[] = { post_UC, NULL }; static v_check pres_bline[] = { check_bline, NULL }; *************** *** 197,225 **** static int - check_title(CHKARGS) - { - const char *p; - - assert(n->child); - /* FIXME: is this sufficient? */ - if ('\0' == *n->child->string) { - man_nmsg(m, n, MANDOCERR_SYNTARGCOUNT); - return(0); - } - - for (p = n->child->string; '\0' != *p; p++) - /* Only warn about this once... */ - if (isalpha((u_char)*p) && ! isupper((u_char)*p)) { - man_nmsg(m, n, MANDOCERR_UPPERCASE); - break; - } - - return(1); - } - - - static int check_text(CHKARGS) { char *p; --- 196,201 ---- *************** *** 263,272 **** { \ if (n->nchild ineq (x)) \ return(1); \ ! man_vmsg(m, MANDOCERR_SYNTARGCOUNT, n->line, n->pos, \ "line arguments %s %d (have %d)", \ #ineq, (x), n->nchild); \ ! return(0); \ } INEQ_DEFINE(0, ==, eq0) --- 239,248 ---- { \ if (n->nchild ineq (x)) \ return(1); \ ! man_vmsg(m, MANDOCERR_ARGCOUNT, n->line, n->pos, \ "line arguments %s %d (have %d)", \ #ineq, (x), n->nchild); \ ! return(1); \ } INEQ_DEFINE(0, ==, eq0) *************** *** 393,398 **** --- 369,375 ---- static int post_TH(CHKARGS) { + const char *p; if (m->meta.title) free(m->meta.title); *************** *** 412,425 **** /* ->TITLE<- MSEC DATE SOURCE VOL */ n = n->child; ! assert(n); ! m->meta.title = mandoc_strdup(n->string); /* TITLE ->MSEC<- DATE SOURCE VOL */ ! n = n->next; ! assert(n); ! m->meta.msec = mandoc_strdup(n->string); /* TITLE MSEC ->DATE<- SOURCE VOL */ --- 389,414 ---- /* ->TITLE<- MSEC DATE SOURCE VOL */ n = n->child; ! if (n && n->string) { ! for (p = n->string; '\0' != *p; p++) { ! /* Only warn about this once... */ ! if (isalpha((u_char)*p) && ! isupper((u_char)*p)) { ! man_nmsg(m, n, MANDOCERR_UPPERCASE); ! break; ! } ! } ! m->meta.title = mandoc_strdup(n->string); ! } else ! m->meta.title = mandoc_strdup(""); /* TITLE ->MSEC<- DATE SOURCE VOL */ ! if (n) ! n = n->next; ! if (n && n->string) ! m->meta.msec = mandoc_strdup(n->string); ! else ! m->meta.msec = mandoc_strdup(""); /* TITLE MSEC ->DATE<- SOURCE VOL */ *************** *** 430,436 **** * string, then use the current date. */ ! n = n->next; if (n && n->string && *n->string) { m->meta.date = mandoc_a2time (MTIME_ISO_8601, n->string); --- 419,426 ---- * string, then use the current date. */ ! if (n) ! n = n->next; if (n && n->string && *n->string) { m->meta.date = mandoc_a2time (MTIME_ISO_8601, n->string);