purge remaining gpl code from clib, and make clib build again
[tangerine.git] / compiler / clib / dirfd.c
blob2a93784df49e1414031fa6628d6c39c6041ee9ad
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function dirfd().
6 */
8 #define DEBUG 0
9 #include <aros/debug.h>
11 /*****************************************************************************
13 NAME */
14 #include <dirent.h>
16 int dirfd(
18 /* SYNOPSIS */
19 DIR *dir)
21 /* FUNCTION
22 get directory stream file descriptor
24 INPUTS
25 dir - directory stream dir.
27 RESULT
28 on error -1 is returned.
30 NOTES
31 This descriptor is the one used internally by the directory stream. As
32 a result, it is only useful for functions which do not depend on or
33 alter the file position, such as fstat(2) and fchdir(2). It will be
34 automatically closed when closedir(3) is called.
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 open(), readdir(), closedir(), rewinddir(), seekdir(),
42 telldir(), scandir()
44 INTERNALS
46 ******************************************************************************/
48 D(bug("dirfd(d_type=%d)=%d\n", dir->ent.d_type, dir->fd));
49 if (dir->ent.d_type == DT_DIR)
50 return dir->fd;
51 return -1;