2008-07-09 11:16:00 +00:00
|
|
|
/*
|
2012-07-19 18:11:40 +00:00
|
|
|
* Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
|
2008-07-09 11:16:00 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2004-09-14 23:08:21 +00:00
|
|
|
#ifndef _DIRENT_H
|
|
|
|
#define _DIRENT_H
|
|
|
|
|
2002-07-11 14:59:59 +00:00
|
|
|
|
2002-08-20 11:10:51 +00:00
|
|
|
#include <sys/types.h>
|
2002-08-03 02:03:27 +00:00
|
|
|
|
2002-07-11 14:59:59 +00:00
|
|
|
|
|
|
|
typedef struct dirent {
|
2002-11-29 02:49:58 +00:00
|
|
|
dev_t d_dev; /* device */
|
|
|
|
dev_t d_pdev; /* parent device (only for queries) */
|
|
|
|
ino_t d_ino; /* inode number */
|
|
|
|
ino_t d_pino; /* parent inode (only for queries) */
|
|
|
|
unsigned short d_reclen; /* length of this record, not the name */
|
|
|
|
char d_name[1]; /* name of the entry (null byte terminated) */
|
2002-07-11 14:59:59 +00:00
|
|
|
} dirent_t;
|
|
|
|
|
2008-07-09 11:16:00 +00:00
|
|
|
typedef struct __DIR DIR;
|
2002-07-11 14:59:59 +00:00
|
|
|
|
|
|
|
#ifndef MAXNAMLEN
|
|
|
|
# ifdef NAME_MAX
|
|
|
|
# define MAXNAMLEN NAME_MAX
|
|
|
|
# else
|
|
|
|
# define MAXNAMLEN 256
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2002-10-26 13:07:30 +00:00
|
|
|
#ifdef __cplusplus
|
2002-07-11 14:59:59 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-01-01 18:52:09 +00:00
|
|
|
DIR* fdopendir(int fd);
|
2009-08-29 20:25:24 +00:00
|
|
|
DIR* opendir(const char* dirName);
|
|
|
|
struct dirent* readdir(DIR* dir);
|
|
|
|
int readdir_r(DIR* dir, struct dirent* entry,
|
|
|
|
struct dirent** _result);
|
|
|
|
int closedir(DIR* dir);
|
|
|
|
void rewinddir(DIR* dir);
|
|
|
|
void seekdir(DIR* dir, long int position);
|
|
|
|
long int telldir(DIR* dir);
|
2011-01-06 21:34:06 +00:00
|
|
|
int dirfd(DIR* dir);
|
2010-01-01 18:49:55 +00:00
|
|
|
|
|
|
|
int alphasort(const struct dirent** entry1,
|
|
|
|
const struct dirent** entry2);
|
|
|
|
int scandir(const char* dir, struct dirent*** _entryArray,
|
|
|
|
int (*selectFunc)(const struct dirent*),
|
|
|
|
int (*compareFunc)(const struct dirent** entry1,
|
|
|
|
const struct dirent** entry2));
|
2008-07-17 01:01:52 +00:00
|
|
|
|
2002-10-26 13:07:30 +00:00
|
|
|
#ifdef __cplusplus
|
2002-07-11 14:59:59 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-09-14 23:08:21 +00:00
|
|
|
#endif /* _DIRENT_H */
|