userdiff: add a builtin pattern for dts files
[gitweb.git] / t / helper / test-dir-iterator.c
index b421d2bf3864e9a5c35a1ef9f47cb4e452dd40d5..659b6bfa81df6d0bcffb8d0a975492d54d79d6bc 100644 (file)
@@ -4,6 +4,15 @@
 #include "iterator.h"
 #include "dir-iterator.h"
 
+static const char *error_name(int error_number)
+{
+       switch (error_number) {
+       case ENOENT: return "ENOENT";
+       case ENOTDIR: return "ENOTDIR";
+       default: return "ESOMETHINGELSE";
+       }
+}
+
 /*
  * usage:
  * tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
@@ -29,7 +38,7 @@ int cmd__dir_iterator(int argc, const char **argv)
        diter = dir_iterator_begin(*argv, flags);
 
        if (!diter) {
-               printf("dir_iterator_begin failure: %d\n", errno);
+               printf("dir_iterator_begin failure: %s\n", error_name(errno));
                exit(EXIT_FAILURE);
        }