Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libast/dir/dirlib.h
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1985-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* David Korn <[email protected]> *
19
* Phong Vo <[email protected]> *
20
* *
21
***********************************************************************/
22
#pragma prototyped
23
/*
24
* AT&T Research
25
*
26
* directory stream access library private definitions
27
* library routines should include this file rather than <dirent.h>
28
*/
29
30
#ifndef _DIRLIB_H
31
#define _DIRLIB_H
32
33
#if defined(__STDPP__directive) && defined(__STDPP__hide)
34
__STDPP__directive pragma pp:hide getdents getdirentries
35
#else
36
#undef getdents
37
#define getdents ______getdents
38
#undef getdirentries
39
#define getdirentries ______getdirentries
40
#endif
41
42
#include <ast.h>
43
#include <errno.h>
44
45
#if _lib_opendir && ( _hdr_dirent || _hdr_ndir || _sys_dir )
46
47
#define _dir_ok 1
48
49
#include <ls.h>
50
51
#ifndef _DIRENT_H
52
#if _hdr_dirent
53
#if _typ_off64_t
54
#undef off_t
55
#endif
56
#include <dirent.h>
57
#if _typ_off64_t
58
#define off_t off64_t
59
#endif
60
#else
61
#if _hdr_ndir
62
#include <ndir.h>
63
#else
64
#include <sys/dir.h>
65
#endif
66
#ifndef dirent
67
#define dirent direct
68
#endif
69
#endif
70
#endif
71
72
#define DIRdirent dirent
73
74
#else
75
76
#define dirent DIRdirent
77
78
#if defined(__STDPP__directive) && defined(__STDPP__hide)
79
__STDPP__directive pragma pp:hide DIR closedir opendir readdir seekdir telldir
80
#else
81
#undef DIR
82
#define DIR ______DIR
83
#undef closedir
84
#define closedir ______closedir
85
#undef opendir
86
#define opendir ______opendir
87
#undef readdir
88
#define readdir ______readdir
89
#undef seekdir
90
#define seekdir ______seekdir
91
#undef telldir
92
#define telldir ______telldir
93
#endif
94
95
#include <ast_param.h>
96
97
#include <ls.h>
98
#include <limits.h>
99
100
#ifndef _DIRENT_H
101
#if _hdr_dirent
102
#if _typ_off64_t
103
#undef off_t
104
#endif
105
#include <dirent.h>
106
#if _typ_off64_t
107
#define off_t off64_t
108
#endif
109
#else
110
#if _hdr_direntry
111
#include <direntry.h>
112
#else
113
#include <sys/dir.h>
114
#endif
115
#endif
116
#endif
117
118
#undef dirent
119
#if defined(__STDPP__directive) && defined(__STDPP__hide)
120
__STDPP__directive pragma pp:nohide DIR closedir opendir readdir seekdir telldir
121
#else
122
#undef DIR
123
#undef closedir
124
#undef opendir
125
#undef readdir
126
#undef seekdir
127
#undef telldir
128
#endif
129
130
#define _DIR_PRIVATE_ \
131
int dd_loc; /* offset in block */ \
132
int dd_size; /* valid data in block */ \
133
char* dd_buf; /* directory block */
134
135
#ifdef _BLD_3d
136
#define DIR DIRDIR
137
#endif
138
#undef _DIRENT_H
139
#include "dirstd.h"
140
#ifndef _DIRENT_H
141
#define _DIRENT_H 1
142
#endif
143
#ifdef _BLD_3d
144
#undef DIR
145
#endif
146
147
#ifndef DIRBLKSIZ
148
#ifdef DIRBLK
149
#define DIRBLKSIZ DIRBLK
150
#else
151
#ifdef DIRBUF
152
#define DIRBLKSIZ DIRBUF
153
#else
154
#define DIRBLKSIZ 8192
155
#endif
156
#endif
157
#endif
158
159
#endif
160
161
#if defined(__STDPP__directive) && defined(__STDPP__hide)
162
__STDPP__directive pragma pp:nohide getdents getdirentries
163
#else
164
#undef getdents
165
#undef getdirentries
166
#endif
167
168
#ifndef errno
169
extern int errno;
170
#endif
171
172
extern ssize_t getdents(int, void*, size_t);
173
174
#endif
175
176