scroll mode for very long start menus
[reactos.git] / posix / lib / psxdll / dirent / closedir.c
1 /* $Id: closedir.c,v 1.4 2002/10/29 04:45:28 rex Exp $
2 */
3 /*
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS POSIX+ Subsystem
6 * FILE: subsys/psx/lib/psxdll/dirent/closedir.c
7 * PURPOSE: Close a directory stream
8 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
9 * UPDATE HISTORY:
10 * 01/02/2002: Created
11 * 13/02/2002: KJK::Hyperion: modified to use file descriptors
12 */
13
14 #include <dirent.h>
15 #include <unistd.h>
16 #include <errno.h>
17 #include <sys/types.h>
18 #include <psx/dirent.h>
19 #include <psx/safeobj.h>
20
21 int closedir(DIR *dirp)
22 {
23 /* check the "magic" signature */
24 if(!__safeobj_validate(dirp, __IDIR_MAGIC))
25 {
26 errno = EBADF;
27 return (-1);
28 }
29
30 /* this will close the handle, deallocate the internal object and
31 invalidate the descriptor */
32 return (close(((struct __internal_DIR *)dirp)->fildes));
33 }
34
35 /* EOF */
36