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