=================================================================== RCS file: /cvs/mandoc/dbm.c,v retrieving revision 1.2 retrieving revision 1.4 diff -u -p -r1.2 -r1.4 --- mandoc/dbm.c 2016/07/20 00:23:14 1.2 +++ mandoc/dbm.c 2016/08/30 22:01:07 1.4 @@ -1,4 +1,4 @@ -/* $Id: dbm.c,v 1.2 2016/07/20 00:23:14 schwarze Exp $ */ +/* $Id: dbm.c,v 1.4 2016/08/30 22:01:07 schwarze Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze * @@ -20,7 +20,13 @@ #include "config.h" #include +#if HAVE_ENDIAN #include +#elif HAVE_SYS_ENDIAN +#include +#elif HAVE_NTOHL +#include +#endif #if HAVE_ERR #include #endif @@ -144,10 +150,18 @@ dbm_page_get(int32_t ip) assert(ip >= 0); assert(ip < npages); res.name = dbm_get(pages[ip].name); + if (res.name == NULL) + res.name = "(NULL)"; res.sect = dbm_get(pages[ip].sect); + if (res.sect == NULL) + res.sect = "(NULL)"; res.arch = pages[ip].arch ? dbm_get(pages[ip].arch) : NULL; res.desc = dbm_get(pages[ip].desc); + if (res.desc == NULL) + res.desc = "(NULL)"; res.file = dbm_get(pages[ip].file); + if (res.file == NULL) + res.file = " (NULL)"; res.addr = dbm_addr(pages + ip); return &res; } @@ -244,7 +258,13 @@ page_bytitle(enum iter arg_iter, const struct dbm_matc default: abort(); } - ip = 0; + if (cp == NULL) { + iteration = ITER_NONE; + match = NULL; + cp = NULL; + ip = npages; + } else + ip = 0; return res; }