=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.40 retrieving revision 1.42 diff -u -p -r1.40 -r1.42 --- mandoc/mandocdb.c 2011/12/25 16:53:51 1.40 +++ mandoc/mandocdb.c 2011/12/28 00:32:13 1.42 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.40 2011/12/25 16:53:51 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.42 2011/12/28 00:32:13 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -615,8 +615,8 @@ index_merge(const struct of *of, struct mparse *mp, /* * By default, skip a file if the manual section - * and architecture given in the file disagree - * with the directory where the file is located. + * given in the file disagrees with the directory + * where the file is located. */ skip = 0; @@ -631,6 +631,21 @@ index_merge(const struct of *of, struct mparse *mp, skip = 1; } + /* + * Manual page directories exist for each kernel + * architecture as returned by machine(1). + * However, many manuals only depend on the + * application architecture as returned by arch(1). + * For example, some (2/ARM) manuals are shared + * across the "armish" and "zaurus" kernel + * architectures. + * A few manuals are even shared across completely + * different architectures, for example fdformat(1) + * on amd64, i386, sparc, and sparc64. + * Thus, warn about architecture mismatches, + * but don't skip manuals for this reason. + */ + assert(of->arch); assert(march); if (strcasecmp(march, of->arch)) { @@ -639,7 +654,7 @@ index_merge(const struct of *of, struct mparse *mp, "architecture \"%s\" manual " "in \"%s\" directory\n", fn, march, of->arch); - skip = 1; + march = of->arch; } /* @@ -1452,7 +1467,8 @@ static void ofile_argbuild(int argc, char *argv[], struct of **of) { char buf[MAXPATHLEN]; - char *sec, *arch, *title, *p; + const char *sec, *arch, *title; + char *p; int i, src_form; struct of *nof; @@ -1756,6 +1772,7 @@ ofile_dirbuild(const char *dir, const char* psec, cons if (verb > 1) printf("%s: scheduling\n", buf); + if (NULL == *of) { *of = nof; (*of)->first = nof; @@ -1774,7 +1791,10 @@ ofile_free(struct of *of) { struct of *nof; - while (of) { + if (NULL != of) + of = of->first; + + while (NULL != of) { nof = of->next; free(of->fname); free(of->sec);