/* $Header: ndir.c,v 4.3.1.3 85/05/23 11:19:24 lwall Exp $
* Revision 4.3.1.3 85/05/23 11:19:24 lwall
* Oops, shouldn't have included sys/types.h again.
* Revision 4.3.1.2 85/05/15 14:46:00 lwall
* Changed short to ino_t, which may be ushort on some systems.
* Revision 4.3.1.1 85/05/10 11:35:34 lwall
* Revision 4.3 85/05/01 11:42:55 lwall
* Baseline for release with 4.3bsd.
* support for Berkeley directory reading routine on a V7 file system
if ((fd
= open(name
, 0)) == -1)
if ((dirp
= (DIR *)malloc(sizeof(DIR))) == NULL
) {
* read an old style directory entry and present it as a new one
#else an Pyramid in the ATT universe
short od_fill1
, od_fill2
;
* get next entry in a directory.
register struct olddirect
*dp
;
static struct direct dir
;
dirp
->dd_size
= read(dirp
->dd_fd
, dirp
->dd_buf
,
if (dirp
->dd_loc
>= dirp
->dd_size
) {
dp
= (struct olddirect
*)(dirp
->dd_buf
+ dirp
->dd_loc
);
dirp
->dd_loc
+= sizeof(struct olddirect
);
strncpy(dir
.d_name
, dp
->od_name
, ODIRSIZ
);
dir
.d_name
[ODIRSIZ
] = '\0'; /* insure null termination */
dir
.d_namlen
= strlen(dir
.d_name
);
dir
.d_reclen
= DIRSIZ(&dir
);