PR11291804-xcode.diff   [plain text]


--- src/manpath.c.orig	2005-08-20 16:26:06.000000000 -0700
+++ src/manpath.c	2012-10-17 13:05:56.000000000 -0700
@@ -26,6 +26,10 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __APPLE__
+#include <stdbool.h>
+#include <xcselect.h>
+#endif /* __APPLE__ */
 
 /* not always in <string.h> */
 extern char *index(const char *, int);
@@ -372,6 +376,25 @@
      for (dlp = cfdirlist.nxt; dlp; dlp = dlp->nxt)
 	  if (dlp->mandatory)
 	       add_to_mandirlist (dlp->mandir, perrs);
+
+#ifdef __APPLE__
+	xcselect_manpaths *xcp;
+	const char *path;
+	unsigned i, count;
+
+	// TODO: pass something for sdkname
+	xcp = xcselect_get_manpaths(NULL);
+	if (xcp != NULL) {
+		count = xcselect_manpaths_get_num_paths(xcp);
+		for (i = 0; i < count; i++) {
+			path = xcselect_manpaths_get_path(xcp, i);
+			if (path != NULL) {
+				add_to_mandirlist((char *)path, perrs);
+			}
+		}
+		xcselect_manpaths_free(xcp);
+	}
+#endif /* __APPLE__ */
 }
 
 static void