BSD 4_3 development
[unix-history] / usr / contrib / rn / ndir.h
CommitLineData
9c4b96b4
C
1/* $Header: ndir.h,v 4.3 85/05/01 11:43:00 lwall Exp $
2 *
3 * $Log: ndir.h,v $
4 * Revision 4.3 85/05/01 11:43:00 lwall
5 * Baseline for release with 4.3bsd.
6 *
7 */
8
9#ifdef LIBNDIR
10# include <ndir.h>
11#else
12# ifndef USENDIR
13# include <sys/dir.h>
14# else
15
16#ifndef DEV_BSIZE
17#define DEV_BSIZE 512
18#endif
19#define DIRBLKSIZ DEV_BSIZE
20#define MAXNAMLEN 255
21
22struct direct {
23 long d_ino; /* inode number of entry */
24 short d_reclen; /* length of this record */
25 short d_namlen; /* length of string in d_name */
26 char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
27};
28
29/*
30 * The DIRSIZ macro gives the minimum record length which will hold
31 * the directory entry. This requires the amount of space in struct direct
32 * without the d_name field, plus enough space for the name with a terminating
33 * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
34 */
35#undef DIRSIZ
36#define DIRSIZ(dp) \
37 ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
38
39/*
40 * Definitions for library routines operating on directories.
41 */
42typedef struct _dirdesc {
43 int dd_fd;
44 long dd_loc;
45 long dd_size;
46 char dd_buf[DIRBLKSIZ];
47} DIR;
48#ifndef NULL
49#define NULL 0
50#endif
51extern DIR *opendir();
52extern struct direct *readdir();
53extern long telldir();
54extern void seekdir();
55#define rewinddir(dirp) seekdir((dirp), (long)0)
56extern void closedir();
57
58# endif
59#endif