File: pathname.h

package info (click to toggle)
fdclone 2.06c-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 3,032 kB
  • ctags: 5,579
  • sloc: ansic: 70,774; makefile: 607; sh: 595; sed: 190
file content (293 lines) | stat: -rw-r--r-- 6,889 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
 *	pathname.h
 *
 *	Function Prototype Declaration for "pathname.c"
 */

#ifndef	__PATHNAME_H_
#define	__PATHNAME_H_

#ifndef	__SYS_TYPES_STAT_H_
#define	__SYS_TYPES_STAT_H_
#include <sys/types.h>
#include <sys/stat.h>
#endif

/* #define BASHSTYLE		; rather near to bash style */
/* #define MINIMUMSHELL		; omit verbose extension from Bourne shell */
/* #define NESTINGQUOTE		; allow `...` included in "..." */

#ifndef	MINIMUMSHELL
#define	NESTINGQUOTE
#endif

#define	IFS_SET		" \t\n"
#define	META		'\\'
#if	MSDOS && defined (_NOORIGSHELL)
#define	PATHDELIM	';'
#else
#define	PATHDELIM	':'
#endif

#ifndef	BSPATHDELIM
#define	PMETA		META
#define	RMSUFFIX	'%'
# ifdef	BASHSTYLE
	/* bash treats '\r' as just a character */
# define	METACHAR	"\t\n !\"#$&'()*;<=>?[\\]`|"
# else
# define	METACHAR	"\t\r\n !\"#$&'()*;<=>?[\\]`|"
# endif
#define	DQ_METACHAR	"\"$\\`"
#else	/* BSPATHDELIM */
# ifdef	_NOORIGSHELL
# define	FAKEMETA
# define	PMETA		'$'
# define	RMSUFFIX	'%'
# define	METACHAR	"\t\r\n !\"$'*<>?|"
# define	DQ_METACHAR	"\"$"
# else
# define	PMETA		'%'
# define	RMSUFFIX	'\\'
# define	METACHAR	"\t\r\n !\"#$%&'()*;<=>?[]`|"
# define	DQ_METACHAR	"\"$%`"
# endif
#endif	/* BSPATHDELIM */

#define	PC_NORMAL	0
#define	PC_OPQUOTE	1
#define	PC_CLQUOTE	2
#define	PC_SQUOTE	3
#define	PC_DQUOTE	4
#define	PC_BQUOTE	5
#define	PC_WORD		6
#define	PC_META		7

#if	defined (_NOORIGGLOB) \
&& !defined (USEREGCMP) && !defined (USEREGCOMP) && !defined (USERE_COMP)
#undef	_NOORIGGLOB
#endif

#ifdef	_NOORIGGLOB
# ifdef	USEREGCOMP
# include <regex.h>
typedef regex_t	reg_t;
# else
typedef char	reg_t;
# endif
#else	/* !_NOORIGGLOB */
typedef char *	reg_t;
# ifdef	USEREGCMP
# undef	USEREGCMP
# endif
# ifdef	USEREGCOMP
# undef	USEREGCOMP
# endif
# ifdef	USERE_COMP
# undef	USERE_COMP
# endif
#endif	/* !_NOORIGGLOB */

#ifdef	_NOUSEHASH
typedef char	hashlist;
#else
typedef struct _hashlist {
	char *command;
	char *path;
	int hits;
	int cost;
	struct _hashlist *next;
	u_char type;
} hashlist;
#define	MAXHASH		64
#endif

#define	CM_NOTFOUND	0001
#define	CM_FULLPATH	0002
#define	CM_HASH		0004
#define	CM_BATCH	0010
#define	CM_EXE		0020
#define	CM_ADDEXT	0040
#define	CM_RECALC	0100
#define	CM_REHASH	0200

typedef struct _strbuf_t {
	char *s;
	ALLOC_T size;
	ALLOC_T len;
} strbuf_t;

#ifndef	NODIRLOOP
typedef struct _devino_t {
	dev_t dev;
	ino_t ino;
} devino_t;
#endif

typedef struct _wild_t {
	char *s;
	strbuf_t fixed;
	strbuf_t path;
	int quote;
#ifndef	NODIRLOOP
	int nino;
	devino_t *ino;
#endif
	u_char flags;
} wild_t;

#define	EA_STRIPQ	0001
#define	EA_BACKQ	0002
#define	EA_KEEPMETA	0004
#define	EA_NOEVALQ	0010
#define	EA_STRIPQLATER	0020
#define	EA_NOUNIQDELIM	0040
#define	EA_EOLMETA	0100

#ifdef	NOUID_T
typedef u_short	uid_t;
typedef u_short	gid_t;
#endif

#ifdef	USEPID_T
typedef pid_t		p_id_t;
# else
typedef long		p_id_t;
#endif

#if	defined (SIGARGINT) || defined (NOVOID)
#define	sigarg_t	int
#else
#define	sigarg_t	void
#endif

#ifdef	SIGFNCINT
#define	sigfnc_t	int
#else
# ifdef	NOVOID
# define	sigfnc_t
# else
# define	sigfnc_t	void
# endif
#endif

typedef sigarg_t (*sigcst_t)__P_((sigfnc_t));

typedef struct _uidtable {
	uid_t uid;
	char *name;
	char *home;
} uidtable;

typedef struct _gidtable {
	gid_t gid;
	char *name;
	char **gr_mem;
	char ismem;
} gidtable;

#if	MSDOS || (defined (FD) && !defined (_NODOSDRIVE))
extern char *strdelim __P_((char *, int));
extern char *strrdelim __P_((char *, int));
#else
#define	strdelim(s, d)	strchr(s, _SC_)
#define	strrdelim(s, d)	strrchr(s, _SC_)
#endif
extern char *strrdelim2 __P_((char *, char *));
extern int isdelim __P_((char *, int));
extern char *strcatdelim __P_((char *));
extern char *strcatdelim2 __P_((char *, char *, char *));
extern int strcasecmp2 __P_((char *, char *));
extern int strncasecmp2 __P_((char *, char *, int));
#ifdef	PATHNOCASE
#define	strpathcmp	strcasecmp2
#define	strnpathcmp	strncasecmp2
#define	strpathcmp2	strcasecmp2
#define	strnpathcmp2	strncasecmp2
#else
#define	strpathcmp	strcmp
#define	strnpathcmp	strncmp
extern int strpathcmp2 __P_((char *, char *));
extern int strnpathcmp2 __P_((char *, char *, int));
#endif
#ifdef	COMMNOCASE
#define	strcommcmp	strcasecmp2
#define	strncommcmp	strncasecmp2
#else
#define	strcommcmp	strcmp
#define	strncommcmp	strncmp
#endif
#ifdef	ENVNOCASE
#define	strenvcmp	strcasecmp2
#define	strnenvcmp	strncasecmp2
#else
#define	strenvcmp	strcmp
#define	strnenvcmp	strncmp
#endif
extern char *underpath __P_((char *, char *, int));
extern int isidentchar __P_((int));
extern int isidentchar2 __P_((int));
extern int isdotdir __P_((char *));
extern char *isrootdir __P_((char *));
extern char *getbasename __P_((char *));
extern char *getshellname __P_((char *, int *, int *));
extern reg_t *regexp_init __P_((char *, int));
extern int regexp_exec __P_((reg_t *, char *, int));
extern VOID regexp_free __P_((reg_t *));
extern int cmppath __P_((CONST VOID_P, CONST VOID_P));
extern char **evalwild __P_((char *, int));
#ifndef	_NOUSEHASH
hashlist **duplhash __P_((hashlist **));
#endif
extern int searchhash __P_((hashlist **, char *, char *));
extern char *searchexecpath __P_((char *, char *));
#if	!defined (FDSH) && !defined (_NOCOMPLETE)
extern char *finddupl __P_((char *, int, char **));
extern int completepath __P_((char *, int, int, char ***, int));
extern char *findcommon __P_((int, char **));
#endif
extern char *catvar __P_((char *[], int));
extern int countvar __P_((char **));
extern VOID freevar __P_((char **));
extern char **duplvar __P_((char **, int));
extern int parsechar __P_((char *, int, int, int, int *, int *));
#if	defined (FD) && !defined (NOUID)
extern uidtable *finduid __P_((uid_t, char *));
extern gidtable *findgid __P_((gid_t, char *));
extern int isgroupmember __P_((gid_t));
# ifdef	DEBUG
extern VOID freeidlist __P_((VOID_A));
# endif
#endif	/* FD && !NOUID */
extern char *gethomedir __P_((VOID_A));
#ifndef	MINIMUMSHELL
extern int evalhome __P_((char **, int, char **));
#endif
extern char *evalarg __P_((char *, int, int));
extern int evalifs __P_((int, char ***, char *));
extern int evalglob __P_((int, char ***, int));
extern int stripquote __P_((char *, int));
extern char *_evalpath __P_((char *, char *, int));
extern char *evalpath __P_((char *, int));

extern char **argvar;
#ifndef	_NOUSEHASH
extern hashlist **hashtable;
#endif
extern char *(*getvarfunc)__P_((char *, int));
extern int (*putvarfunc)__P_((char *, int));
extern int (*getretvalfunc)__P_((VOID_A));
extern p_id_t (*getpidfunc)__P_((VOID_A));
extern p_id_t (*getlastpidfunc)__P_((VOID_A));
extern char *(*getflagfunc)__P_((VOID_A));
extern int (*checkundeffunc)__P_((char *, char *, int));
extern VOID (*exitfunc)__P_((VOID_A));
extern char *(*backquotefunc)__P_((char *));
#ifndef	MINIMUMSHELL
extern char *(*posixsubstfunc)__P_((char *, int *));
#endif
#ifndef	PATHNOCASE
extern int pathignorecase;
#endif

#endif	/* __PATHNAME_H_ */