xref: /titanic_51/usr/src/lib/libshell/common/include/builtins.h (revision 95c2d3023b88b9097d9822eb47ace5466e6d1cf4)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2008 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
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 #define SYSDOT		(sh.bltin_cmds+14)
43 #define SYSRETURN	(sh.bltin_cmds+15)
44 #if SHOPT_BASH
45 #   define SYSLOCAL	(sh.bltin_cmds+16)
46 #else
47 #   define SYSLOCAL	0
48 #endif
49 
50 /* entry point for shell special builtins */
51 
52 #if _BLD_shell && defined(__EXPORT__)
53 #	define extern	__EXPORT__
54 #endif
55 
56 extern int b_alias(int, char*[],void*);
57 extern int b_break(int, char*[],void*);
58 extern int b_dot_cmd(int, char*[],void*);
59 extern int b_enum(int, char*[],void*);
60 extern int b_exec(int, char*[],void*);
61 extern int b_eval(int, char*[],void*);
62 extern int b_return(int, char*[],void*);
63 extern int B_login(int, char*[],void*);
64 extern int b_true(int, char*[],void*);
65 extern int b_false(int, char*[],void*);
66 extern int b_readonly(int, char*[],void*);
67 extern int b_set(int, char*[],void*);
68 extern int b_shift(int, char*[],void*);
69 extern int b_trap(int, char*[],void*);
70 extern int b_typeset(int, char*[],void*);
71 extern int b_unset(int, char*[],void*);
72 extern int b_unalias(int, char*[],void*);
73 
74 /* The following are for job control */
75 #if defined(SIGCLD) || defined(SIGCHLD)
76     extern int b_jobs(int, char*[],void*);
77     extern int b_kill(int, char*[],void*);
78 #   ifdef SIGTSTP
79 	extern int b_bg(int, char*[],void*);
80 #   endif	/* SIGTSTP */
81 #endif
82 
83 /* The following utilities are built-in because of side-effects */
84 extern int b_builtin(int, char*[],void*);
85 extern int b_cd(int, char*[],void*);
86 extern int b_command(int, char*[],void*);
87 extern int b_getopts(int, char*[],void*);
88 extern int b_hist(int, char*[],void*);
89 extern int b_let(int, char*[],void*);
90 extern int b_read(int, char*[],void*);
91 extern int b_ulimit(int, char*[],void*);
92 extern int b_umask(int, char*[],void*);
93 #ifdef _cmd_universe
94     extern int b_universe(int, char*[],void*);
95 #endif /* _cmd_universe */
96 #if SHOPT_FS_3D
97     extern int b_vpath(int, char*[],void*);
98 #endif /* SHOPT_FS_3D */
99 extern int b_wait(int, char*[],void*);
100 extern int b_whence(int, char*[],void*);
101 
102 extern int b_alarm(int, char*[],void*);
103 extern int b_print(int, char*[],void*);
104 extern int b_printf(int, char*[],void*);
105 extern int b_pwd(int, char*[],void*);
106 extern int b_sleep(int, char*[],void*);
107 extern int b_test(int, char*[],void*);
108 #if !SHOPT_ECHOPRINT
109     extern int B_echo(int, char*[],void*);
110 #endif /* SHOPT_ECHOPRINT */
111 
112 #undef	extern
113 
114 extern const char	e_alrm1[];
115 extern const char	e_alrm2[];
116 extern const char	e_badfun[];
117 extern const char	e_baddisc[];
118 extern const char	e_nofork[];
119 extern const char	e_nosignal[];
120 extern const char	e_nolabels[];
121 extern const char	e_notimp[];
122 extern const char	e_nosupport[];
123 extern const char	e_badbase[];
124 extern const char	e_overlimit[];
125 
126 extern const char	e_eneedsarg[];
127 extern const char	e_toodeep[];
128 extern const char	e_badname[];
129 extern const char	e_badsyntax[];
130 #ifdef _cmd_universe
131     extern const char	e_nouniverse[];
132 #endif /* _cmd_universe */
133 extern const char	e_histopen[];
134 extern const char	e_condition[];
135 extern const char	e_badrange[];
136 extern const char	e_trap[];
137 extern const char	e_direct[];
138 extern const char	e_defedit[];
139 extern const char	e_cneedsarg[];
140 extern const char	e_defined[];
141 #if SHOPT_FS_3D
142     extern const char	e_cantset[];
143     extern const char	e_cantget[];
144     extern const char	e_mapping[];
145     extern const char	e_versions[];
146 #endif /* SHOPT_FS_3D */
147 
148 /* for option parsing */
149 extern const char sh_set[];
150 extern const char sh_optalarm[];
151 extern const char sh_optalias[];
152 extern const char sh_optbreak[];
153 extern const char sh_optbuiltin[];
154 extern const char sh_optcd[];
155 extern const char sh_optcommand[];
156 extern const char sh_optcont[];
157 extern const char sh_optdot[];
158 #ifndef ECHOPRINT
159     extern const char sh_optecho[];
160 #endif /* !ECHOPRINT */
161 extern const char sh_opteval[];
162 extern const char sh_optexec[];
163 extern const char sh_optexit[];
164 extern const char sh_optexport[];
165 extern const char sh_optgetopts[];
166 extern const char sh_optbg[];
167 extern const char sh_optdisown[];
168 extern const char sh_optfg[];
169 extern const char sh_opthist[];
170 extern const char sh_optjobs[];
171 extern const char sh_optkill[];
172 extern const char sh_optksh[];
173 extern const char sh_optlet[];
174 extern const char sh_optprint[];
175 extern const char sh_optprintf[];
176 extern const char sh_optpwd[];
177 extern const char sh_optread[];
178 extern const char sh_optreadonly[];
179 extern const char sh_optreturn[];
180 extern const char sh_optset[];
181 extern const char sh_optshift[];
182 extern const char sh_optsleep[];
183 extern const char sh_opttrap[];
184 extern const char sh_opttypeset[];
185 extern const char sh_optulimit[];
186 extern const char sh_optumask[];
187 extern const char sh_optunalias[];
188 extern const char sh_optwait[];
189 #ifdef _cmd_universe
190     extern const char sh_optuniverse[];
191 #endif /* _cmd_universe */
192 extern const char sh_optunset[];
193 #if SHOPT_FS_3D
194     extern const char sh_optvpath[];
195     extern const char sh_optvmap[];
196 #endif /* SHOPT_FS_3D */
197 extern const char sh_optwhence[];
198 #endif /* SYSDECLARE */
199 
200 extern const char e_dict[];
201 
202