| 1 | /* classes: h_files */ |
| 2 | |
| 3 | #ifndef SCM_WIN32_DIRENT_H |
| 4 | #define SCM_WIN32_DIRENT_H |
| 5 | |
| 6 | /* Copyright (C) 2001 Free Software Foundation, Inc. |
| 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation; either |
| 11 | * version 2.1 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | /* Directory stream type. |
| 24 | The miscellaneous Unix `readdir' implementations read directory data |
| 25 | into a buffer and return `struct dirent *' pointers into it. */ |
| 26 | |
| 27 | #include <sys/types.h> |
| 28 | |
| 29 | struct dirstream |
| 30 | { |
| 31 | int fd; /* File descriptor. */ |
| 32 | char *data; /* Directory block. */ |
| 33 | size_t allocation; /* Space allocated for the block. */ |
| 34 | size_t size; /* Total valid data in the block. */ |
| 35 | size_t offset; /* Current offset into the block. */ |
| 36 | off_t filepos; /* Position of next entry to read. */ |
| 37 | char *mask; /* Initial file mask. */ |
| 38 | }; |
| 39 | |
| 40 | struct dirent |
| 41 | { |
| 42 | long d_ino; |
| 43 | off_t d_off; |
| 44 | unsigned short int d_reclen; |
| 45 | unsigned char d_type; |
| 46 | char d_name[256]; |
| 47 | }; |
| 48 | |
| 49 | #define d_fileno d_ino /* Backwards compatibility. */ |
| 50 | |
| 51 | /* This is the data type of directory stream objects. |
| 52 | The actual structure is opaque to users. */ |
| 53 | |
| 54 | typedef struct dirstream DIR; |
| 55 | |
| 56 | DIR * opendir (const char * name); |
| 57 | struct dirent * readdir (DIR * dir); |
| 58 | int closedir (DIR * dir); |
| 59 | void rewinddir (DIR * dir); |
| 60 | void seekdir (DIR * dir, off_t offset); |
| 61 | off_t telldir (DIR * dir); |
| 62 | int dirfd (DIR * dir); |
| 63 | |
| 64 | #endif /* SCM_WIN32_DIRENT_H */ |