MISR Toolkit  1.5.1
dirent_win32.h
Go to the documentation of this file.
1 /*
2  * dirent.h
3  */
4 
5 #ifndef _DIRENT_H
6 # define _DIRENT_H
7 
8 # include <sys/types.h>
9 # include <limits.h>
10 
11 #define MAXNAMLEN 255 /* maximum filename length */
12 
13 #ifndef NAME_MAX
14 #define NAME_MAX (MAXNAMLEN - 1)
15 #endif
16 
17 struct dirent /* data from getdents()/readdir() */
18 {
19  ino_t d_ino; /* inode number of entry */
20  off_t d_off; /* offset of disk directory entry */
21  wchar_t d_reclen; /* length of this record */
22  char d_name[MAXNAMLEN + 1];
23 };
24 
25 
26 /* The following nonportable ugliness could have been avoided by defining
27  * DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
28  * There shouldn't be any problem if you avoid using the DIRENTSIZ() macro.
29  */
30 
31 #define DIRENTBASESIZ (((struct dirent *)0)->d_name \
32  - (char *)&((struct dirent *)0)->d_ino)
33 
34 #define DIRENTSIZ(namlen) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
35  / sizeof(long) * sizeof(long))
36 
37 
38 
39 # ifndef _BOOL_T_DEFINED
40 typedef unsigned char bool;
41 # define _BOOL_T_DEFINED
42 # endif
43 
44 # define DIRBUF 8192 /* buffer size for fs-indep. dirs */
45  /* must in general be larger than the */
46  /* filesystem buffer size */
47 
48 struct _dircontents {
49  char *_d_entry;
51 };
52 
53 typedef struct _dirdesc {
54  int dd_id; /* uniquely identify each open directory */
55  long dd_loc; /* where we are in directory entry is this */
56  struct _dircontents *dd_contents; /* pointer to contents of dir */
57  struct _dircontents *dd_cp; /* pointer to current position */
58 } DIR;
59 
60 
61 #if defined (__STDC__)
62 # define _PROTO(p) p
63 #else
64 # define _PROTO(p) ()
65 # undef const
66 # undef volatile
67 #endif
68 
69 /* Functions */
70 
71 extern DIR * opendir _PROTO ((const char *));
72 extern struct dirent * readdir _PROTO ((DIR *));
73 extern void rewinddir _PROTO ((DIR *));
74 
75 extern int closedir _PROTO ((DIR *));
76 extern void seekdir _PROTO ((DIR *, off_t));
77 extern off_t telldir _PROTO ((DIR *));
78 
79 extern int chdir _PROTO ((const char *));
80 extern char * getcwd _PROTO ((char *, size_t));
81 
82 extern int mkdir _PROTO ((const char *));
83 
84 extern int rmdir _PROTO ((const char *));
85 extern int scandir _PROTO ((char *,
86  struct dirent ***,
87  int (*)(const void *, const void *),
88  int (*)(const void *, const void *)));
89 
90 extern int _chdrive _PROTO ((int));
91 extern int _getdrive _PROTO ((void));
92 extern char * _getdcwd _PROTO ((int, char *, int));
93 
94 extern bool IsHPFSFileSystem _PROTO ((char *));
95 
96 #endif
struct _dircontents * _d_next
Definition: dirent_win32.h:50
int closedir(DIR *dirp)
Definition: dirent.c:225
#define _PROTO(p)
Definition: dirent_win32.h:64
#define MAXNAMLEN
Definition: dirent_win32.h:11
struct _dirdesc DIR
off_t telldir(DIR *dirp)
Definition: dirent.c:297
struct _dircontents * dd_contents
Definition: dirent_win32.h:56
void rewinddir(DIR *dirp)
Definition: dirent.c:263
unsigned char bool
Definition: dirent_win32.h:40
bool IsHPFSFileSystem(char *directory)
Definition: dirent.c:329
void seekdir(DIR *dirp, off_t off)
Definition: dirent.c:274
wchar_t d_reclen
Definition: dirent_win32.h:21
struct dirent * readdir(DIR *dirp)
Definition: dirent.c:242
ino_t d_ino
Definition: dirent_win32.h:19
char * _d_entry
Definition: dirent_win32.h:49
struct _dircontents * dd_cp
Definition: dirent_win32.h:57
char d_name[MAXNAMLEN+1]
Definition: dirent_win32.h:22
off_t d_off
Definition: dirent_win32.h:20
DIR * opendir(char *name) const
Definition: dirent.c:78
long dd_loc
Definition: dirent_win32.h:55

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51