=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.49.2.4 retrieving revision 1.49.2.7 diff -u -p -r1.49.2.4 -r1.49.2.7 --- mandoc/mandocdb.c 2013/09/17 23:12:21 1.49.2.4 +++ mandoc/mandocdb.c 2013/10/02 21:03:26 1.49.2.7 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.49.2.4 2013/09/17 23:12:21 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.49.2.7 2013/10/02 21:03:26 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012 Ingo Schwarze @@ -34,16 +34,21 @@ #include #include -#if defined(__linux__) +#if defined(__linux__) || defined(__sun) # include # include #elif defined(__APPLE__) # include # include #else +# include # include #endif +#if defined(__sun) +#include +#endif + #include "man.h" #include "mdoc.h" #include "mandoc.h" @@ -1747,7 +1752,7 @@ ofile_argbuild(int argc, char *argv[], struct of **of, * Recursively build up a list of files to parse. * We use this instead of ftw() and so on because I don't want global * variables hanging around. - * This ignores the mandocdb.db and mandocdb.index files, but assumes that + * This ignores the mandoc.db and mandoc.index files, but assumes that * everything else is a manual. * Pass in a pointer to a NULL structure for the first invocation. */ @@ -1756,6 +1761,9 @@ ofile_dirbuild(const char *dir, const char* psec, cons int p_src_form, struct of **of) { char buf[PATH_MAX]; +#if defined(__sun) + struct stat sb; +#endif size_t sz; DIR *d; const char *fn, *sec, *arch; @@ -1778,7 +1786,12 @@ ofile_dirbuild(const char *dir, const char* psec, cons src_form = p_src_form; +#if defined(__sun) + stat(dp->d_name, &sb); + if (S_IFDIR & sb.st_mode) { +#else if (DT_DIR == dp->d_type) { +#endif sec = psec; arch = parch; @@ -1835,7 +1848,11 @@ ofile_dirbuild(const char *dir, const char* psec, cons continue; } +#if defined(__sun) + if (0 == S_IFREG & sb.st_mode) { +#else if (DT_REG != dp->d_type) { +#endif if (warnings) fprintf(stderr, "%s/%s: not a regular file\n",