xref: /illumos-gate/usr/src/contrib/ast/src/cmd/ksh93/include/builtins.h (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2012 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
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	(shgd->bltin_cmds)
30 #define SYSEXEC		(shgd->bltin_cmds+1)
31 #define SYSSET		(shgd->bltin_cmds+2)
32 #define SYSTRUE		(shgd->bltin_cmds+4)
33 #define SYSCOMMAND	(shgd->bltin_cmds+5)
34 #define SYSCD		(shgd->bltin_cmds+6)
35 #define SYSBREAK	(shgd->bltin_cmds+7)
36 #define SYSCONT		(shgd->bltin_cmds+8)
37 #define SYSTYPESET	(shgd->bltin_cmds+9)
38 #define SYSTEST		(shgd->bltin_cmds+10)
39 #define SYSBRACKET	(shgd->bltin_cmds+11)
40 #define SYSLET		(shgd->bltin_cmds+12)
41 #define SYSEXPORT	(shgd->bltin_cmds+13)
42 #define SYSDOT		(shgd->bltin_cmds+14)
43 #define SYSRETURN	(shgd->bltin_cmds+15)
44 #if SHOPT_BASH
45 #   define SYSLOCAL	(shgd->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*[],Shbltin_t*);
57 extern int b_break(int, char*[],Shbltin_t*);
58 extern int b_dot_cmd(int, char*[],Shbltin_t*);
59 extern int b_enum(int, char*[],Shbltin_t*);
60 extern int b_exec(int, char*[],Shbltin_t*);
61 extern int b_eval(int, char*[],Shbltin_t*);
62 extern int b_return(int, char*[],Shbltin_t*);
63 extern int B_login(int, char*[],Shbltin_t*);
64 extern int b_true(int, char*[],Shbltin_t*);
65 extern int b_false(int, char*[],Shbltin_t*);
66 extern int b_readonly(int, char*[],Shbltin_t*);
67 extern int b_set(int, char*[],Shbltin_t*);
68 extern int b_shift(int, char*[],Shbltin_t*);
69 extern int b_trap(int, char*[],Shbltin_t*);
70 extern int b_typeset(int, char*[],Shbltin_t*);
71 extern int b_unset(int, char*[],Shbltin_t*);
72 extern int b_unalias(int, char*[],Shbltin_t*);
73 
74 /* The following are for job control */
75 #if defined(SIGCLD) || defined(SIGCHLD)
76     extern int b_jobs(int, char*[],Shbltin_t*);
77     extern int b_kill(int, char*[],Shbltin_t*);
78 #   ifdef SIGTSTP
79 	extern int b_bg(int, char*[],Shbltin_t*);
80 #   endif	/* SIGTSTP */
81 #endif
82 
83 /* The following utilities are built-in because of side-effects */
84 extern int b_builtin(int, char*[],Shbltin_t*);
85 extern int b_cd(int, char*[],Shbltin_t*);
86 extern int b_command(int, char*[],Shbltin_t*);
87 extern int b_getopts(int, char*[],Shbltin_t*);
88 extern int b_hist(int, char*[],Shbltin_t*);
89 extern int b_let(int, char*[],Shbltin_t*);
90 extern int b_read(int, char*[],Shbltin_t*);
91 extern int b_ulimit(int, char*[],Shbltin_t*);
92 extern int b_umask(int, char*[],Shbltin_t*);
93 #ifdef _cmd_universe
94     extern int b_universe(int, char*[],Shbltin_t*);
95 #endif /* _cmd_universe */
96 #if SHOPT_FS_3D
97     extern int b_vpath(int, char*[],Shbltin_t*);
98 #endif /* SHOPT_FS_3D */
99 extern int b_wait(int, char*[],Shbltin_t*);
100 extern int b_whence(int, char*[],Shbltin_t*);
101 
102 extern int b_alarm(int, char*[],Shbltin_t*);
103 extern int b_print(int, char*[],Shbltin_t*);
104 extern int b_printf(int, char*[],Shbltin_t*);
105 extern int b_pwd(int, char*[],Shbltin_t*);
106 extern int b_sleep(int, char*[],Shbltin_t*);
107 extern int b_test(int, char*[],Shbltin_t*);
108 #if !SHOPT_ECHOPRINT
109     extern int B_echo(int, char*[],Shbltin_t*);
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