From a8e6cfbec82230ce0b2a1676c7f818756dcd3c24 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 1 Oct 2013 00:52:58 +0000 Subject: Fix build on Solaris. Initial version for SmartOS by ONODERA Ryo . Generalized for Solaris by Jonathan Perkin . Received via Thomas Klausner . Style cleanup by myself. --- mandocdb.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mandocdb.c b/mandocdb.c index d0f289ae..e6c8900f 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.49.2.5 2013/09/18 00:54:20 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.49.2.6 2013/10/01 00:52:58 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012 Ingo Schwarze @@ -34,7 +34,7 @@ #include #include -#if defined(__linux__) +#if defined(__linux__) || defined(__sun) # include # include #elif defined(__APPLE__) @@ -44,6 +44,10 @@ # include #endif +#if defined(__sun) +#include +#endif + #include "man.h" #include "mdoc.h" #include "mandoc.h" @@ -1756,6 +1760,9 @@ ofile_dirbuild(const char *dir, const char* psec, const char *parch, 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 +1785,12 @@ ofile_dirbuild(const char *dir, const char* psec, const char *parch, 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 +1847,11 @@ ofile_dirbuild(const char *dir, const char* psec, const char *parch, 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", -- cgit v1.2.3-56-ge451