X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/b6d8272551435098c716c546a5201206517e5da9..f3f0161d5d0a0053fa4efd98d8fbb08242d7778b:/test-fts.c diff --git a/test-fts.c b/test-fts.c index dbee5292..23e44152 100644 --- a/test-fts.c +++ b/test-fts.c @@ -2,6 +2,13 @@ #include #include #include +#include + +#ifdef FTS_COMPARE_CONST +int fts_compare(const FTSENT *const *, const FTSENT *const *); +#else +int fts_compare(const FTSENT **, const FTSENT **); +#endif int main(void) @@ -14,7 +21,7 @@ main(void) argv[1] = (char *)NULL; ftsp = fts_open((char * const *)argv, - FTS_PHYSICAL | FTS_NOCHDIR, NULL); + FTS_PHYSICAL | FTS_NOCHDIR, fts_compare); if (ftsp == NULL) { perror("fts_open"); @@ -40,3 +47,13 @@ main(void) return 0; } + +int +#ifdef FTS_COMPARE_CONST +fts_compare(const FTSENT *const *a, const FTSENT *const *b) +#else +fts_compare(const FTSENT **a, const FTSENT **b) +#endif +{ + return strcmp((*a)->fts_name, (*b)->fts_name); +}