If heirloom shell is in /usr/lib/heirloom/5bin/sh, use it to run tests.
[mmh] / docs / historical / mh-6.8.5 / miscellany / libndir / opendir.c
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 }