Commit | Line | Data |
---|---|---|
73ac11f7 | 1 | #ifndef lint |
44c9962f | 2 | static char sccsid[] = "@(#)gnamef.c 5.4 (Berkeley) %G%"; |
73ac11f7 SL |
3 | #endif |
4 | ||
5 | #include "uucp.h" | |
73ac11f7 SL |
6 | #ifdef NDIR |
7 | #include "ndir.h" | |
8 | #else | |
ed412ce0 | 9 | #include <sys/dir.h> |
73ac11f7 SL |
10 | #endif |
11 | ||
44c9962f JB |
12 | /*LINTLIBRARY*/ |
13 | ||
46b15d8a RC |
14 | /* |
15 | * get next file name from directory | |
73ac11f7 SL |
16 | * |
17 | * return codes: | |
18 | * 0 - end of directory read | |
19 | * 1 - returned name | |
20 | */ | |
21 | ||
22 | gnamef(dirp, filename) | |
23 | register DIR *dirp; | |
24 | register char *filename; | |
25 | { | |
26 | register struct direct *dentp; | |
27 | ||
46b15d8a RC |
28 | for (;;) { |
29 | if ((dentp = readdir(dirp)) == NULL) { | |
30 | return 0; | |
31 | } | |
73ac11f7 SL |
32 | if (dentp->d_ino != 0) |
33 | break; | |
34 | } | |
35 | ||
46b15d8a | 36 | /* Truncate filename. This may become a problem someday. */ |
73ac11f7 SL |
37 | strncpy(filename, dentp->d_name, NAMESIZE-1); |
38 | filename[NAMESIZE-1] = '\0'; | |
46b15d8a RC |
39 | DEBUG(99,"gnamef returns %s\n",filename); |
40 | return 1; | |
73ac11f7 | 41 | } |