mlib update: new isnan()/isnanf() implementation
[tangerine.git] / compiler / clib / closedir.c
blob3dfa43d35986186eabde9a562fedcac1250d5235
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function closedir().
6 */
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <errno.h>
12 /*****************************************************************************
14 NAME */
15 #include <dirent.h>
17 int closedir(
19 /* SYNOPSIS */
20 DIR *dir)
22 /* FUNCTION
23 Closes a directory
25 INPUTS
26 dir - the directory stream pointing to the directory being closed
28 RESULT
29 The closedir() function returns 0 on success or -1 on
30 failure.
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
39 close(), opendir(), readdir(), rewinddir(), seekdir(),
40 telldir(), scandir()
42 INTERNALS
44 ******************************************************************************/
46 if (!dir)
48 errno = EFAULT;
49 return -1;
52 if (close(dir->fd) == -1)
53 return -1;
55 free(dir->priv);
56 free(dir);
58 return 0;