aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-10-01 00:52:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-10-01 00:52:58 +0000
commita8e6cfbec82230ce0b2a1676c7f818756dcd3c24 (patch)
tree53b0e2c4476fe2bfae9d335744cb7fe04d5e857e
parentcde8f6b7ca9fda1ff1dd42ae380fd54abc81d8eb (diff)
downloadmandoc-a8e6cfbec82230ce0b2a1676c7f818756dcd3c24.tar.gz
mandoc-a8e6cfbec82230ce0b2a1676c7f818756dcd3c24.tar.zst
mandoc-a8e6cfbec82230ce0b2a1676c7f818756dcd3c24.zip
Fix build on Solaris.
Initial version for SmartOS by ONODERA Ryo <ryoon at netbsd dot org>. Generalized for Solaris by Jonathan Perkin <jperkin at netbsd dot org>. Received via Thomas Klausner <wiz at netbsd dot org>. Style cleanup by myself.
-rw-r--r--mandocdb.c20
1 files 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 <kristaps@bsd.lv>
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -34,7 +34,7 @@
#include <string.h>
#include <unistd.h>
-#if defined(__linux__)
+#if defined(__linux__) || defined(__sun)
# include <endian.h>
# include <db_185.h>
#elif defined(__APPLE__)
@@ -44,6 +44,10 @@
# include <db.h>
#endif
+#if defined(__sun)
+#include <sys/stat.h>
+#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",