DF-5692 / shim.h
/* * shim.h -- userland build shim for sys/libkern/fnmatch.c (verbatim source). * * The kernel file includes <sys/param.h>, <sys/ctype.h>, <sys/libkern.h>. * Of those, the matcher body only needs: tolower(), index(), the FNM_* * constants, FNM_NOMATCH, and uintptr_t. POSIX <fnmatch.h> defines the * FNM_* flags with the exact same values as sys/sys/libkern.h:177-186: * NOESCAPE 0x01, PATHNAME 0x02, PERIOD 0x04, LEADING_DIR 0x08, * CASEFOLD 0x10, FNM_NOMATCH 1. * So we can compile the kernel source byte-for-byte against userland libc. */ #ifndef FNM_SHIM_H #define FNM_SHIM_H #include <sys/types.h> /* uintptr_t on both Linux and DFly */ #include <stdint.h> #include <ctype.h> #include <string.h> #include <fnmatch.h> /* kernel libkern index() == strchr() */ #define index strchr #endif /* FNM_SHIM_H */ |