xref: /titanic_50/usr/src/lib/libshell/common/include/builtins.h (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1 /***********************************************************************
2 *                                                                      *
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                     *
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_oneoperand[];
128 extern const char	e_toodeep[];
129 extern const char	e_badname[];
130 extern const char	e_badsyntax[];
131 #ifdef _cmd_universe
132     extern const char	e_nouniverse[];
133 #endif /* _cmd_universe */
134 extern const char	e_histopen[];
135 extern const char	e_condition[];
136 extern const char	e_badrange[];
137 extern const char	e_trap[];
138 extern const char	e_direct[];
139 extern const char	e_defedit[];
140 extern const char	e_cneedsarg[];
141 extern const char	e_defined[];
142 #if SHOPT_FS_3D
143     extern const char	e_cantset[];
144     extern const char	e_cantget[];
145     extern const char	e_mapping[];
146     extern const char	e_versions[];
147 #endif /* SHOPT_FS_3D */
148 
149 /* for option parsing */
150 extern const char sh_set[];
151 extern const char sh_optalarm[];
152 extern const char sh_optalias[];
153 extern const char sh_optbreak[];
154 extern const char sh_optbuiltin[];
155 extern const char sh_optcd[];
156 extern const char sh_optcommand[];
157 extern const char sh_optcont[];
158 extern const char sh_optdot[];
159 #ifndef ECHOPRINT
160     extern const char sh_optecho[];
161 #endif /* !ECHOPRINT */
162 extern const char sh_opteval[];
163 extern const char sh_optexec[];
164 extern const char sh_optexit[];
165 extern const char sh_optexport[];
166 extern const char sh_optgetopts[];
167 extern const char sh_optbg[];
168 extern const char sh_optdisown[];
169 extern const char sh_optfg[];
170 extern const char sh_opthist[];
171 extern const char sh_optjobs[];
172 extern const char sh_optkill[];
173 extern const char sh_optksh[];
174 extern const char sh_optlet[];
175 extern const char sh_optprint[];
176 extern const char sh_optprintf[];
177 extern const char sh_optpwd[];
178 extern const char sh_optread[];
179 extern const char sh_optreadonly[];
180 extern const char sh_optreturn[];
181 extern const char sh_optset[];
182 extern const char sh_optshift[];
183 extern const char sh_optsleep[];
184 extern const char sh_opttrap[];
185 extern const char sh_opttypeset[];
186 extern const char sh_optulimit[];
187 extern const char sh_optumask[];
188 extern const char sh_optunalias[];
189 extern const char sh_optwait[];
190 #ifdef _cmd_universe
191     extern const char sh_optuniverse[];
192 #endif /* _cmd_universe */
193 extern const char sh_optunset[];
194 #if SHOPT_FS_3D
195     extern const char sh_optvpath[];
196     extern const char sh_optvmap[];
197 #endif /* SHOPT_FS_3D */
198 extern const char sh_optwhence[];
199 #endif /* SYSDECLARE */
200 
201 extern const char e_dict[];
202 
203