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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
|
/*
* pathname.h
*
* definitions & function prototype declarations for "pathname.c"
*/
#ifndef __PATHNAME_H_
#define __PATHNAME_H_
#include "depend.h"
#include "typesize.h"
/* #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
#if defined (MINIMUMSHELL) && defined (DOUBLESLASH)
#undef DOUBLESLASH
#endif
#define IFS_SET " \t\n"
#define ESCAPE '\\'
#if MSDOS && !defined (DEP_ORIGSHELL)
#define PATHDELIM ';'
#else
#define PATHDELIM ':'
#endif
#define ENVPATH "PATH"
#define ENVHOME "HOME"
#define ENVPWD "PWD"
#define ENVIFS "IFS"
#define EXTCOM "COM"
#define EXTEXE "EXE"
#define EXTBAT "BAT"
#ifndef BSPATHDELIM
#define PESCAPE ESCAPE
#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 DEP_ORIGSHELL
# define PESCAPE '%'
# define RMSUFFIX '\\'
# define METACHAR "\t\r\n !\"#$%&'()*;<=>?[]`|"
# define DQ_METACHAR "\"$%`"
# else
# define FAKEESCAPE
# define PESCAPE '$'
# 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_WCHAR 6
#define PC_ESCAPE 7
#define PC_META 8
#define PC_EXMETA 9
#define PC_DELIM 10
#if defined (_NOORIGGLOB) \
&& !defined (USEREGCMP) && !defined (USEREGCOMP) && !defined (USERE_COMP)
#undef _NOORIGGLOB
#endif
#ifdef _NOORIGGLOB
# ifdef USEREGCOMP
# include <regex.h>
typedef regex_t reg_ex_t;
# else
typedef char reg_ex_t;
# endif
#else /* !_NOORIGGLOB */
typedef char * reg_ex_t;
# undef USEREGCMP
# undef USEREGCOMP
# undef USERE_COMP
#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 {
CONST char *s;
strbuf_t fixed;
strbuf_t path;
int quote;
#ifndef NODIRLOOP
int nino;
devino_t *ino;
#endif
#if defined (DOUBLESLASH) || defined (DEP_URLPATH)
u_char type;
#endif
u_char flags;
} wild_t;
#define WT_NORMAL 0
#define WT_DOUBLESLASH 1
#define WT_URLPATH 2
#define EA_STRIPQ 000001
#define EA_STRIPESCAPE 000002
#define EA_KEEPESCAPE 000004
#define EA_NOEVALQ 000010
#define EA_NOEVALDQ 000020
#define EA_BACKQ 000040
#define EA_STRIPQLATER 000100
#define EA_NOUNIQDELIM 000200
#define EA_EOLESCAPE 000400
#define EA_FINDMETA 001000
#define EA_FINDDELIM 002000
#define EA_EVALIFS 004000
#define EA_INQUOTE 010000
#define PT_NONE 0
#define PT_DOS 1
#define PT_DSLASH 2
#define PT_URL 3
#ifdef SIGARGINT
typedef int sigarg_t;
#else
# ifdef NOVOID
# define sigarg_t
# else
typedef void sigarg_t;
# endif
#endif
#ifdef SIGFNCINT
typedef int sigfnc_t;
#else
# ifdef NOVOID
# define sigfnc_t
# else
typedef void sigfnc_t;
# endif
#endif
typedef sigarg_t (*sigcst_t)__P_((sigfnc_t));
typedef struct _uidtable {
u_id_t uid;
char *name;
char *home;
} uidtable;
typedef struct _gidtable {
g_id_t gid;
char *name;
#ifndef USEGETGROUPS
char **gr_mem;
#endif
char ismem;
} gidtable;
extern int getpathtop __P_((CONST char *, int *, int *));
#ifdef DEP_DOSPATH
extern char *gendospath __P_((char *, int, int));
#endif
#if defined (DEP_PATHTOP) || defined (BSPATHDELIM)
extern char *strdelim __P_((CONST char *, int));
extern char *strrdelim __P_((CONST char *, int));
#else
#define strdelim(s, d) Xstrchr(s, _SC_)
#define strrdelim(s, d) Xstrrchr(s, _SC_)
#endif
#ifdef FD
extern char *strrdelim2 __P_((CONST char *, int, CONST char *));
#endif
#ifndef MINIMUMSHELL
extern int isdelim __P_((CONST char *, int));
#endif
extern char *strcatdelim __P_((char *));
extern char *strcatdelim2 __P_((char *, CONST char *, CONST char *));
extern int strcatpath __P_((char *, char *, CONST char *));
#ifdef PATHNOCASE
#define strpathcmp Xstrcasecmp
#define strnpathcmp Xstrncasecmp
#define strpathcmp2 Xstrcasecmp
#define strnpathcmp2 Xstrncasecmp
#else
#define strpathcmp strcmp
#define strnpathcmp strncmp
extern int strpathcmp2 __P_((CONST char *, CONST char *));
extern int strnpathcmp2 __P_((CONST char *, CONST char *, int));
#endif
#ifdef _NOVERSCMP
#define strverscmp2 strpathcmp2
#else
extern int strverscmp2 __P_((CONST char *, CONST char *));
#endif
#ifdef COMMNOCASE
#define strcommcmp Xstrcasecmp
#define strncommcmp Xstrncasecmp
#else
#define strcommcmp strcmp
#define strncommcmp strncmp
#endif
#ifdef ENVNOCASE
#define strenvcmp Xstrcasecmp
#define strnenvcmp Xstrncasecmp
#else
#define strenvcmp strcmp
#define strnenvcmp strncmp
#endif
#ifdef FD
extern char *underpath __P_((CONST char *, CONST char *, int));
#endif
extern int isidentchar __P_((int));
extern int isidentchar2 __P_((int));
extern int isdotdir __P_((CONST char *));
extern char *isrootdir __P_((CONST char *));
#ifndef MINIMUMSHELL
extern int isrootpath __P_((CONST char *));
extern VOID copyrootpath __P_((char *));
#endif
extern VOID copycurpath __P_((char *));
#ifdef DOUBLESLASH
extern int isdslash __P_((CONST char *));
#endif
extern char *getbasename __P_((CONST char *));
extern char *getshellname __P_((CONST char *, int *, int *));
extern reg_ex_t *regexp_init __P_((CONST char *, int));
extern int regexp_exec __P_((CONST reg_ex_t *, CONST char *, int));
extern VOID regexp_free __P_((reg_ex_t *));
extern int cmppath __P_((CONST VOID_P, CONST VOID_P));
extern char **evalwild __P_((CONST char *, int));
#ifndef _NOUSEHASH
extern hashlist **duplhash __P_((hashlist **));
#endif
extern int searchhash __P_((hashlist **, CONST char *, CONST char *));
#ifdef FD
extern char *searchexecpath __P_((CONST char *, CONST char *));
#endif
#if !defined (FDSH) && !defined (_NOCOMPLETE)
extern int addcompletion __P_((CONST char *, char *, int, char ***));
# ifndef NOUID
# ifndef NOGETPWENT
extern int completeuser __P_((CONST char *, int, int, char ***, int));
# endif
# ifndef NOGETGRENT
extern int completegroup __P_((CONST char *, int, int, char ***));
# endif
# endif /* !NOUID */
extern int completepath __P_((CONST char *, int, int, char ***, int));
extern char *findcommon __P_((int, char *CONST *));
#endif /* !FDSH && !_NOCOMPLETE */
extern char *catvar __P_((char *CONST *, int));
extern int countvar __P_((char *CONST *));
extern VOID freevar __P_((char **));
extern char **duplvar __P_((char *CONST *, int));
extern int parsechar __P_((CONST char *, int, int, int, int *, int *));
#ifndef NOUID
extern VOID getlogininfo __P_((CONST char **, CONST char **));
extern uidtable *finduid __P_((u_id_t, CONST char *));
extern gidtable *findgid __P_((g_id_t, CONST char *));
extern int isgroupmember __P_((g_id_t));
# ifdef DEBUG
extern VOID freeidlist __P_((VOID_A));
# endif
#endif /* !NOUID */
#ifndef MINIMUMSHELL
extern CONST char *gethomedir __P_((VOID_A));
#endif
extern CONST char *getrealpath __P_((CONST char *, char *, char *));
extern char *evalarg __P_((char *, int));
extern int evalifs __P_((int, char ***, CONST char *));
extern int evalglob __P_((int, char ***, int));
extern int stripquote __P_((char *, int));
extern char *_evalpath __P_((CONST char *, CONST char *, int));
extern char *evalpath __P_((char *, int));
extern CONST char nullstr[];
#define vnullstr ((char *)nullstr)
extern CONST char rootpath[];
extern CONST char curpath[];
extern CONST char parentpath[];
extern char **argvar;
#ifndef _NOUSEHASH
extern hashlist **hashtable;
#endif
extern char *(*getvarfunc)__P_((CONST 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_((CONST char *, CONST char *, int));
extern VOID_T (*exitfunc)__P_((VOID_A));
extern char *(*backquotefunc)__P_((CONST char *));
#ifndef MINIMUMSHELL
extern char *(*posixsubstfunc)__P_((CONST char *, int *));
#endif
#ifndef PATHNOCASE
extern int pathignorecase;
#endif
#ifndef _NOVERSCMP
extern int versioncomp;
#endif
#endif /* !__PATHNAME_H_ */
|