X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/8871caf4707de7e47d9d43d5bd47044e3d2bba92..9d1775c515c3381957c801b3de57c9b282668dac:/test-fts.c diff --git a/test-fts.c b/test-fts.c index 1a1bfc7c..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,29 +21,39 @@ 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"); - return(1); + return 1; } entry = fts_read(ftsp); if (entry == NULL) { perror("fts_read"); - return(1); + return 1; } if (fts_set(ftsp, entry, FTS_SKIP) != 0) { perror("fts_set"); - return(1); + return 1; } if (fts_close(ftsp) != 0) { perror("fts_close"); - return(1); + return 1; } - return(0); + 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); }