1*13582Ssam #ifndef lint 2*13582Ssam static char sccsid[] = "@(#)opendir.c 4.5 (Berkeley) 07/01/83"; 3*13582Ssam #endif 45750Smckusick 59142Smckusick #include <sys/param.h> 6*13582Ssam #include <sys/dir.h> 75750Smckusick 85750Smckusick /* 95750Smckusick * open a directory. 105750Smckusick */ 115750Smckusick DIR * 125750Smckusick opendir(name) 135750Smckusick char *name; 145750Smckusick { 156097Smckusic register DIR *dirp; 167659Smckusick register int fd; 175750Smckusick 187659Smckusick if ((fd = open(name, 0)) == -1) 195750Smckusick return NULL; 209142Smckusick if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { 217659Smckusick close (fd); 226097Smckusic return NULL; 236097Smckusic } 247659Smckusick dirp->dd_fd = fd; 255750Smckusick dirp->dd_loc = 0; 265750Smckusick return dirp; 275750Smckusick } 28