2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * test readdir routines.
12 * Need to ensure that opendir succeeds if the directory is empty. To that
13 * end report the NT error for any failure.
15 * 1) Read non-existent directory.
16 * 2) Read empty <drive:>
17 * 3) Try to read a file.
19 #include <afsconfig.h>
20 #include <afs/param.h>
28 main(int ac, char **av)
32 struct dirent *direntp;
37 printf("Usage: treaddir dir [dir ....]\n");
41 for (i=1; i<ac; i++) {
42 dirp = opendir(av[i]);
45 printf("Can't open directory \"%s\", errno=%d, NT error=%d\n",
46 av[i], errno, GetLastError());
48 printf("Can't open directory \"%s\", errno=%d\n", av[i], errno);
55 while (direntp = readdir(dirp)) {
58 if (i > 1) printf("\n");
60 printf("%s\n", direntp->d_name);
64 printf("readdir failed in directory %s with errno=%d, NT error=%d\n",
65 av[i], errno, GetLastError());
68 (void) closedir(dirp);