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>
27 main(int ac
, char **av
)
31 struct dirent
*direntp
;
36 printf("Usage: treaddir dir [dir ....]\n");
40 for (i
= 1; i
< ac
; i
++) {
41 dirp
= opendir(av
[i
]);
44 printf("Can't open directory \"%s\", errno=%d, NT error=%d\n",
45 av
[i
], errno
, GetLastError());
47 printf("Can't open directory \"%s\", errno=%d\n", av
[i
], errno
);
54 while (direntp
= readdir(dirp
)) {
60 printf("%s\n", direntp
->d_name
);
65 ("readdir failed in directory %s with errno=%d, NT error=%d\n",
66 av
[i
], errno
, GetLastError());