fsmagic: sort array by value and use bsearch for faster lookup

* defs.h (xlat_search): New prototype.
* util.c (xlat_bsearch_compare, xlat_search): New functions.
* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
* tests/statfs.c: New file.
* tests/statfs.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add statfs.
(statfs_CFLAGS): Define.
(TESTS): Add statfs.test.
* tests/.gitignore: Add statfs.
diff --git a/tests/statfs.c b/tests/statfs.c
new file mode 100644
index 0000000..0c8feab
--- /dev/null
+++ b/tests/statfs.c
@@ -0,0 +1,13 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <sys/statfs.h>
+#include <assert.h>
+
+int
+main(void)
+{
+	struct statfs stb;
+	assert(statfs("/proc/self/status", &stb) == 0);
+	return 0;
+}