-/* $Id: mandocdb.c,v 1.211 2016/01/04 14:44:57 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.216 2016/03/17 21:26:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2016 Ingo Schwarze <schwarze@openbsd.org>
#if HAVE_PLEDGE
if (pledge("stdio rpath wpath cpath fattr flock proc exec", NULL) == -1) {
- perror("pledge");
+ warn("pledge");
return (int)MANDOCLEVEL_SYSERR;
}
#endif
#if HAVE_PLEDGE
if (nodb) {
if (pledge("stdio rpath", NULL) == -1) {
- perror("pledge");
+ warn("pledge");
return (int)MANDOCLEVEL_SYSERR;
}
}
#if HAVE_PLEDGE
if (!nodb) {
if (pledge("stdio rpath wpath cpath fattr flock", NULL) == -1) {
- perror("pledge");
+ warn("pledge");
exitcode = (int)MANDOCLEVEL_SYSERR;
goto out;
}
* or
* [./]cat<section>[/<arch>]/<name>.0
*
- * TODO: accomodate for multi-language directories.
+ * TODO: accommodate for multi-language directories.
*/
static int
treescan(void)
man = NULL;
sodest = NULL;
- mparse_open(mp, &fd, mlink->file);
- if (fd == -1) {
+ if ((fd = mparse_open(mp, mlink->file)) == -1) {
say(mlink->file, "&open");
goto nextpage;
}
*/
if (mlink->dform != FORM_CAT || mlink->fform != FORM_CAT) {
mparse_readfd(mp, fd, mlink->file);
+ close(fd);
mparse_result(mp, &man, &sodest);
}
char byte;
size_t sz;
- if (NULL == n)
+ if (n == NULL)
return;
/*
if (n->type == ROFFT_BODY && n->tok == MAN_SH) {
body = n;
- assert(body->parent);
- if (NULL != (head = body->parent->head) &&
- 1 == head->nchild &&
- NULL != (head = (head->child)) &&
+ if ((head = body->parent->head) != NULL &&
+ (head = head->child) != NULL &&
+ head->next == NULL &&
head->type == ROFFT_TEXT &&
- 0 == strcmp(head->string, "NAME") &&
- NULL != body->child) {
+ strcmp(head->string, "NAME") == 0 &&
+ body->child != NULL) {
/*
* Suck the entire NAME section into memory.
if (n->type != ROFFT_ELEM && n->type != ROFFT_BODY)
return 0;
- if (n->nchild == 1 && n->child->type == ROFFT_TEXT)
+ if (n->child != NULL &&
+ n->child->next == NULL &&
+ n->child->type == ROFFT_TEXT)
return 1;
cp = NULL;