1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)opendir.c 1.1 02/11/82"; 4 5 #include <sys/types.h> 6 #include <ndir.h> 7 8 /* 9 * open a directory. 10 */ 11 DIR * 12 opendir(name) 13 char *name; 14 { 15 DIR *dirp; 16 17 dirp = (DIR *)malloc(sizeof(DIR)); 18 dirp->dd_fd = open(name, 0); 19 if (dirp->dd_fd == -1) { 20 free(dirp); 21 return NULL; 22 } 23 dirp->dd_loc = 0; 24 return dirp; 25 } 26