#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
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);
}