home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
clib
/
h
/
dirent
< prev
next >
Wrap
Text File
|
1994-02-26
|
2KB
|
66 lines
/* dirent.h (c) Copyright 1991 H.Rogers */
#ifndef __DIRENT_H
#define __DIRENT_H
#ifndef __SYS_PARAM_H
#include <sys/param.h>
#endif
#ifndef __SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define MAXNAMLEN MAXPATHLEN /* don't assume ADFS braindamage */
/* This isn't really how ADFS stores files in a directory, but
* since no I/O is permitted on directories anyway this doesn't
* really matter. */
#define d_ino d_fileno /* compatibility */
struct dirent
{
off_t d_off; /* offset of next disk directory entry */
ino_t d_fileno; /* file number of entry */
size_t d_reclen; /* length of this record */
size_t d_namlen; /* length of d_name */
char d_name[MAXNAMLEN]; /* name */
};
#define DIRSIZ(dp) (((sizeof(struct dirent) - \
MAXNAMLEN + ((dp)->d_namlen + 1)) + \
(sizeof(int) - 1)) & ~(sizeof(int) - 1))
typedef struct
{
int dd_fd; /* file descriptor (unused) */
char *dd_name; /* directory name */
size_t dd_loc; /* buffer offset */
size_t dd_size; /* amount of valid data in buffer */
size_t dd_bsize; /* buffer size */
size_t dd_off; /* directory offset */
int dd_off2; /* offset of next read */
char *dd_buf; /* directory data buffer */
} __DIR;
#define DIR __DIR
extern DIR *opendir(char *);
extern struct dirent *readdir(DIR *);
extern long telldir(DIR *);
extern void seekdir(DIR *,long);
#define rewinddir(d) (seekdir((d),(long)0),0)
extern void (rewinddir)(DIR *);
extern int closedir(DIR *);
#ifdef __cplusplus
}
#endif
#endif