121350Sdist /* 221350Sdist * Copyright (c) 1983 Regents of the University of California. 321350Sdist * All rights reserved. The Berkeley software License Agreement 421350Sdist * specifies the terms and conditions for redistribution. 521350Sdist */ 621350Sdist 7*26573Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*26573Sdonn static char sccsid[] = "@(#)opendir.c 5.2 (Berkeley) 03/09/86"; 9*26573Sdonn #endif LIBC_SCCS and not lint 105750Smckusick 119142Smckusick #include <sys/param.h> 1213582Ssam #include <sys/dir.h> 135750Smckusick 145750Smckusick /* 155750Smckusick * open a directory. 165750Smckusick */ 175750Smckusick DIR * 185750Smckusick opendir(name) 195750Smckusick char *name; 205750Smckusick { 216097Smckusic register DIR *dirp; 227659Smckusick register int fd; 235750Smckusick 247659Smckusick if ((fd = open(name, 0)) == -1) 255750Smckusick return NULL; 269142Smckusick if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { 277659Smckusick close (fd); 286097Smckusic return NULL; 296097Smckusic } 307659Smckusick dirp->dd_fd = fd; 315750Smckusick dirp->dd_loc = 0; 325750Smckusick return dirp; 335750Smckusick } 34