| Line | |
|---|
| 1 | /* closedir() Author: Kees J. Bot
|
|---|
| 2 | * 24 Apr 1989
|
|---|
| 3 | */
|
|---|
| 4 | #define nil 0
|
|---|
| 5 | #include <lib.h>
|
|---|
| 6 | #define close _close
|
|---|
| 7 | #define closedir _closedir
|
|---|
| 8 | #include <sys/types.h>
|
|---|
| 9 | #include <dirent.h>
|
|---|
| 10 | #include <unistd.h>
|
|---|
| 11 | #include <stdlib.h>
|
|---|
| 12 | #include <errno.h>
|
|---|
| 13 |
|
|---|
| 14 | int closedir(DIR *dp)
|
|---|
| 15 | /* Finish reading a directory. */
|
|---|
| 16 | {
|
|---|
| 17 | int d;
|
|---|
| 18 |
|
|---|
| 19 | if (dp == nil) { errno= EBADF; return -1; }
|
|---|
| 20 |
|
|---|
| 21 | d= dp->_fd;
|
|---|
| 22 | free((void *) dp);
|
|---|
| 23 | return close(d);
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.