summaryrefslogtreecommitdiff
path: root/textproc/mdocml/patches/patch-mandocdb.c
blob: 4254ccf0a7c81d24b9dd979c5428cb6659fa10c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$NetBSD: patch-mandocdb.c,v 1.1 2012/12/24 12:53:17 ryoon Exp $

--- mandocdb.c.orig	2011-10-08 20:07:22.000000000 +0000
+++ mandocdb.c
@@ -29,12 +29,16 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__SmartOS__)
 # include <db_185.h>
 #else
 # include <db.h>
 #endif
 
+#if defined(__sun)
+# include <sys/stat.h>
+#endif
+
 #include "man.h"
 #include "mdoc.h"
 #include "mandoc.h"
@@ -1223,7 +1227,15 @@ ofile_dirbuild(const char *dir, int verb
 
 	while (NULL != (dp = readdir(d))) {
 		fn = dp->d_name;
+#if defined(__sun)
+		struct stat s;
+		stat(dp->d_name, &s);
+#endif
+#if !defined(__sun)
 		if (DT_DIR == dp->d_type) {
+#else
+		if (!(s.st_mode & S_IFDIR)) {
+#endif
 			if (0 == strcmp(".", fn))
 				continue;
 			if (0 == strcmp("..", fn))
@@ -1244,7 +1256,11 @@ ofile_dirbuild(const char *dir, int verb
 			fprintf(stderr, "%s: Path too long\n", dir);
 			return(0);
 		}
+#if !defined(__sun)
 		if (DT_REG != dp->d_type)
+#else
+		if (!(s.st_mode & S_IFREG))
+#endif
 			continue;
 
 		if (0 == strcmp(MANDOC_DB, fn) ||