|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)opendir.c 4.5 (Berkeley) 7/1/83";
3: #endif
4:
5: #include <sys/param.h>
6: #include <sys/dir.h>
7:
8: /*
9: * open a directory.
10: */
11: DIR *
12: opendir(name)
13: char *name;
14: {
15: register DIR *dirp;
16: register int fd;
17:
18: if ((fd = open(name, 0)) == -1)
19: return NULL;
20: if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
21: close (fd);
22: return NULL;
23: }
24: dirp->dd_fd = fd;
25: dirp->dd_loc = 0;
26: return dirp;
27: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.