xref: /titanic_50/usr/src/lib/libshell/common/include/builtins.h (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1982-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 #ifndef SYSDECLARE
23 
24 #include	<option.h>
25 #include	"FEATURE/options"
26 #include	"FEATURE/dynamic"
27 #include	"shtable.h"
28 
29 #define	SYSLOGIN	(sh.bltin_cmds)
30 #define SYSEXEC		(sh.bltin_cmds+1)
31 #define SYSSET		(sh.bltin_cmds+2)
32 #define SYSTRUE		(sh.bltin_cmds+4)
33 #define SYSCOMMAND	(sh.bltin_cmds+5)
34 #define SYSCD		(sh.bltin_cmds+6)
35 #define SYSBREAK	(sh.bltin_cmds+7)
36 #define SYSCONT		(sh.bltin_cmds+8)
37 #define SYSTYPESET	(sh.bltin_cmds+9)
38 #define SYSTEST		(sh.bltin_cmds+10)
39 #define SYSBRACKET	(sh.bltin_cmds+11)
40 #define SYSLET		(sh.bltin_cmds+12)
41 #define SYSEXPORT	(sh.bltin_cmds+13)
42 #if SHOPT_BASH
43 #   define SYSLOCAL	(sh.bltin_cmds+14)
44 #else
45 #   define SYSLOCAL	0
46 #endif
47 
48 /* entry point for shell special builtins */
49 
50 #if _BLD_shell && defined(__EXPORT__)
51 #	define extern	__EXPORT__
52 #endif
53 
54 extern int b_alias(int, char*[],void*);
55 extern int b_break(int, char*[],void*);
56 extern int b_dot_cmd(int, char*[],void*);
57 extern int b_exec(int, char*[],void*);
58 extern int b_eval(int, char*[],void*);
59 extern int b_return(int, char*[],void*);
60 extern int B_login(int, char*[],void*);
61 extern int b_true(int, char*[],void*);
62 extern int b_false(int, char*[],void*);
63 extern int b_readonly(int, char*[],void*);
64 extern int b_set(int, char*[],void*);
65 extern int b_shift(int, char*[],void*);
66 extern int b_trap(int, char*[],void*);
67 extern int b_typeset(int, char*[],void*);
68 extern int b_unset(int, char*[],void*);
69 extern int b_unalias(int, char*[],void*);
70 
71 /* The following are for job control */
72 #if defined(SIGCLD) || defined(SIGCHLD)
73     extern int b_jobs(int, char*[],void*);
74     extern int b_kill(int, char*[],void*);
75 #   ifdef SIGTSTP
76 	extern int b_bg(int, char*[],void*);
77 #   endif	/* SIGTSTP */
78 #endif
79 
80 /* The following utilities are built-in because of side-effects */
81 extern int b_builtin(int, char*[],void*);
82 extern int b_cd(int, char*[],void*);
83 extern int b_command(int, char*[],void*);
84 extern int b_getopts(int, char*[],void*);
85 extern int b_hist(int, char*[],void*);
86 extern int b_let(int, char*[],void*);
87 extern int b_read(int, char*[],void*);
88 extern int b_ulimit(int, char*[],void*);
89 extern int b_umask(int, char*[],void*);
90 #ifdef _cmd_universe
91     extern int b_universe(int, char*[],void*);
92 #endif /* _cmd_universe */
93 #if SHOPT_FS_3D
94     extern int b_vpath(int, char*[],void*);
95 #endif /* SHOPT_FS_3D */
96 extern int b_wait(int, char*[],void*);
97 extern int b_whence(int, char*[],void*);
98 
99 extern int b_alarm(int, char*[],void*);
100 extern int b_print(int, char*[],void*);
101 extern int b_printf(int, char*[],void*);
102 extern int b_pwd(int, char*[],void*);
103 extern int b_sleep(int, char*[],void*);
104 extern int b_test(int, char*[],void*);
105 #if !SHOPT_ECHOPRINT
106     extern int B_echo(int, char*[],void*);
107 #endif /* SHOPT_ECHOPRINT */
108 
109 #undef	extern
110 
111 extern const char	e_alrm1[];
112 extern const char	e_alrm2[];
113 extern const char	e_badfun[];
114 extern const char	e_baddisc[];
115 extern const char	e_nofork[];
116 extern const char	e_nosignal[];
117 extern const char	e_nolabels[];
118 extern const char	e_notimp[];
119 extern const char	e_nosupport[];
120 extern const char	e_badbase[];
121 extern const char	e_overlimit[];
122 
123 extern const char	e_eneedsarg[];
124 extern const char	e_toodeep[];
125 extern const char	e_badname[];
126 extern const char	e_badwrite[];
127 extern const char	e_badsyntax[];
128 #ifdef _cmd_universe
129     extern const char	e_nouniverse[];
130 #endif /* _cmd_universe */
131 extern const char	e_histopen[];
132 extern const char	e_condition[];
133 extern const char	e_badrange[];
134 extern const char	e_numeric[];
135 extern const char	e_trap[];
136 extern const char	e_direct[];
137 extern const char	e_defedit[];
138 extern const char	e_cneedsarg[];
139 extern const char	e_defined[];
140 #if SHOPT_FS_3D
141     extern const char	e_cantset[];
142     extern const char	e_cantget[];
143     extern const char	e_mapping[];
144     extern const char	e_versions[];
145 #endif /* SHOPT_FS_3D */
146 
147 /* for option parsing */
148 extern const char sh_set[];
149 extern const char sh_optalarm[];
150 extern const char sh_optalias[];
151 extern const char sh_optbreak[];
152 extern const char sh_optbuiltin[];
153 extern const char sh_optcd[];
154 extern const char sh_optcommand[];
155 extern const char sh_optcont[];
156 extern const char sh_optdot[];
157 #ifndef ECHOPRINT
158     extern const char sh_optecho[];
159 #endif /* !ECHOPRINT */
160 extern const char sh_opteval[];
161 extern const char sh_optexec[];
162 extern const char sh_optexit[];
163 extern const char sh_optexport[];
164 extern const char sh_optgetopts[];
165 extern const char sh_optbg[];
166 extern const char sh_optdisown[];
167 extern const char sh_optfg[];
168 extern const char sh_opthist[];
169 extern const char sh_optjobs[];
170 extern const char sh_optkill[];
171 extern const char sh_optksh[];
172 extern const char sh_optlet[];
173 extern const char sh_optprint[];
174 extern const char sh_optprintf[];
175 extern const char sh_optpwd[];
176 extern const char sh_optread[];
177 extern const char sh_optreadonly[];
178 extern const char sh_optreturn[];
179 extern const char sh_optset[];
180 extern const char sh_optshift[];
181 extern const char sh_optsleep[];
182 extern const char sh_opttrap[];
183 extern const char sh_opttypeset[];
184 extern const char sh_optulimit[];
185 extern const char sh_optumask[];
186 extern const char sh_optunalias[];
187 extern const char sh_optwait[];
188 #ifdef _cmd_universe
189     extern const char sh_optuniverse[];
190 #endif /* _cmd_universe */
191 extern const char sh_optunset[];
192 #if SHOPT_FS_3D
193     extern const char sh_optvpath[];
194     extern const char sh_optvmap[];
195 #endif /* SHOPT_FS_3D */
196 extern const char sh_optwhence[];
197 #endif /* SYSDECLARE */
198 
199 extern const char e_dict[];
200 
201