-/* $Id: mandoc.h,v 1.102 2012/05/31 22:29:13 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.103 2012/07/12 15:11:14 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
MANDOCERR_SO, /* .so is fragile, better use ln(1) */
MANDOCERR_NAMESECFIRST, /* NAME section must come first */
MANDOCERR_BADNAMESEC, /* bad NAME section contents */
- MANDOCERR_NONAME, /* manual name not yet set */
MANDOCERR_SECOOO, /* sections out of conventional order */
MANDOCERR_SECREP, /* duplicate section name */
MANDOCERR_SECMSEC, /* section not in conventional manual section */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
MANDOCERR_BADCHAR, /* skipping bad character */
MANDOCERR_NAMESC, /* escaped character not allowed in a name */
+ MANDOCERR_NONAME, /* manual name not yet set */
MANDOCERR_NOTEXT, /* skipping text before the first section header */
MANDOCERR_MACRO, /* skipping unknown macro */
MANDOCERR_REQUEST, /* NOT IMPLEMENTED: skipping request */
-/* $Id: mdoc_validate.c,v 1.186 2012/07/11 16:57:43 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.187 2012/07/12 15:11:14 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
char buf[BUFSIZ];
int c;
- /* If no child specified, make sure we have the meta name. */
-
- if (NULL == mdoc->last->child && NULL == mdoc->meta.name) {
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NONAME);
- return(1);
- } else if (mdoc->meta.name)
+ if (NULL != mdoc->meta.name)
return(1);
- /* If no meta name, set it from the child. */
+ /* Try to use our children for setting the meta name. */
- buf[0] = '\0';
- if (-1 == (c = concat(buf, mdoc->last->child, BUFSIZ))) {
+ if (NULL != mdoc->last->child) {
+ buf[0] = '\0';
+ c = concat(buf, mdoc->last->child, BUFSIZ);
+ } else
+ c = 0;
+
+ switch (c) {
+ case (-1):
mdoc_nmsg(mdoc, mdoc->last->child, MANDOCERR_MEM);
return(0);
+ case (0):
+ mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NONAME);
+ mdoc->meta.name = mandoc_strdup("UNKNOWN");
+ break;
+ default:
+ mdoc->meta.name = mandoc_strdup(buf);
+ break;
}
-
- assert(c);
- mdoc->meta.name = mandoc_strdup(buf);
return(1);
}
-/* $Id: read.c,v 1.29 2012/05/27 17:48:57 schwarze Exp $ */
+/* $Id: read.c,v 1.30 2012/07/12 15:11:14 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
".so is fragile, better use ln(1)",
"NAME section must come first",
"bad NAME section contents",
- "manual name not yet set",
"sections out of conventional order",
"duplicate section name",
"section not in conventional manual section",
"input stack limit exceeded, infinite loop?",
"skipping bad character",
"escaped character not allowed in a name",
+ "manual name not yet set",
"skipping text before the first section header",
"skipping unknown macro",
"NOT IMPLEMENTED, please use groff: skipping request",