2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: builtins.c /main/3 1995/11/01 15:50:47 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
29 * AT&T BELL LABORATORIES *
30 * AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
31 * ACCORDANCE WITH APPLICABLE AGREEMENTS *
33 * Copyright (c) 1994 AT&T Bell Laboratories *
34 * Unpublished & Not for Publication *
35 * All Rights Reserved *
37 * The copyright notice above does not evidence any *
38 * actual or intended publication of such source code *
40 * This software was created by the *
41 * Advanced Software Technology Department *
42 * AT&T Bell Laboratories *
44 * For further information contact *
45 * {research,attmail}!dgk *
46 * dgk@research.att.com *
47 * David Korn 908-582-7975 *
49 ***************************************************************/
51 /* : : generated by proto : : */
55 #if !defined(__PROTO__)
56 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
57 #if defined(__cplusplus)
58 #define __MANGLE__ "C"
63 #define __PROTO__(x) x
65 #define __PARAM__(n,o) n
66 #if !defined(__STDC__) && !defined(__cplusplus)
67 #if !defined(c_plusplus)
78 #define __PROTO__(x) ()
79 #define __OTORP__(x) x
80 #define __PARAM__(n,o) o
88 #if defined(__cplusplus) || defined(c_plusplus)
89 #define __VARARG__ ...
93 #if defined(__STDARG__)
94 #define __VA_START__(p,a) va_start(p,a)
96 #define __VA_START__(p,a) va_start(p)
101 #define mount _AST_mount
107 # include "builtins.h"
109 # include "FEATURE/cmds"
110 #if defined(__STDC__) || defined(__STDPP__)
111 # define bltin(x) (b_##x)
113 # define bltin(x) (b_/**/x)
122 #include <X11/Intrinsic.h>
123 #include <X11/IntrinsicP.h>
133 * The order up through "[" is significant
135 const struct shtable3 shtab_builtins[] =
137 "login", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login),
138 "exec", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(exec),
139 "set", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(set),
140 ":", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(true),
141 "true", NV_BLTIN|BLT_ENV, bltin(true),
142 "command", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(command),
143 "cd", NV_BLTIN|BLT_ENV, bltin(cd),
144 "break", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont),
145 "continue", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(brk_cont),
146 "typeset", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
147 "test", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(test),
148 "[", NV_BLTIN|BLT_ENV, bltin(test),
150 "newgrp", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(login),
151 #endif /* _bin_newgrp */
152 ".", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(dot_cmd),
153 "alias", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
154 "hash", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
155 "exit", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit),
156 "export", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(read_export),
157 "eval", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
158 "fc", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist),
159 "hist", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist),
160 "readonly", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(read_export),
161 "return", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(ret_exit),
162 "shift", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(shift),
163 "trap", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(trap),
164 "unalias", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unalias),
165 "unset", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(unset),
166 "builtin", NV_BLTIN, bltin(builtin),
167 #ifdef SHOPT_ECHOPRINT
168 "echo", NV_BLTIN|BLT_ENV, bltin(print),
170 "echo", NV_BLTIN|BLT_ENV, bltin(echo),
171 #endif /* SHOPT_ECHOPRINT */
174 "bg", NV_BLTIN|BLT_ENV, bltin(bg_fg),
175 "fg", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(bg_fg),
176 "disown", NV_BLTIN|BLT_ENV, bltin(bg_fg),
177 "kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill),
179 "/bin/kill", NV_BLTIN|BLT_ENV|NV_NOFREE, bltin(kill),
180 # endif /* SIGTSTP */
181 "jobs", NV_BLTIN|BLT_ENV, bltin(jobs),
183 "false", NV_BLTIN|BLT_ENV, bltin(false),
184 "getconf", NV_BLTIN|BLT_ENV, bltin(getconf),
185 "getopts", NV_BLTIN|BLT_ENV, bltin(getopts),
186 "let", NV_BLTIN|BLT_ENV, bltin(let),
187 "print", NV_BLTIN|BLT_ENV, bltin(print),
188 "printf", NV_BLTIN|NV_NOFREE, bltin(printf),
189 "pwd", NV_BLTIN|NV_NOFREE, bltin(pwd),
190 "read", NV_BLTIN|BLT_ENV, bltin(read),
191 "sleep", NV_BLTIN|NV_NOFREE, bltin(sleep),
192 "alarm", NV_BLTIN, bltin(alarm),
193 "ulimit", NV_BLTIN|BLT_ENV, bltin(ulimit),
194 "umask", NV_BLTIN|BLT_ENV, bltin(umask),
196 "universe", NV_BLTIN|BLT_ENV, bltin(universe),
197 #endif /* _cmd_universe */
199 "vpath", NV_BLTIN|BLT_ENV, bltin(vpath_map),
200 "vmap", NV_BLTIN|BLT_ENV, bltin(vpath_map),
201 #endif /* SHOPT_FS_3D */
202 "wait", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(wait),
203 "type", NV_BLTIN|BLT_ENV, bltin(whence),
204 "whence", NV_BLTIN|BLT_ENV, bltin(whence),
206 "inlib", NV_BLTIN|BLT_ENV, bltin(inlib),
207 "rootnode", NV_BLTIN, bltin(rootnode),
208 "ver", NV_BLTIN, bltin(ver),
210 "/bin/basename",NV_BLTIN|NV_NOFREE, bltin(basename),
211 "/bin/chmod", NV_BLTIN|NV_NOFREE, bltin(chmod),
212 "/bin/dirname", NV_BLTIN|NV_NOFREE, bltin(dirname),
213 "/bin/head", NV_BLTIN|NV_NOFREE, bltin(head),
214 "/bin/mkdir", NV_BLTIN|NV_NOFREE, bltin(mkdir),
215 #if defined(_usr_bin_logname) && !defined(_bin_logname)
216 "/usr/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname),
218 "/bin/logname", NV_BLTIN|NV_NOFREE, bltin(logname),
220 "/bin/cat", NV_BLTIN|NV_NOFREE, bltin(cat),
221 "/bin/cmp", NV_BLTIN|NV_NOFREE, bltin(cmp),
222 #if defined(_usr_bin_cut) && !defined(_bin_cut)
223 "/usr/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut),
225 "/bin/cut", NV_BLTIN|NV_NOFREE, bltin(cut),
227 "/bin/uname", NV_BLTIN|NV_NOFREE, bltin(uname),
228 #if defined(_usr_bin_wc) && !defined(_bin_wc)
229 "/usr/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
231 # if defined(_usr_ucb_wc) && !defined(_bin_wc)
232 "/usr/ucb/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
234 "/bin/wc", NV_BLTIN|NV_NOFREE, bltin(wc),
245 const char sh_optalarm[] = "r [varname seconds]";
246 const char sh_optalias[] = "ptx [name=[value]...]";
247 const char sh_optbuiltin[] = "dsf:[library] [name...]";
248 const char sh_optcd[] = "LP [dir] [change]";
249 const char sh_optcflow[] = " [n]";
250 const char sh_optcommand[] = "pvV name [arg]...";
251 const char sh_optdot[] = " name [arg...]";
253 const char sh_optecho[] = " [-n] [arg...]";
254 #endif /* !ECHOPRINT */
255 const char sh_opteval[] = " [arg...]";
256 const char sh_optexec[] = "a:[name]c [command [args...] ]";
257 const char sh_optexport[] = "p [name[=value]...]";
258 const char sh_optgetopts[] = ":a:[name] optstring name [args...]";
259 const char sh_optgetconf[] = " [name [pathname] ]";
260 const char sh_optjoblist[] = " [job...]";
261 const char sh_opthist[] = "e:[editor]lnrsN# [first] [last]";
262 const char sh_optjobs[] = "nlp [job...]";
263 const char sh_optkill[] = "ln#[signum]s:[signame] sig...";
264 const char sh_optlet[] = " expr...";
265 const char sh_optprint[] = "f:[format]enprsu:[filenum] [arg...]";
266 const char sh_optprintf[] = " format [arg...]";
267 const char sh_optpwd[] = "LP";
268 const char sh_optread[] = "Ad:[delim]prst#[timeout]u#[filenum] [name...]";
270 const char sh_optksh[] = "+DircabefhkmnpstuvxCR:[file]o:?[option] [arg...]";
271 const char sh_optset[] = "+abefhkmnpstuvxCR:[file]o:?[option]A:[name] [arg...]";
273 const char sh_optksh[] = "+DircabefhkmnpstuvxCo:?[option] [arg...]";
274 const char sh_optset[] = "+abefhkmnpstuvxCo:?[option]A:[name] [arg...]";
275 #endif /* SHOPT_KIA */
276 const char sh_optsleep[] = " seconds";
277 const char sh_opttrap[] = "p [action condition...]";
279 const char sh_opttypeset[] = "+AC:E#?F#?H:[name]L#?R#?Z#?fi#?[base]lnprtux [name=[value]...]";
281 const char sh_opttypeset[] = "+AE#?F#?HL#?R#?Z#?fi#?[base]lnprtux [name=[value]...]";
282 #endif /* SHOPT_OO */
283 const char sh_optulimit[] = "HSacdfmnstv [limit]";
284 const char sh_optumask[] = "S [mask]";
285 const char sh_optuniverse[] = " [name]";
286 const char sh_optunset[] = "fnv name...";
287 const char sh_optunalias[] = "a name...";
289 const char sh_optvpath[] = " [top] [base]";
290 const char sh_optvmap[] = " [dir] [list]";
291 #endif /* SHOPT_FS_3D */
292 const char sh_optwhence[] = "afpv name...";
296 const char e_alrm1[] = "alarm -r %s +%.3g\n";
297 const char e_alrm2[] = "alarm %s %.3f\n";
298 const char e_badfun[] = "%s: illegal function name";
299 const char e_baddisc[] = "%s: invalid discipline function";
300 const char e_nospace[] = "out of memory";
301 const char e_nofork[] = "cannot fork";
302 const char e_nosignal[] = "%s: unknown signal name";
303 const char e_numeric[] = "*([0-9])?(.)*([0-9])";
304 const char e_condition[] = "condition(s) required";
305 const char e_cneedsarg[] = "-c requires argument";