Ticket #52464: PR11291804-xcode.diff

File PR11291804-xcode.diff, 1.6 KB (added by raimue (Rainer Müller), 8 years ago)
  • src/manpath.c

    Upstream: https://opensource.apple.com/source/man/man-16/patches/PR11291804-xcode.diff
    
    The header file "xcselect.h" referenced in the original patch is not available
    in the OS X SDK. The local modification in this patch provide the necessary
    declarations as implied by the context and put them right into this file.
    old new  
    2626#include <unistd.h>
    2727#include <sys/types.h>
    2828#include <sys/stat.h>
     29#ifdef __APPLE__
     30#include <stdbool.h>
     31//#include <xcselect.h>
     32typedef struct xcselect_manpaths xcselect_manpaths;
     33xcselect_manpaths *xcselect_get_manpaths(char *sdkname);
     34unsigned int xcselect_manpaths_get_num_paths(xcselect_manpaths *xcp);
     35const char *xcselect_manpaths_get_path(xcselect_manpaths *xcp, unsigned i);
     36void xcselect_manpaths_free(xcselect_manpaths *xcp);
     37#endif /* __APPLE__ */
    2938
    3039/* not always in <string.h> */
    3140extern char *index(const char *, int);
     
    372381     for (dlp = cfdirlist.nxt; dlp; dlp = dlp->nxt)
    373382          if (dlp->mandatory)
    374383               add_to_mandirlist (dlp->mandir, perrs);
     384
     385#ifdef __APPLE__
     386        xcselect_manpaths *xcp;
     387        const char *path;
     388        unsigned i, count;
     389
     390        // TODO: pass something for sdkname
     391        xcp = xcselect_get_manpaths(NULL);
     392        if (xcp != NULL) {
     393                count = xcselect_manpaths_get_num_paths(xcp);
     394                for (i = 0; i < count; i++) {
     395                        path = xcselect_manpaths_get_path(xcp, i);
     396                        if (path != NULL) {
     397                                add_to_mandirlist((char *)path, perrs);
     398                        }
     399                }
     400                xcselect_manpaths_free(xcp);
     401        }
     402#endif /* __APPLE__ */
    375403}
    376404
    377405static void