1 /* This file is part of the KDE project
2 Copyright (C) 2000 Werner Almesberger
4 libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this program; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef KDEWIN_SYS_DIRENT_H
23 #define KDEWIN_SYS_DIRENT_H
26 #include <sys/types.h>
32 //#include <sys/lock.h>
34 # define F_OK 0 //does the file exist?
40 #define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */
41 #define HAVE_DD_LOCK /* have locking mechanism */
43 #define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */
45 #define __dirfd(dir) (dir)->dd_fd
47 /* struct dirent - same as Unix */
49 long d_ino; /* inode (always 1 in WIN32) */
50 off_t d_off; /* offset to this dirent */
51 unsigned short d_reclen; /* length of d_name */
52 char d_name[_MAX_FNAME+1]; /* filename (null terminated) */
55 /* typedef DIR - not the same as Unix */
57 long handle; /* _findfirst/_findnext handle */
58 short offset; /* offset into directory */
59 short finished; /* 1 if there are not more files */
60 struct _finddata_t fileinfo; /* from _findfirst/_findnext */
61 char *dir; /* the dir we are reading */
62 struct dirent dent; /* the dirent to return */
65 /* --- redundant --- */
67 //DIR *opendir(const char *);
68 //struct dirent *readdir(DIR *);
69 //void rewinddir(DIR *);
70 //int closedir(DIR *);
72 /* internal prototype */
73 void _seekdir(DIR *dir,off_t offset);
75 //#ifndef _POSIX_SOURCE
76 //long telldir (DIR *);
77 //void seekdir (DIR *, off_t loc);
79 #define KDEWIN32_EXPORT
81 KDEWIN32_EXPORT int scandir (const char *__dir,
82 struct dirent ***__namelist,
83 int (*select) (const struct dirent *),
84 int (*compar) (const struct dirent **, const struct dirent **));
86 KDEWIN32_EXPORT DIR * opendir(const char *);
87 KDEWIN32_EXPORT int closedir(DIR *);
88 KDEWIN32_EXPORT struct dirent* readdir(DIR *);
89 KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
91 int alphasort (const struct dirent **__a, const struct dirent **__b);
97 #endif // KDEWIN_SYS_DIRENT_H