1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1982-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * David Korn <dgk@research.att.com> *
19 ***********************************************************************/
24 * UNIX shell path handling interface
25 * Written by David Korn
26 * These are the definitions for the lexical analyzer
29 #include "FEATURE/options"
32 #if !defined(SHOPT_SPAWN)
33 # if _UWIN || _use_spawnveg || !_lib_fork
34 # define SHOPT_SPAWN 1
36 #endif /* !SHOPT_SPAWN */
38 #define PATH_PATH 0001
39 #define PATH_FPATH 0002
40 #define PATH_CDPATH 0004
41 #define PATH_BFPATH 0010
42 #define PATH_SKIP 0020
43 #define PATH_BUILTIN_LIB 0040
44 #define PATH_STD_DIR 0100 /* directory is on $(getconf PATH) */
46 #define PATH_OFFSET 2 /* path offset for path_join */
47 #define MAXDEPTH (sizeof(char*)==2?64:1024) /* maximum recursion depth*/
50 * path component structure for path searching
52 typedef struct pathcomp
54 struct pathcomp
*next
;
72 /* pathname handling routines */
73 extern void path_newdir(Pathcomp_t
*);
74 extern Pathcomp_t
*path_dirfind(Pathcomp_t
*,const char*,int);
75 extern Pathcomp_t
*path_unsetfpath(Pathcomp_t
*);
76 extern Pathcomp_t
*path_addpath(Pathcomp_t
*,const char*,int);
77 extern Pathcomp_t
*path_dup(Pathcomp_t
*);
78 extern void path_delete(Pathcomp_t
*);
79 extern void path_alias(Namval_t
*,Pathcomp_t
*);
80 extern Pathcomp_t
*path_absolute(const char*, Pathcomp_t
*);
81 extern char *path_basename(const char*);
82 extern char *path_fullname(const char*);
83 extern int path_expand(const char*, struct argnod
**);
84 extern void path_exec(const char*,char*[],struct argnod
*);
85 extern pid_t
path_spawn(const char*,char*[],char*[],Pathcomp_t
*,int);
86 #if defined(__EXPORT__) && defined(_BLD_DLL) && defined(_BLD_shell)
87 # define extern __EXPORT__
89 extern int path_open(const char*,Pathcomp_t
*);
90 extern Pathcomp_t
*path_get(const char*);
92 extern char *path_pwd(int);
93 extern Pathcomp_t
*path_nextcomp(Pathcomp_t
*,const char*,Pathcomp_t
*);
94 extern int path_search(const char*,Pathcomp_t
**,int);
95 extern char *path_relative(const char*);
96 extern int path_complete(const char*, const char*,struct argnod
**);
98 extern int path_generate(struct argnod
*,struct argnod
**);
99 #endif /* SHOPT_BRACEPAT */
101 /* constant strings needed for whence */
102 extern const char e_timeformat
[];
103 extern const char e_badtformat
[];
104 extern const char e_dot
[];
105 extern const char e_pfsh
[];
106 extern const char e_pwd
[];
107 extern const char e_logout
[];
108 extern const char e_alphanum
[];
109 extern const char e_mailmsg
[];
110 extern const char e_suidprofile
[];
111 extern const char e_sysprofile
[];
112 extern const char e_traceprompt
[];
113 extern const char e_crondir
[];
115 extern const char e_suidexec
[];
116 #endif /* SHOPT_SUID_EXEC */
117 extern const char is_alias
[];
118 extern const char is_builtin
[];
119 extern const char is_spcbuiltin
[];
120 extern const char is_builtver
[];
121 extern const char is_reserved
[];
122 extern const char is_talias
[];
123 extern const char is_xalias
[];
124 extern const char is_function
[];
125 extern const char is_ufunction
[];
127 extern const char e_prohibited
[];
128 #endif /* SHELLMAGIC */
131 # include "FEATURE/acct"
133 extern void sh_accinit(void);
134 extern void sh_accbegin(const char*);
135 extern void sh_accend(void);
136 extern void sh_accsusp(void);
139 # endif /* _sys_acct */
140 #endif /* SHOPT_ACCT */
142 #endif /*! PATH_OFFSET */