xref: /csrg-svn/lib/libc/gen/closedir.c (revision 34790)
121339Sdist /*
221339Sdist  * Copyright (c) 1983 Regents of the University of California.
3*34790Sbostic  * All rights reserved.
4*34790Sbostic  *
5*34790Sbostic  * Redistribution and use in source and binary forms are permitted
6*34790Sbostic  * provided that the above copyright notice and this paragraph are
7*34790Sbostic  * duplicated in all such forms and that any documentation,
8*34790Sbostic  * advertising materials, and other materials related to such
9*34790Sbostic  * distribution and use acknowledge that the software was developed
10*34790Sbostic  * by the University of California, Berkeley.  The name of the
11*34790Sbostic  * University may not be used to endorse or promote products derived
12*34790Sbostic  * from this software without specific prior written permission.
13*34790Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*34790Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*34790Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1621339Sdist  */
1721339Sdist 
1826544Sdonn #if defined(LIBC_SCCS) && !defined(lint)
19*34790Sbostic static char sccsid[] = "@(#)closedir.c	5.3 (Berkeley) 06/18/88";
20*34790Sbostic #endif /* LIBC_SCCS and not lint */
215749Smckusick 
226370Smckusic #include <sys/param.h>
2313582Ssam #include <sys/dir.h>
245749Smckusick 
255749Smckusick /*
265749Smckusick  * close a directory.
275749Smckusick  */
285749Smckusick void
295749Smckusick closedir(dirp)
306098Smckusic 	register DIR *dirp;
315749Smckusick {
325749Smckusick 	close(dirp->dd_fd);
336098Smckusic 	dirp->dd_fd = -1;
346098Smckusic 	dirp->dd_loc = 0;
355749Smckusick 	free(dirp);
365749Smckusick }
37