aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-fts.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-10-18 16:06:44 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-10-18 16:06:44 +0000
commite44ba034e73fa73b2e888b52b83419c54fec27f9 (patch)
tree6cab219214157ea95de7b9076373c5274db1ea82 /test-fts.c
parentb2605db9a7a1fdd7d3289acf2afd01ccb7e8668a (diff)
downloadmandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.tar.gz
mandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.tar.zst
mandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.zip
Compat glue for the FreeBSD comparison function prototype for fts_open(3)
which differs from what most other systems use. While here, improve diagnostic output of ./configure tests.
Diffstat (limited to 'test-fts.c')
-rw-r--r--test-fts.c19
1 files changed, 18 insertions, 1 deletions
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 <sys/stat.h>
#include <fts.h>
#include <stdio.h>
+#include <string.h>
+
+#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);
+}