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*                                                                      *
20#pragma prototyped
22#include	<shell.h>
23#include	<signal.h>
24#include	"defs.h"
25#include	"shtable.h"
26#include	"ulimit.h"
27#include	"name.h"
28#include	"version.h"
29#if KSHELL
30#   include	"builtins.h"
31#   include	"jobs.h"
32#   include	"FEATURE/cmds"
33#   define	bltin(x)	(b_##x)
34    /* The following is for builtins that do not accept -- options */
35#   define	Bltin(x)	(B_##x)
37#   define bltin(x)	0
40#if defined(SHOPT_CMDLIB_DIR) && !defined(SHOPT_CMDLIB_HDR)
41#	define SHOPT_CMDLIB_HDR	<cmdlist.h>
43#define Q(f)		#f	/* libpp cpp workaround -- fixed 2005-04-11 */
46#undef	basename
47#undef	dirname
50 * The order up through "[" is significant
51 */
52const struct shtable3 shtab_builtins[] =
54	"login",	NV_BLTIN|BLT_ENV|BLT_SPC,	Bltin(login),
55	"exec",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(exec),
56	"set",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(set),
57	":",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(true),
58	"true",		NV_BLTIN|BLT_ENV,		bltin(true),
59	"command",	NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(command),
60	"cd",		NV_BLTIN|BLT_ENV,		bltin(cd),
61	"break",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(break),
62	"continue",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(break),
63	"typeset",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
64	"test",		NV_BLTIN|BLT_ENV,		bltin(test),
65	"[",		NV_BLTIN|BLT_ENV,		bltin(test),
66	"let",		NV_BLTIN|BLT_ENV,		bltin(let),
67	"export",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly),
68	".",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(dot_cmd),
69	"return",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(return),
71	"local",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
73#if _bin_newgrp || _usr_bin_newgrp
74	"newgrp",	NV_BLTIN|BLT_ENV|BLT_SPC,	Bltin(login),
75#endif	/* _bin_newgrp || _usr_bin_newgrp */
76	"alias",	NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
77	"hash",		NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
78	"enum",		NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(enum),
79	"eval",		NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
80	"exit",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(return),
81	"fc",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(hist),
82	"hist",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(hist),
83	"readonly",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly),
84	"shift",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(shift),
85	"trap",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(trap),
86	"unalias",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(unalias),
87	"unset",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(unset),
88	"builtin",	NV_BLTIN,			bltin(builtin),
90	"echo",		NV_BLTIN|BLT_ENV,		bltin(print),
92	"echo",		NV_BLTIN|BLT_ENV,		Bltin(echo),
93#endif /* SHOPT_ECHOPRINT */
94#ifdef JOBS
95#   ifdef SIGTSTP
96	"bg",		NV_BLTIN|BLT_ENV,		bltin(bg),
97	"fg",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(bg),
98	"disown",	NV_BLTIN|BLT_ENV,		bltin(bg),
99	"kill",		NV_BLTIN|BLT_ENV,		bltin(kill),
100#   else
101	"/bin/kill",	NV_BLTIN|BLT_ENV,		bltin(kill),
102#   endif	/* SIGTSTP */
103	"jobs",		NV_BLTIN|BLT_ENV,		bltin(jobs),
104#endif	/* JOBS */
105	"false",	NV_BLTIN|BLT_ENV,		bltin(false),
106	"getopts",	NV_BLTIN|BLT_ENV,		bltin(getopts),
107	"print",	NV_BLTIN|BLT_ENV,		bltin(print),
108	"printf",	NV_BLTIN|BLT_ENV,		bltin(printf),
109	"pwd",		NV_BLTIN,			bltin(pwd),
110	"read",		NV_BLTIN|BLT_ENV,		bltin(read),
111	"sleep",	NV_BLTIN,			bltin(sleep),
112	"alarm",	NV_BLTIN,			bltin(alarm),
113	"ulimit",	NV_BLTIN|BLT_ENV,		bltin(ulimit),
114	"umask",	NV_BLTIN|BLT_ENV,		bltin(umask),
115#ifdef _cmd_universe
116	"universe",	NV_BLTIN|BLT_ENV,		bltin(universe),
117#endif /* _cmd_universe */
118#if SHOPT_FS_3D
119	"vpath",	NV_BLTIN|BLT_ENV,		bltin(vpath),
120	"vmap",		NV_BLTIN|BLT_ENV,		bltin(vpath),
121#endif /* SHOPT_FS_3D */
122	"wait",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(wait),
123	"type",		NV_BLTIN|BLT_ENV,		bltin(whence),
124	"whence",	NV_BLTIN|BLT_ENV,		bltin(whence),
126#include SHOPT_CMDLIB_HDR
128	CMDLIST(basename)
129	CMDLIST(chmod)
130	CMDLIST(dirname)
131	CMDLIST(getconf)
132	CMDLIST(head)
133	CMDLIST(mkdir)
134	CMDLIST(logname)
135	CMDLIST(cat)
136	CMDLIST(cmp)
137	CMDLIST(cut)
138	CMDLIST(uname)
139	CMDLIST(wc)
140	CMDLIST(sync)
143	"__regress__",		NV_BLTIN|BLT_ENV,	bltin(__regress__),
145	"",		0, 0
149const char sh_set[] =
150"[a?Set the export attribute for each variable whose name does not "
151	"contain a \b.\b that you assign a value in the current shell "
152	"environment.]"
153"[b?The shell writes a message to standard error as soon it detects that "
154	"a background job completes rather than waiting until the next prompt.]"
155"[e?A simple command that has an non-zero exit status will cause the shell "
156	"to exit unless the simple command is:]{"
157	"[++?contained in an \b&&\b or \b||\b list.]"
158	"[++?the command immediately following \bif\b, \bwhile\b, or \buntil\b.]"
159	"[++?contained in the pipeline following \b!\b.]"
161"[f?Pathname expansion is disabled.]"
162"[h?Obsolete.  Causes each command whose name has the syntax of an "
163	"alias to become a tracked alias when it is first encountered.]"
164"[k?This is obsolete.  All arguments of the form \aname\a\b=\b\avalue\a "
165	"are removed and placed in the variable assignment list for "
166	"the command.  Ordinarily, variable assignments must precede "
167	"command arguments.]"
168"[m?When enabled, the shell runs background jobs in a separate process "
169	"group and displays a line upon completion.  This mode is enabled "
170	"by default for interactive shells on systems that support job "
171	"control.]"
172"[n?The shell reads commands and checks for syntax errors, but does "
173	"not execute the command.  Usually specified on command invocation.]"
174"[o]:?[option?If \aoption\a is not specified, the list of options and "
175	"their current settings will be written to standard output.  When "
176	"invoked with a \b+\b the options will be written in a format "
177	"that can be reinput to the shell to restore the settings. "
178	"This option can be repeated to enable/disable multiple options. "
179	"The value of \aoption\a must be one of the following:]{"
180		"[+allexport?Equivalent to \b-a\b.]"
181		"[+bgnice?Runs background jobs at lower priorities.]"
182		"[+braceexpand?Equivalent to \b-B\b.] "
183		"[+emacs?Enables/disables \bemacs\b editing mode.]"
184		"[+errexit?Equivalent to \b-e\b.]"
185		"[+globstar?Equivalent to \b-G\b.]"
186		"[+gmacs?Enables/disables \bgmacs\b editing mode.  \bgmacs\b "
187			"editing mode is the same as \bemacs\b editing mode "
188			"except for the handling of \b^T\b.]"
190		"[+hashall?Equivalent to \b-h\b and \b-o trackall\b. Available "
191		"in bash compatibility mode only.]"
192		"[+history?Enable command history. Available in bash "
193		"compatibility mode only. On by default in interactive "
194		"shells.]"
197		"[+histexpand?Equivalent to \b-H\b.]"
199		"[+ignoreeof?Prevents an interactive shell from exiting on "
200			"reading an end-of-file.]"
201		"[+keyword?Equivalent to \b-k\b.]"
202		"[+markdirs?A trailing \b/\b is appended to directories "
203			"resulting from pathname expansion.]"
204		"[+monitor?Equivalent to \b-m\b.]"
205		"[+multiline?Use multiple lines when editing lines that are "
206			"longer than the window width.]"
207		"[+noclobber?Equivalent to \b-C\b.]"
208		"[+noexec?Equivalent to \b-n\b.]"
209		"[+noglob?Equivalent to \b-f\b.]"
210		"[+nolog?This has no effect.  It is provided for backward "
211			"compatibility.]"
212		"[+notify?Equivalent to \b-b\b.]"
213		"[+nounset?Equivalent to \b-u\b.]"
215		"[+onecmd?Equivalent to \b-t\b. Available in bash compatibility "
216		"mode only.]"
217		"[+physical?Equivalent to \b-P\b. Available in bash "
218		"compatibility mode only.]"
219		"[+posix?Turn on POSIX compatibility. Available in bash "
220		"compatibility mode only. Bash in POSIX mode is not the "
221		"same as ksh.]"
223		"[+pipefail?A pipeline will not complete until all components "
224			"of the pipeline have completed, and the exit status "
225			"of the pipeline will be the value of the last "
226			"command to exit with non-zero exit status, or will "
227			"be zero if all commands return zero exit status.]"
228		"[+privileged?Equivalent to \b-p\b.]"
229		"[+showme?Simple commands preceded by a \b;\b will be traced "
230			"as if \b-x\b were enabled but not executed.]"
231		"[+trackall?Equivalent to \b-h\b.]"
232		"[+verbose?Equivalent to \b-v\b.]"
233		"[+vi?Enables/disables \bvi\b editing mode.]"
234		"[+viraw?Does not use canonical input mode when using \bvi\b "
235			"edit mode.]"
236		"[+xtrace?Equivalent to \b-x\b.]"
238"[p?Privileged mode.  Disabling \b-p\b sets the effective user id to the "
239	"real user id, and the effective group id to the real group id.  "
240	"Enabling \b-p\b restores the effective user and group ids to their "
241	"values when the shell was invoked.  The \b-p\b option is on "
242	"whenever the real and effective user id is not equal or the "
243	"real and effective group id is not equal.  User profiles are "
244	"not processed when \b-p\b is enabled.]"
245"[r?restricted.  Enables restricted shell.  This option cannot be unset once "
246	"enabled.]"
247"[t?Obsolete.  The shell reads one command and then exits.]"
248"[u?If enabled, the shell displays an error message when it tries to expand "
249	"a variable that is unset.]"
250"[v?Verbose.  The shell displays its input onto standard error as it "
251	"reads it.]"
252"[x?Execution trace.  The shell will display each command after all "
253	"expansion and before execution preceded by the expanded value "
254	"of the \bPS4\b parameter.]"
256	"\fbash1\f"
259"[B?Enable {...} group expansion. On by default.]"
261"[C?Prevents existing regular files from being overwritten using the \b>\b "
262	"redirection operator.  The \b>|\b redirection overrides this "
263	"\bnoclobber\b option.]"
264"[G?Causes \b**\b by itself to also match all sub-directories during pathname "
265	"expansion.]"
267   "[H?Enable \b!\b-style history expansion similar to \bcsh\b.]"
271const char sh_optbreak[] =
272"[-1c?\n@(#)$Id: break (AT&T Research) 1999-04-07 $\n]"
274"[+NAME?break - break out of loop ]"
275"[+DESCRIPTION?\bbreak\b is a shell special built-in that exits the "
276	"smallest enclosing \bfor\b, \bselect\b, \bwhile\b, or \buntil\b loop, "
277	"or the \an\a-th enclosing loop if \an\a is specified.  "
278	"Execution continues at the command following the loop(s).]"
279"[+?If \an\a is given, it must be a positive integer >= 1. If \an\a "
280	"is larger than the number of enclosing loops, the last enclosing "
281	"loop will be exited.]"
285"[+EXIT STATUS?0]"
286"[+SEE ALSO?\bcontinue\b(1), \breturn\b(1)]"
289const char sh_optcont[] =
290"[-1c?\n@(#)$Id: continue (AT&T Research) 1999-04-07 $\n]"
292"[+NAME?continue - continue execution at top of the loop]"
293"[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues "
294	"execution at the top of smallest enclosing enclosing \bfor\b, "
295	"\bselect\b, \bwhile\b, or \buntil\b loop, if any; or the top of "
296	"the \an\a-th enclosing loop if \an\a is specified.]"
297"[+?If \an\a is given, it must be a positive integer >= 1. If \an\a "
298	"is larger than the number of enclosing loops, the last enclosing "
299	" loop will be used.]"
304"[+SEE ALSO?\bbreak\b(1)]"
307const char sh_optalarm[]	= "r [varname seconds]";
308const char sh_optalias[] =
309"[-1c?\n@(#)$Id: alias (AT&T Research) 1999-07-07 $\n]"
311"[+NAME?alias - define or display aliases]"
312"[+DESCRIPTION?\balias\b creates or redefines alias definitions "
313	"or writes the existing alias definitions to standard output.  "
314	"An alias definitions provides a string value that will replace "
315	"a command name when the command is read.  Alias names can "
316	"contain any printable character which is not special to the shell.  "
317	"If an alias value ends in a space or tab, then the word "
318	"following the command name the alias replaces is also checked "
319	"to see whether it is an alias.]"
320"[+?If no \aname\as are specified then the names and values of all "
321	"aliases are written to standard output.  Otherwise, for "
322	"each \aname\a that is specified, and \b=\b\avalue\a  is not "
323	"specified, the current value of the alias corresponding to "
324	"\aname\a is written to standard output.  If \b=\b\avalue\a is "
325	"specified, the alias \aname\a will be created or redefined.]"
326"[+?\balias\b is built-in to the shell as a declaration command so that "
327	"field splitting and pathname expansion are not performed on "
328	"the arguments.  Tilde expansion occurs on \avalue\a.  An alias "
329	"definition only affects scripts read by the current shell "
330	"environment.  It does not effect scripts run by this shell.]"
331"[p?Causes the output to be in the form of alias commands that can be used "
332	"as input to the shell to recreate the current aliases.]"
333"[t?Used for tracked aliases.  These are aliases that connect a "
334	"command name to the pathname of the command and are reset "
335	"when the \bPATH\b variable is unset.  The tracked aliases feature is "
336	"now obsolete.]"
337"[x?Ignored, this option is obsolete.]"
341"[+EXIT STATUS?]{"
342        "[+0?Successful completion.]"
343        "[+>0?One or more \aname\a operands did not have an alias "
344		"definition, or an error occurred.]"
347"[+SEE ALSO?\bsh\b(1), \bunalias\b(1)]"
350const char sh_optbuiltin[] =
351"[-1c?\n@(#)$Id: builtin (AT&T Research) 1999-07-10 $\n]"
353"[+NAME?builtin - add, delete, or display shell built-ins]"
354"[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display "
355    "built-in commands in the current shell environment. A built-in command "
356    "executes in the current shell process and can have side effects in the "
357    "current shell. On most systems, the invocation time for built-in "
358    "commands is one or two orders of magnitude less than commands that "
359    "create a separate process.]"
360"[+?For each \apathname\a specified, the basename of the pathname "
361    "determines the name of the built-in. For each basename, the shell looks "
362    "for a C level function in the current shell whose name is determined by "
363    "prepending \bb_\b to the built-in name. If \apathname\a contains a "
364    "\b/\b, then the built-in is bound to this pathname. A built-in bound to "
365    "a pathname will only be executed if \apathname\a is the first "
366    "executable found during a path search. Otherwise, built-ins are found "
367    "prior to performing the path search.]"
368"[+?If no \apathname\a operands are specified, then \bbuiltin\b displays "
369    "the current list of built-ins, or just the special built-ins if \b-s\b "
370    "is specified, on standard output. The full pathname for built-ins that "
371    "are bound to pathnames are displayed.]"
372"[+?Libraries containing built-ins can be specified with the \b-f\b "
373    "option. If the library contains a function named \blib_init\b(), this "
374    "function will be invoked with argument \b0\b when the library is "
375    "loaded. The \blib_init\b() function can load built-ins by invoking an "
376    "appropriate C level function. In this case there is no restriction on "
377    "the C level function name.]"
378"[+?The C level function will be invoked with three arguments. The first "
379    "two are the same as \bmain\b() and the third one is a pointer.]"
380"[+?\bbuiltin\b cannot be invoked from a restricted shell.]"
381"[d?Deletes each of the specified built-ins. Special built-ins cannot be "
382    "deleted.]"
383"[f]:[lib?On systems with dynamic linking, \alib\a names a shared "
384    "library to load and search for built-ins. Libraries are search for in "
385    "\b$PATH\b and system dependent library directories. The system "
386    "dependent shared library prefix and/or suffix may be omitted. Once a "
387    "library is loaded, its symbols become available for the current and "
388    "subsequent invocations of \bbuiltin\b. Multiple libraries can be "
389    "specified with separate invocations of \bbuiltin\b. Libraries are "
390    "searched in the reverse order in which they are specified.]"
391"[s?Display only the special built-ins.]"
393"\n[pathname ...]\n"
395"[+EXIT STATUS?]{"
396	"[+0?All \apathname\a operands and \b-f\b options processed "
397	"successfully.]"
398	"[+>0?An error occurred.]"
400"[+SEE ALSO?\bwhence\b(1)]"
403const char sh_optcd[] =
404"[-1c?\n@(#)$Id: cd (AT&T Research) 1999-06-05 $\n]"
406"[+NAME?cd - change working directory ]"
407"[+DESCRIPTION?\bcd\b changes the current working directory of the "
408	"current shell environment.]"
409"[+?In the first form with one operand, if \adirectory\a begins with "
410	"\b/\b, or if the first component is \b.\b or \b..\b, the "
411	"directory will be changed to this directory.  If directory is \b-\b, "
412	"the directory will be changed to the last directory visited.  "
413	"Otherwise, if the \bCDPATH\b environment variable is set, \bcd\b "
414	"searches for \adirectory\a relative to each directory named in "
415	"the colon separated list of directories defined by \bCDPATH\b.  "
416	"If \bCDPATH\b not set, \bcd\b changes to the directory specified "
417	"by \adirectory\a.]"
418"[+?In the second form, the first occurrence of the string \aold\a "
419	"contained in the pathname of the present working directory "
420	"is replaced by the string \anew\a and the resulting string "
421	"is used as the directory to which to change.]"
422"[+?When invoked without operands and when the \bHOME\b environment "
423	"variable is set to a nonempty value,  the directory named by "
424	"the \bHOME\b environment variable will be used.  If \bHOME\b "
425	"is empty or unset, \bcd\b will fail.]"
426"[+?When \bcd\b is successful, the \bPWD\b environment variable will be set "
427	"to the name of an absolute pathname that does not contain any "
428	"\b..\b components corresponding to the new directory.  The "
429	"environment variable \bOLDPWD\b will be set to the previous "
430	"value of \bPWD\b.  If the new directory is found by searching "
431	"the directories named by \bCDPATH\b, or if \adirectory\a is \b-\b, "
432	"or if the two operand form is used, the new value of \bPWD\b will be "
433	"written to standard output.]"
434"[+?If both \b-L\b and \b-P\b are specified, the last one specified will "
435	"be used.  If neither \b-P\b or \b-L\b is specified then the "
436	"behavior will be determined by the \bgetconf\b parameter "
437	"\bPATH_RESOLVE\b.  If \bPATH_RESOLVE\b is \bphysical\b, "
438	"then the behavior will be as if \b-P\b were specified.  Otherwise, "
439	"the behavior will be as if  \b-L\b were specified.]"
440"[L?Handle each pathname component \b..\b in a logical fashion by moving "
441	"up one level by name in the present working directory.]"
442"[P?The present working directory is first converted to an absolute pathname "
443	"that does not contain symbolic link components and symbolic name "
444	"components are expanded in the resulting directory name.]"
447"old new\n"
449"[+EXIT STATUS?]{"
450	"[+0?Directory successfully changed.]"
451	"[+>0?An error occurred.]"
453"[+SEE ALSO?\bpwd\b(1), \bgetconf\b(1)]"
456const char sh_optcommand[] =
457"[-1c?\n@(#)$Id: command (AT&T Research) 2003-08-01 $\n]"
459"[+NAME?command - execute a simple command]"
460"[+DESCRIPTION?Without \b-v\b or \b-V\b,  \bcommand\b executes \acommand\a "
461	"with arguments given by \aarg\a, suppressing the shell function lookup "
462	"that normally occurs.  In addition, if \acommand\a is a special "
463	"built-in command, then the special properties are removed so that "
464	"failures will not cause the script that executes it to terminate.]"
465"[+?With the \b-v\b or \b-V\b options, \bcommand\b is equivalent to the "
466	"\bwhence\b(1) command.]"
467"[p?Causes a default path to be searched rather than the one defined by the "
468	"value of \bPATH\b.]"
469"[v?Equivalent to \bwhence\b \acommand\a [\aarg\a ...]].]"
470"[x?If \acommand\a fails because there are too many \aarg\as, it will be "
471	"invoked multiple times with a subset of the arguments on each "
472	"invocation.  Arguments that occur prior to the first word that expand "
473	"to multiple arguments and arguments that occur after the last word "
474	"that expands to multiple arguments will be passed on each invocation. "
475	"The exit status will be the maximum invocation exit status.]"
476"[V?Equivalent to \bwhence \b-v\b \acommand\a [\aarg\a ...]].]"
478"\n[command [arg ...]]\n"
480"[+EXIT STATUS?If \acommand\a is invoked, the exit status of \bcommand\b "
481	"will be that of \acommand\a.  Otherwise, it will be one of "
482	"the following:]{"
483	"[+0?\bcommand\b completed successfully.]"
484	"[+>0?\b-v\b or \b-V\b has been specified and an error occurred.]"
485	"[+126?\acommand\a was found but could not be invoked.]"
486	"[+127?\acommand\a could not be found.]"
489"[+SEE ALSO?\bwhence\b(1), \bgetconf\b(1)]"
492const char sh_optdot[]	 =
493"[-1c?@(#)$Id: \b.\b (AT&T Research) 2000-04-02 $\n]"
495"[+NAME?\b.\b - execute commands in the current environment]"
496"[+DESCRIPTION?\b.\b is a special built-in command that executes commands "
497	"from a function or a file in the current environment.]"
498"[+?If \aname\a refers to a function defined with the \bfunction\b \aname\a "
499	"syntax, the function executes in the current environment as "
500	"if it had been defined with the \aname\a\b()\b syntax so that "
501	"there is no scoping.  Otherwise, commands from the file defined "
502	"by \aname\a are executed in the current environment.  Note that "
503	"the complete script is read before it begins to execute so that "
504	"any aliases defined in this script will not take effect until "
505	"the script completes execution.]"
506"[+?When \aname\a refers to a file, the \bPATH\b variable is searched "
507	"for the file containing commands.  In this case execute permission "
508	"is not required for \aname\a.]"
509"[+?If any \aarg\as are specified, these become the positional parameters "
510	"for the duration of the function or script and are restored "
511	"upon completion.]"
513"\n name [arg ...]\n"
515"[+EXIT STATUS?If \aname\a is found, then the exit status is that "
516	"of the last command executed.  Otherwise, since this is a special "
517	"built-in, an error will cause a non-interactive shell to exit with "
518	"a non-zero exit status.  An interactive shell returns a non-zero exit "
519	"status to indicate an error.]"
521"[+SEE ALSO?\bcommand\b(1), \bksh\b(1)]"
524#ifndef ECHOPRINT
525    const char sh_optecho[]	= " [-n] [arg...]";
526#endif /* !ECHOPRINT */
528const char sh_opteval[] =
529"[-1c?\n@(#)$Id: eval (AT&T Research) 1999-07-07 $\n]"
531"[+NAME?eval - create a shell command and process it]"
532"[+DESCRIPTION?\beval\b is a shell special built-in command that constructs "
533	"a command by concatenating the \aarg\as together, separating each "
534	"with a space.  The resulting string is then taken as input to "
535	"the shell and evaluated in the current environment.  Note that "
536	"command words are expanded twice; once to construct \aarg\a, and "
537	"again when the shell executes the constructed command.]"
538"[+?It is not an error if \aarg\a is not given.]"
542"[+EXIT STATUS?If \aarg\a is not specified, the exit status is \b0\b.  "
543	"Otherwise, it is the exit status of the command defined by the "
544	"\aarg\a operands.]"
545"[+SEE ALSO?\bexec\b(1), \btrap\b(1), \b.\b(1)]"
548const char sh_optexec[] =
549"[-1c?\n@(#)$Id: exec (AT&T Research) 1999-07-10 $\n]"
551"[+NAME?exec - execute command, open/close and duplicate file descriptors]"
552"[+DESCRIPTION?\bexec\b is a special built-in command that can be used to "
553	"manipulate file descriptors or to replace the current shell "
554	"with a new command.]"
555"[+?If \acommand\a is specified, then the current shell process will be "
556	"replaced by \acommand\a rather than running \acommand\a and waiting "
557	"for it to complete.  Note that there is no need to use "
558	"\bexec\b to enhance performance since the shell implicitly "
559	"uses the exec mechanism internally whenever possible.]"
560"[+?If no operands are specified, \bexec\b can be used to open or "
561	"close files, or to manipulate file descriptors from \b0\b to "
562	"\b9\b in the current shell environment using the standard "
563	"redirection mechanism available with all commands.  The "
564	"close-on-exec flags will be set on file descriptor numbers "
565	"greater than \b2\b that are opened this way so that they "
566	"will be closed when another program is invoked.]"
567"[+?Because \bexec\b is a special command, any failure will cause the "
568	"script that invokes it to exit.  This can be prevented by "
569	"invoking \bexec\b from the \bcommand\b utility.]"
570"[+?\bexec\b cannot be invoked from a restricted shell to create "
571	"files or to open a file for writing or appending.]"
572"[c?Clear all environment variables before executions except variable "
573	"assignments that are part of the current \bexec\b command.]"
574"[a]:[name?\bargv[0]]\b will be set to \aname\a for \acommand\a]"
576"\n[command [arg ...]]\n"
578"[+EXIT STATUS?If \acommand\a is specified, \bexec\b does not return.  "
579	"Otherwise, the exit status is one of the following:]{"
580	"[+0?All I/O redirections were successful.]"
581	"[+>0?An error occurred.]"
583"[+SEE ALSO?\bcommand\b(1), \beval\b(1)]"
587const char sh_optexit[] =
588"[-1c?\n@(#)$Id: exit (AT&T Research) 1999-07-07 $\n]"
590"[+NAME?exit - exit the current shell]"
591"[+DESCRIPTION?\bexit\b is shell special built-in that causes the "
592	"shell that invokes it to exit.  Before exiting the shell, if the "
593	"\bEXIT\b trap is set it will be invoked.]"
594"[+?If \an\a is given, it will be used to set the exit status.]"
598"[+EXIT STATUS?If \an\a is specified, the exit status is the least significant "
599	"eight bits of the value of \an\a.  Otherwise, the exit status is the "
600	"exit status of preceding command.  When invoked inside a trap, the "
601	"preceding command means the command that invoked the trap.]"
602"[+SEE ALSO?\bbreak\b(1), \breturn\b(1)]"
605const char sh_optexport[] =
606"[-1c?\n@(#)$Id: export (AT&T Research) 1999-07-07 $\n]"
608"[+NAME?export - set export attribute on variables]"
609"[+DESCRIPTION?\bexport\b sets the export attribute on each of "
610	"the variables specified by \aname\a which causes them "
611	"to be in the environment of subsequently executed commands.  "
612	"If \b=\b\avalue\a is specified, the variable \aname\a is "
613	"set to \avalue\a.]"
614"[+?If no \aname\as are specified then the names and values of all "
615	"exported variables are written to standard output.]"
616"[+?\bexport\b is built-in to the shell as a declaration command so that "
617	"field splitting and pathname expansion are not performed on "
618	"the arguments.  Tilde expansion occurs on \avalue\a.]"
619"[p?Causes the output to be in the form of \bexport\b commands that can be "
620	"used as input to the shell to recreate the current exports.]"
624"[+EXIT STATUS?]{"
625        "[+0?Successful completion.]"
626        "[+>0?An error occurred.]"
629"[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]"
632const char sh_optgetopts[] =
633":[-1c?\n@(#)$Id: getopts (AT&T Research) 2005-01-01 $\n]"
634"[-author?Glenn Fowler <gsf@research.att.com>]"
636"[+NAME?\f?\f - parse utility options]"
637"[+DESCRIPTION?The \bgetopts\b utility can be used to retrieve options and "
638  "arguments from a list of arguments given by \aargs\a or the positional "
639  "parameters if \aargs\a is omitted.  It can also generate usage messages "
640  "and a man page for the command based on the information in \aoptstring\a.]"
641"[+?Each time it is invoked, the \bgetopts\b utility places the value "
642  "of the next option in the shell variable specified by the \aname\a "
643  "operand and the index of the next argument to be processed in the "
644  "shell variable \bOPTIND\b.  When the shell is invoked \bOPTIND\b "
645  "is initialized to \b1\b.  When an option requires or permits an option "
646  "argument, \bgetopts\b places the option argument in the shell "
647  "variable \bOPTARG\b. Otherwise \bOPTARG\b is set to \b1\b when the "
648  "option is set and \b0\b when the option is unset.]"
649"[+?The \aoptstring\a string consists of alpha-numeric characters, "
650  "the special characters +, -, ?, :, and <space>, or character groups "
651  "enclosed in [...]].  Character groups may be nested in {...}. "
652  "Outside of a [...]] group, a single new-line followed by zero or "
653  "more blanks is ignored.  One or more blank lines separate the "
654  "options from the command argument synopsis.]"
655"[+?Each [...]] group consists of an optional label, "
656  "optional attributes separated by :, and an "
657  "optional description string following ?.  The characters from the ? "
658  "to the end of the next ]] are ignored for option parsing and short "
659  "usage messages.  They are used for generating verbose help or man pages. "
660  "The : character may not appear in the label. "
661  "The ? character must be specified as ?? in the label and the ]] character "
662  "must be specified as ]]]] in the description string. "
663  "Text between two \\b (backspace) characters indicates "
664  "that the text should be emboldened when displayed. "
665  "Text between two \\a (bell) characters indicates that the text should "
666  "be emphasized or italicized when displayed. "
667  "Text between two \\v (vertical tab) characters indicates "
668  "that the text should displayed in a fixed width font. "
669  "Text between two \\f (formfeed) characters will be replaced by the "
670    "output from the shell function whose name is that of the enclosed text.]"
671"[+?All output from this interface is written to the standard error.]"
672"[+?There are several group types:]{"
673  "[+1.?A group of the form "
674    "[-[\aversion\a]][\aflag\a[\anumber\a]]]]...[?\atext\a]]]] "
675    "appearing as the first group enables the extended interface. \aversion\a "
676    "specifies the interface version, currently \b1\b. The latest version is "
677    "assumed if \aversion\a is omitted. Future enhancements "
678    "may increment \aversion\a, but all versions will be supported. \atext\a "
679    "typically specifies an SCCS or CVS identification string. Zero or more "
680    "\aflags\a with optional \anumber\a values may be specified to control "
681    "option parsing. "
682    "The flags are:]{"
683      "[++?Arguments beginning with + are considered options.]"
684      "[+c?Cache this \aoptstring\a for multiple passes. Used to optimize "
685	"builtins that may be called many times within the same process.]"
686      "[+i?Ignore this \aoptstring\a when generating help. Used when "
687	"combining \aoptstring\a values from multiple passes.]"
688      "[+l?Display only \alongname\a options in help messages.]"
689      "[+n?Associate -\anumber\a and +\anumber\a options with the first "
690        "option with numeric arguments.]"
691      "[+o?The \b-\b option character prefix is optional (supports "
692        "obsolete \bps\b(1) option syntax.)]"
693      "[+p?\anumber\a specifies the number of \b-\b characters that must "
694	"prefix long option names. The default is \b2\b; \b0\b, \b1\b or "
695	"\b2\b are accepted (e.g., \bp0\b for \bdd\b(1) and \bp1\b for "
696	"\bfind\b(1).)]"
697      "[+s?\anumber\a specifies the \b--??man\b section number, "
698        "\b1\b by default.]"
699  "}"
700  "[+2.?An option specification of the form "
701    "[\aoption\a[!]][=\anumber\a]][:\alongname\a]][?\atext\a]]]]. In this "
702    "case the first field is the option character; this is the value returned "
703    "in the \aname\a operand when the option is matched.  If there is no "
704    "option character then a two or more digit number should be specified. "
705    "This number will be returned as the value of the \aname\a operand if the "
706    "long option is matched. If \aoption\a is followed by \b!\b then the option "
707    "character sense is the inverse of the longname sense. For options that do "
708    "not take values \bOPTARG\b will be set to \b0\b for \b!\b inverted option "
709    "characters and \b1\b otherwise. =\anumber\a optionally specifies a number to "
710    "be returned in the \aname\a operand instead of the option character. A "
711    "longname is specified by \b--\b\alongname\a and is matched by the shortest "
712    "non-ambiguous prefix of all long options. * in the \alongname\a field "
713    "indicates that only characters up to that point need to match, provided "
714    "any additional characters match exactly. The enclosing [ and ]] can be "
715    "omitted for an option that does not have a longname or descriptive text.]"
716  "[+3.?An option argument specification. "
717    "Options that take arguments can be followed by : (string value) or # "
718    "(numeric value) and an option argument specification.  An option argument "
719    "specification consists of the option argument name as field 1. "
720    "The remaining \b:\b separated fields are a type name and zero or more of "
721    "the special attribute words \blistof\b, \boneof\b, and \bignorecase\b. "
722    "A default option value may be specified in the final field as "
723    "\b:=\b\adefault\a. The option argument specification may be followed "
724    "by a list of option value descriptions enclosed in braces. "
725    "A long option that takes an argument is specified as "
726    "\b--\b\alongname\a=\avalue\a. If the : or # is followed by ? then the "
727    "option argument is optional. If only the option character form is "
728    "specified then the optional argument value is not set if the next "
729    "argument starts with - or +.]"
730  "[+4.?A option value description.]"
731  "[+5.?A argument specification. A list of valid option argument values "
732    "can be specified by enclosing them inside a {...} following "
733    "the option argument specification.  Each of the permitted "
734    "values can be specified with a [...]] containing the "
735    "value followed by a description.]"
736  "[+6.?A group of the form [+\\n...]] will display the characters "
737    "representing ... in fixed with font without adding line breaks.]"
738  "[+7.?A group of the form [+\aname\a?\atext\a]] specifies a section "
739    "\aname\a with descriptive \atext\a. If \aname\a is omitted then "
740    "\atext\a is placed in a new paragraph.]"
741  "[+8.?A group of the form [-\aname\a?\atext\a]] specifies entries "
742    "for the \bIMPLEMENTATION\b section.]"
744"[+?A leading : character in \aoptstring\a "
745  "affects the way errors are handled.  If an option character or longname "
746  "argument not specified in \aoptstring\a is encountered when processing "
747  "options, the shell variable whose name is \aname\a will be set to the ? "
748  "character.  The shell variable \bOPTARG\b will be set to "
749  "the character found.  If an option argument is missing or has an invalid "
750  "value, then \aname\a will be set to the : character and the shell variable "
751  "\bOPTARG\b will be set to the option character found. "
752  "Without the leading :, \aname\a will be set to the ? character, \bOPTARG\b "
753  "will be unset, and an error message will be written to standard error "
754  "when errors are encountered.]"
755"[+?A leading + character or a + following a leading : in \aoptstring\a "
756  "specifies that arguments beginning with + will also be considered options.]"
757"[+?The end of options occurs when:]{"
758	"[+1.?The special argument \b--\b is encountered.]"
759	"[+2.?An argument that does not begin with a \b-\b is encountered.]"
760	"[+3.?A help argument is specified.]"
761	"[+4.?An error is encountered.]"
763"[+?If \bOPTIND\b is set to the value \b1\b, a new set of arguments "
764  "can be used.]"
765"[+?\bgetopts\b can also be used to generate help messages containing command "
766  "usage and detailed descriptions.  Specify \aargs\a as:]"
767"{ "
768	"[+-???To generate a usage synopsis.]"
769	"[+--?????To generate a verbose usage message.]"
770	"[+--????man?To generate a formatted man page.]"
771	"[+--????api?To generate an easy to parse usage message.]"
772	"[+--????html?To generate a man page in \bhtml\b format.]"
773	"[+--????nroff?To generate a man page in \bnroff\b format.]"
774	"[+--????usage?List the current \aoptstring\a.]"
775	"[+--??????\aname\a?List \bversion=\b\an\a, \an\a>0, "
776	  "if the option \aname\a is recognized by \bgetopts\b.]"
778"[+?When the end of options is encountered, \bgetopts\b exits with a "
779  "non-zero return value and the variable \bOPTIND\b is set to the "
780  "index of the first non-option argument.]"
781"a:[name?Use \aname\a instead of the command name in usage messages.]"
783"\nopstring name [args...]\n"
785"[+EXIT STATUS]{"
786	"[+0?An option specified was found.]"
787	"[+1?An end of options was encountered.]"
788	"[+2?A usage or information message was generated.]"
792const char sh_optbg[] =
793"[-1c?@(#)$Id: bg (AT&T Research) 2000-04-02 $\n]"
795"[+NAME?bg - resume jobs in the background]"
796"[+DESCRIPTION?\bbg\b places the given \ajob\as into the background "
797	"and sends them a \bCONT\b signal to start them running.]"
798"[+?If \ajob\a is omitted, the most recently started or stopped "
799	"background job is resumed or continued in the background.]"
800"[+?Each \ajob\a can be specified as one of the following:]{"
801	"[+\anumber\a?\anumber\a refers to a process id.]"
802	"[+-\anumber\a?\anumber\a refers to a process group id.]"
803	"[+%\anumber\a?\anumber\a refer to a job number.]"
804	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
805	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
806	"[+%+ \bor\b %%?Refers to the current job.]"
807	"[+%-?Refers to the previous job.]"
810"\n[job ...]\n"
812"[+EXIT STATUS?]{"
813	"[+0?If all background jobs are started.]"
814	"[+>0?If one more jobs does not exist or there are no background "
815		"jobs.]"
818"[+SEE ALSO?\bwait\b(1), \bfg\b(1), \bdisown\b(1), \bjobs\b(1)]"
821const char sh_optfg[] =
822"[-1c?@(#)$Id: fg (AT&T Research) 2000-04-02 $\n]"
824"[+NAME?fg - move jobs to the foreground]"
825"[+DESCRIPTION?\bfg\b places the given \ajob\as into the foreground "
826	"in sequence and sends them a \bCONT\b signal to start each running.]"
827"[+?If \ajob\a is omitted, the most recently started or stopped "
828	"background job is moved to the foreground.]"
829"[+?Each \ajob\a can be specified as one of the following:]{"
830	"[+\anumber\a?\anumber\a refers to a process id.]"
831	"[+-\anumber\a?\anumber\a refers to a process group id.]"
832	"[+%\anumber\a?\anumber\a refer to a job number.]"
833	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
834	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
835	"[+%+ \bor\b %%?Refers to the current job.]"
836	"[+%-?Refers to the previous job.]"
839"\n[job ...]\n"
841"[+EXIT STATUS?If \bfg\b brings one or more jobs into the foreground, "
842	"the exit status of \bfg\b  will be that of the last \ajob\a.  "
843	"If one or more jobs does not exist or has completed, \bfg\b will "
844	"return a non-zero exit status.]"
847"[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]"
850const char sh_optdisown[] =
851"[-1c?@(#)$Id: disown (AT&T Research) 2000-04-02 $\n]"
853"[+NAME?disown - disassociate a job with the current shell]"
854"[+DESCRIPTION?\bdisown\b prevents the current shell from sending "
855	"a \bHUP\b signal to each of the given \ajob\as when "
856	"the current shell terminates a login session.]"
857"[+?If \ajob\a is omitted, the most recently started or stopped "
858	"background job is used.]"
859"[+?Each \ajob\a can be specified as one of the following:]{"
860	"[+\anumber\a?\anumber\a refers to a process id.]"
861	"[+-\anumber\a?\anumber\a refers to a process group id.]"
862	"[+%\anumber\a?\anumber\a refer to a job number.]"
863	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
864	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
865	"[+%+ \bor\b %%?Refers to the current job.]"
866	"[+%-?Refers to the previous job.]"
869"\n[job ...]\n"
871"[+EXIT STATUS?]{"
872	"[+0?If all jobs are successfully disowned.]"
873	"[+>0?If one more \ajob\as does not exist.]"
876"[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]"
879const char sh_optjobs[] =
880"[-1c?@(#)$Id: jobs (AT&T Research) 2000-04-02 $\n]"
882"[+NAME?jobs - display status of jobs]"
883"[+DESCRIPTION?\bjobs\b displays information about specified \ajob\as "
884	"that were started by the current shell environment on standard "
885	"output.  The information contains the job number enclosed in "
886	"[...]], the status, and the command line that started the job.]"
887"[+?If \ajob\a is omitted, \bjobs\b displays the status of all stopped jobs, "
888	"background jobs, and all jobs whose status has changed since last "
889	"reported by the shell.]"
890"[+?When \bjobs\b reports the termination status of a job, the "
891	"shell removes the jobs from the list of known jobs in "
892	"the current shell environment.]"
893"[+?Each \ajob\a can be specified as one of the following:]{"
894	"[+\anumber\a?\anumber\a refers to a process id.]"
895	"[+-\anumber\a?\anumber\a refers to a process group id.]"
896	"[+%\anumber\a?\anumber\a refer to a job number.]"
897	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
898	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
899	"[+%+ \bor\b %%?Refers to the current job.]"
900	"[+%-?Refers to the previous job.]"
902"[l?\bjobs\b displays process id's after the job number in addition "
903	"to the usual information]"
904"[n?Only the jobs whose status has changed since the last prompt "
905	"is displayed.]"
906"[p?The process group leader id's for the specified jobs are displayed.]"
908"\n[job ...]\n"
910"[+EXIT STATUS?]{"
911	"[+0?The information for each job is written to standard output.]"
912	"[+>0?One or more jobs does not exist.]"
915"[+SEE ALSO?\bwait\b(1), \bps\b(1), \bfg\b(1), \bbg\b(1)]"
918const char sh_opthist[]	=
919"[-1cn?@(#)$Id: hist (AT&T Research) 2000-04-02 $\n]"
921"[+NAME?\f?\f - process command history list]"
922"[+DESCRIPTION?\b\f?\f\b lists, edits, or re-executes, commands  "
923	"previously entered into the current shell environment.]"
924"[+?The command history list references commands by number. The first number "
925	"in the list is selected arbitrarily.  The relationship of a number "
926	"to its command does not change during a login session.  When the "
927	"number reaches 32767 the number wraps around to 1 but "
928	"maintains the ordering.]"
929"[+?When commands are edited (when the \b-l\b option is not specified), the "
930	"resulting lines will be entered at the end of the history list and "
931	"then reexecuted by the current shell.  The \b\f?\f\b command that "
932	"caused the editing will not be entered into the history list.  If the "
933	"editor returns a non-zero exit status, this will suppress the "
934	"entry into the history list and the command reexecution.  Command "
935	"line variable assignments and redirections affect both the \f?\f "
936	"command and the commands that are reexecuted.]"
937"[+?\afirst\a and \alast\a define the range of commands. \afirst\a and "
938		"\alast\a can be one of the following:]{"
939		"[+\anumber\a?A positive number representing a command "
940			"number.  A \b+\b sign can precede \anumber\a.]"
941		"[+-\anumber\a?A negative number representing a command "
942			"that was executed \anumber\a commands previously. "
943			"For example, \b-1\b is the previous command.]"
944		"[+\astring\a?\astring\a indicates the most recently "
945			"entered command that begins with \astring\a. "
946			"\astring\a should not contain an \b=\b.]"
947	"}"
948"[+?If \afirst\a is omitted, the previous command is used, unless \b-l\b "
949	"is specified, in which case it will default to \b-16\b and \alast\a "
950	"will default to \b-1\b.]"
951"[+?If \afirst\a is specified and \alast\a is omitted, then \alast\a will "
952	"default to \afirst\a unless \b-l\b is specified in which case "
953	"it will default to \b-1\b.]"
954"[+?If no editor is specified, then the editor specfied by the \bHISTEDIT\b "
955	"variable will be used if set, or the \bFCEDIT\b variable will be "
956	"used if set, otherwise, \bed\b will be used.]"
957"[e]:[editor?\aeditor\a specifies the editor to use to edit the history "
958	"command.   A value of \b-\b for \aeditor\a is equivalent to "
959	"specifiying the \b-s\b option.]"
960"[l?List the commands rather than editing and reexecuting them.]"
961"[N]#[num?Start at \anum\a commands back.]"
962"[n?Suppress the command numbers when the commands are listed.]"
964"[p?Writes the result of history expansion for each operand to standard "
965	"output.  All other options are ignored.]"
967"[r?Reverse the order of the commands.]"
968"[s?Reexecute the command without invoking an editor.  In this case "
969	"an operand of the form \aold\a\b=\b\anew\a can be specified "
970	"to change the first occurrence of the string \aold\a in the "
971	"command to \anew\a before reexecuting the command.]"
974"\n[first [last] ]\n"
976"[+EXIT STATUS?If a command is reexecuted, the exit status is that of "
977	"the command that gets reexecuted.  Otherwise, it is one of the "
978	"following:]{"
979	"[+0?Successfully completion of the listing.]"
980	"[+>0?An error occurred.]"
983"[+SEE ALSO?\bksh\b(1), \bsh\b(1), \bed\b(1)]"
986const char sh_optkill[]	 =
987"[-1c?\n@(#)$Id: kill (AT&T Research) 1999-06-17 $\n]"
989"[+NAME?kill - terminate or signal process]"
990"[+DESCRIPTION?With the first form in which \b-l\b is not specified, "
991	"\bkill\b sends a signal to one or more processes specified by "
992	"\ajob\a.  This normally terminates the processes unless the signal "
993	"is being caught or ignored.]"
994"[+?A \ajob\a can be specified as one of the following:]{"
995	"[+\anumber\a?\anumber\a refers to a process id.]"
996	"[+-\anumber\a?\anumber\a refers to a process group id.]"
997	"[+%\anumber\a?\anumber\a refer to a job number.]"
998	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
999	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
1000	"[+%+ \bor\b %%?Refers to the current job.]"
1001	"[+%-?Refers to the previous job.]"
1003"[+?If the signal is not specified with either the \b-n\b or the \b-s\b  "
1004	"option, the \bSIGTERM\b signal is used.]"
1005"[+?If \b-l\b is specified, and no \aarg\a is specified, then \bkill\b "
1006	"writes the list of signals to standard output.  Otherwise, \aarg\a "
1007	"can be either a signal name, or a number representing either a "
1008	"signal number or exit status for a process that was terminated "
1009	"due to a signal.  If a name is given the corresponding signal "
1010	"number will be written to standard output.  If a number is given "
1011	"the corresponding signal name will be written to standard output.]"
1012"[l?List signal names or signal numbers rather than sending signals as "
1013	"described above.  "
1014	"The \b-n\b and \b-s\b options cannot be specified.]"
1015"[n]#[signum?Specify a signal number to send.  Signal numbers are not "
1016	"portable across platforms, except for the following:]{"
1017		"[+0?No signal]"
1018		"[+1?\bHUP\b]"
1019		"[+2?\bINT\b]"
1020		"[+3?\bQUIT\b]"
1021		"[+6?\bABRT\b]"
1022		"[+9?\bKILL\b]"
1023		"[+14?\bALRM\b]"
1024		"[+15?\bTERM\b]"
1025	"}"
1026"[s]:[signame?Specify a signal name to send.  The signal names are derived "
1027	"from their names in \b<signal.h>\b without the \bSIG\b prefix and "
1028	"are case insensitive.  \bkill -l\b will generate the list of "
1029	"signals on the current platform.]"
1031"\njob ...\n"
1032" -l [arg ...]\n"
1034"[+EXIT STATUS?]{"
1035	"[+0?At least one matching process was found for each \ajob\a "
1036	"operand, and the specified signal was successfully sent to at "
1037	"least one matching process.]"
1038	"[+>0?An error occurred.]"
1040"[+SEE ALSO?\bps\b(1), \bjobs\b(1), \bkill\b(2), \bsignal\b(2)]"
1043const char sh_optlet[]	=
1044"[-1c?@(#)$Id: let (AT&T Research) 2000-04-02 $\n]"
1046"[+NAME?let - evaluate arithmetic expressions]"
1047"[+DESCRIPTION?\blet\b evaluates each \aexpr\a in the current "
1048	"shell environment as an arithmetic expression using ANSI C "
1049	"syntax.  Variables names are shell variables and they "
1050	"are recursively evaluated as arithmetic expressions to "
1051	"get numerical values.]"
1052"[+?\blet\b has been made obsolete by the \b((\b...\b))\b syntax "
1053	"of \bksh\b(1) which does not require quoting of the operators "
1054	"to pass them as command arguments.]"
1056"\n[expr ...]\n"
1058"[+EXIT STATUS?]{"
1059	"[+0?The last \aexpr\a evaluates to a non-zero value.]"
1060	"[+>0?The last \aexpr\a evaluates to \b0\b or an error occurred.]"
1063"[+SEE ALSO?\bexpr\b(1), \btest\b(1), \bksh\b(1)]"
1066const char sh_optprint[] =
1067"[-1c?\n@(#)$Id: print (AT&T Research) 2008-11-26 $\n]"
1069"[+NAME?print - write arguments to standard output]"
1070"[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to "
1071	"standard output and appends a newline character.]"
1072"[+?Unless, the \b-r\b or \b-f\b option is specified, each \b\\\b "
1073	"character in each \astring\a operand is processed specially as "
1074	"follows:]{"
1075		"[+\\a?Alert character.]"
1076		"[+\\b?Backspace character.]"
1077		"[+\\c?Terminate output without appending newline.  The "
1078			"remaining \astring\a operands are ignored.]"
1079		"[+\\f?Formfeed character.]"
1080		"[+\\n?Newline character.]"
1081		"[+\\t?Tab character.]"
1082		"[+\\v?Vertical tab character.]"
1083		"[+\\\\?Backslash character.]"
1084		"[+\\E?Escape character (ASCII octal 033).]"
1085		"[+\\0\ax\a?The 8-bit character whose ASCII code is the "
1086			"1-, 2-, or 3-digit octal number \ax\a.]"
1087	"}"
1088"[+?If both \b-e\b and \b-r\b are specified, the last one specified is "
1089	"the one that is used.]"
1090"[+?When the \b-f\b option is specified and there are more \astring\a "
1091	"operands than format specifiers, the format string is "
1092	"reprocessed from the beginning.  If there are fewer \astring\a "
1093	"operands than format specifiers, then outputting will end "
1094	"at the first unneeded format specifier.]"
1095"[e?Unless \b-f\b is specified, process \b\\\b sequences in each \astring\a "
1096	"operand as described above. This is the default behavior.]"
1097"[n?Do not append a new-line character to the output.]"
1098"[f]:[format?Write the \astring\a arguments using the format string "
1099	"\aformat\a and do not append a new-line.  See \bprintf\b for "
1100	"details on how to specify \aformat\a.]"
1101"[p?Write to the current co-process instead of standard output.]"
1102"[r?Do not process \b\\\b sequences in each \astring\a operand as described "
1103	"above.]"
1104"[s?Write the output as an entry in the shell history file instead of "
1105	"standard output.]"
1106"[u]:[fd:=1?Write to file descriptor number \afd\a instead of standard output.]"
1107"[v?Treat each \astring\a as a variable name and write the value in \b%B\b "
1108	"format.  Cannot be used with \b-f\b.]"
1109"[C?Treat each \astring\a as a variable name and write the value in \b%#B\b "
1110	"format.  Cannot be used with \b-f\b.]"
1112"\n[string ...]\n"
1114"[+EXIT STATUS?]{"
1115	"[+0?Successful completion.]"
1116	"[+>0?An error occurred.]"
1118"[+SEE ALSO?\becho\b(1), \bprintf\b(1), \bread\b(1)]"
1121const char sh_optprintf[] =
1122"[-1c?\n@(#)$Id: printf (AT&T Research) 2009-02-02 $\n]"
1124"[+NAME?printf - write formatted output]"
1125"[+DESCRIPTION?\bprintf\b writes each \astring\a operand to "
1126	"standard output using \aformat\a to control the output format.]"
1127"[+?The \aformat\a operands supports the full range of ANSI C formatting "
1128	"specifiers plus the following additional specifiers:]{"
1129	"[+%b?Each character in the \astring\a operand is processed "
1130		"specially as follows:]{"
1131			"[+\\a?Alert character.]"
1132			"[+\\b?Backspace character.]"
1133			"[+\\c?Terminate output without appending newline. "
1134			    "The remaining \astring\a operands are ignored.]"
1135			"[+\\f?Formfeed character.]"
1136			"[+\\n?Newline character.]"
1137			"[+\\t?Tab character.]"
1138			"[+\\v?Vertical tab character.]"
1139			"[+\\\\?Backslash character.]"
1140			"[+\\E?Escape character (ASCII octal 033).]"
1141			"[+\\0\ax\a?The 8-bit character whose ASCII code is "
1142				"the 1-, 2-, or 3-digit octal number \ax\a.]"
1143		"}"
1144	"[+%q?Output \astring\a quoted in a manner that it can be read in "
1145		"by the shell to get back the same string.  However, empty "
1146		"strings resulting from missing \astring\a operands will "
1147		"not be quoted.]"
1148	"[+%B?Treat the argument as a variable name and output the value "
1149		"without converting it to a string.  This is most useful for "
1150		"variables of type \b-b\b.]"
1151	"[+%H?Output \astring\a with characters \b<\b, \b&\b, \b>\b, "
1152		"\b\"\b, and non-printable characters properly escaped for "
1153		"use in HTML and XML documents.]"
1154	"[+%P?Treat \astring\a as an extended regular expression and  "
1155		"convert it to a shell pattern.]"
1156	"[+%R?Treat \astring\a as an shell pattern expression and  "
1157		"convert it to an extended regular expression.]"
1158	"[+%T?Treat \astring\a as a date/time string and format it.  The "
1159		"\bT\b can be preceded by \b(\b\adformat\a\b)\b, where "
1160		"\adformat\a is a date format as defined by the \bdate\b "
1161		"command.]"
1162	"[+%Z?Output a byte whose value is \b0\b.]"
1164"[+?When performing conversions of \astring\a to satisfy a numeric "
1165	"format specifier, if the first character of \astring\a "
1166	"is \b\"\b or \b'\b, then the value will be the numeric value "
1167	"in the underlying code set of the character following the "
1168	"\b\"\b or \b'\b.  Otherwise, \astring\a is treated like a shell "
1169	"arithmetic expression and evaluated.]"
1170"[+?If a \astring\a operand cannot be completely converted into a value "
1171	"appropriate for that format specifier, an error will occur, "
1172	"but remaining \astring\a operands will continue to be processed.]"
1173"[+?In addition to the format specifier extensions, the following "
1174	"extensions of ANSI-C are permitted in format specifiers:]{"
1175	"[+-?The escape sequences \b\\E\b and \b\\e\b expand to the escape "
1176		"character which is octal \b033\b in ASCII.]"
1177	"[+-?The escape sequence \b\\c\b\ax\a expands to Control-\ax\a.]"
1178	"[+-?The escape sequence \b\\C[.\b\aname\a\b.]]\b expands to "
1179		"the collating element \aname\a.]"
1180	"[+-?The escape sequence \b\\x{\b\ahex\a\b}\b expands to the "
1181		"character corresponding to the hexidecimal value \ahex\a.]"
1182	"[+-?The format modifier flag \b=\b can be used to center a field to "
1183		"a specified width.]"
1184	"[+-?The format modifier flag \bL\b can be used with the \bc\b and "
1185		"\bs\b formats to treat precision as character width instead "
1186		"of byte count.]"
1187	"[+-?Each of the integral format specifiers can have a third "
1188		"modifier after width and precision that specifies the "
1189		"base of the conversion from 2 to 64.  In this case the "
1190		"\b#\b modifier will cause \abase\a\b#\b to be prepended to "
1191		"the value.]"
1192	"[+-?The \b#\b modifier can be used with the \bd\b specifier when "
1193		"no base is specified cause the output to be written in units "
1194		"of \b1000\b with a suffix of one of \bk M G T P E\b.]"
1195	"[+-?The \b#\b modifier can be used with the \bi\b specifier to "
1196		"cause the output to be written in units of \b1024\b with "
1197		"a suffix of one of \bKi Mi Gi Ti Pi Ei\b.]"
1198	"}"
1199"[+?If there are more \astring\a operands than format specifiers, the "
1200	"\aformat\a string is reprocessed from the beginning.  If there are "
1201	"fewer \astring\a operands than format specifiers, then string "
1202	"specifiers will be treated as if empty strings were supplied, "
1203	"numeric conversions will be treated as if 0 were supplied, and "
1204	"time conversions will be treated as if \bnow\b were supplied.]"
1205"[+?\bprintf\b is equivalent to \bprint -f\b which allows additional "
1206	"options to be specified.]"
1208"\nformat [string ...]\n"
1210"[+EXIT STATUS?]{"
1211	"[+0?Successful completion.]"
1212	"[+>0?An error occurred.]"
1214"[+SEE ALSO?\bdate\b(1), \bprint\b(1), \bread\b(1)]"
1217const char sh_optpwd[] =
1218"[-1c?\n@(#)$Id: pwd (AT&T Research) 1999-06-07 $\n]"
1220"[+NAME?pwd - write working directory name]"
1221"[+DESCRIPTION?\bpwd\b writes an absolute pathname of the current working "
1222	"directory to standard output.   An absolute pathname is a "
1223	"pathname that begins with \b/\b that does not contains any "
1224	"\b.\b  or \b..\b components.]"
1225"[+?If both \b-L\b and \b-P\b are specified, the last one specified will "
1226	"be used.  If neither \b-P\b or \b-L\b is specified then the "
1227	"behavior will be determined by the \bgetconf\b parameter "
1228	"\bPATH_RESOLVE\b.  If \bPATH_RESOLVE\b is \bphysical\b, "
1229	"then the behavior will be as if \b-P\b were specified.  Otherwise, "
1230	"the behavior will be as if  \b-L\b were specified.]"
1231"[L?The absolute pathname may contains symbolic link components.  This is "
1232	"the default.]"
1233"[P?The absolute pathname will not contain any symbolic link components.]"
1234"[+EXIT STATUS?]{"
1235	"[+0?Successful completion.]"
1236	"[+>0?An error occurred.]"
1238"[+SEE ALSO?\bcd\b(1), \bgetconf\b(1)]"
1241const char sh_optread[] =
1242"[-1c?\n@(#)$Id: read (AT&T Research) 2006-12-19 $\n]"
1244"[+NAME?read - read a line from standard input]"
1245"[+DESCRIPTION?\bread\b reads a line from standard input and breaks it "
1246	"into fields using the characters in value of the \bIFS\b variable "
1247	"as separators.  The escape character, \b\\\b, is used to remove "
1248	"any special meaning for the next character and for line continuation "
1249	"unless the \b-r\b option is specified.]"
1250"[+?If there are more variables than fields, the remaining variables are "
1251	"set to empty strings.  If there are fewer variables than fields, "
1252	"the leftover fields and their intervening separators are assigned "
1253	"to the last variable.  If no \avar\a is specified then the variable "
1254	"\bREPLY\b is used.]"
1255"[+?When \avar\a has the binary attribute and \b-n\b or \b-N\b is specified, "
1256	"the bytes that are read are stored directly into \bvar\b.]"
1257"[+?If you specify \b?\b\aprompt\a after the first \avar\a, then \bread\b "
1258	"will display \aprompt\a on standard error when standard input "
1259	"is a terminal or pipe.]"
1260"[A?Unset \avar\a and then create an indexed array containing each field in "
1261	"the line starting at index 0.]"
1262"[C?Unset \avar\a and read  \avar\a as a compound variable.]"
1263"[d]:[delim?Read until delimiter \adelim\a instead of to the end of line.]"
1264"[p?Read from the current co-process instead of standard input.  An end of "
1265	"file causes \bread\b to disconnect the co-process so that another "
1266	"can be created.]"
1267"[r?Do not treat \b\\\b specially when processing the input line.]"
1268"[s?Save a copy of the input as an entry in the shell history file.]"
1269"[u]#[fd:=0?Read from file descriptor number \afd\a instead of standard input.]"
1270"[t]:[timeout?Specify a timeout \atimeout\a in seconds when reading from "
1271	"a terminal or pipe.]"
1272"[n]#[nchar?Read at most \anchar\a characters.  For binary fields \asize\a "
1273	"will be in bytes.]"
1274"[N]#[nchar?Read exactly \anchar\a characters.  For binary fields \asize\a "
1275	"will be in bytes.]"
1276"[v?When reading from a terminal the value of the first variable is displayed "
1277	"and used as a default value.]"
1279"\n[var?prompt] [var ...]\n"
1281"[+EXIT STATUS?]{"
1282	"[+0? Successful completion.]"
1283	"[+>0?End of file was detected or an error occurred.]"
1285"[+SEE ALSO?\bprint\b(1), \bprintf\b(1), \bcat\b(1)]"
1288const char sh_optreadonly[] =
1289"[-1c?\n@(#)$Id: readonly (AT&T Research) 2008-06-16 $\n]"
1291"[+NAME?readonly - set readonly attribute on variables]"
1292"[+DESCRIPTION?\breadonly\b sets the readonly attribute on each of "
1293	"the variables specified by \aname\a which prevents their "
1294	"values from being changed.  If \b=\b\avalue\a is specified, "
1295	"the variable \aname\a is set to \avalue\a before the variable "
1296	"is made readonly.]"
1297"[+?Within a type definition, if the value is not specified, then a "
1298	"value must be specified when creating each instance of the type "
1299        "and the value is readonly for each instance.]"
1300"[+?If no \aname\as are specified then the names and values of all "
1301	"readonly variables are written to standard output.]"
1302"[+?\breadonly\b is built-in to the shell as a declaration command so that "
1303	"field splitting and pathname expansion are not performed on "
1304	"the arguments.  Tilde expansion occurs on \avalue\a.]"
1305"[p?Causes the output to be in a form of \breadonly\b commands that can be "
1306	"used as input to the shell to recreate the current set of "
1307	"readonly variables.]"
1311"[+EXIT STATUS?]{"
1312        "[+0?Successful completion.]"
1313        "[+>0?An error occurred.]"
1316"[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]"
1319const char sh_optreturn[] =
1320"[-1c?\n@(#)$Id: return (AT&T Research) 1999-07-07 $\n]"
1322"[+NAME?return - return from a function or dot script ]"
1323"[+DESCRIPTION?\breturn\b is a shell special built-in that causes the "
1324	"function or dot script that invokes it to exit.  "
1325	"If \breturn\b is invoked outside of a function or dot script "
1326	"it is equivalent to \bexit\b.]"
1327"[+?If \breturn\b is invoked inside a function defined with the \bfunction\b "
1328	"reserved word syntax, then any \bEXIT\b trap set within the "
1329	"then function will be invoked in the context of the caller "
1330	"before the function returns.]"
1331"[+?If \an\a is given, it will be used to set the exit status.]"
1335"[+EXIT STATUS?If \an\a is specified, the exit status is the least significant "
1336	"eight bits of the value of \an\a.  Otherwise, the exit status is the "
1337	"exit status of preceding command.]"
1338"[+SEE ALSO?\bbreak\b(1), \bexit\b(1)]"
1342const char sh_optksh[] =
1343"+[-1c?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
1345"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
1346"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
1347	"executes commands read from a command line string, the "
1348	"standard input, or a specified file.]"
1349"[+?If the \b-i\b option is present, or there are no \aarg\as and "
1350	"the standard input and standard error are attached to a "
1351	"terminal, the shell is considered to be interactive.]"
1352"[+?The \b-s\b and \b-c\b options are mutually exclusive.  If the \b-c\b "
1353	"option is specified, the first \aarg\a is the command-line string "
1354	"and must be specified.  Any remaining \aarg\as will be used "
1355	"to initialize \b$0\b and positional parameters.]"
1356"[+?If the neither \b-s\b nor \b-c\b is specified, then the first \barg\b "
1357	"will be the pathname of the file containing commands and \b$0\b "
1358	"will be set to this value.  If there is no file with this pathname, "
1359	"and this pathame does not contain a \b/\b, then the \bPATH\b "
1360	"will be searched for an executable with this name.  Any remaining "
1361	"\aarg\as will be used to initialize the positional parmaeters.]"
1362"[+?Any option can use a \b+\b instead of a \b-\b to disable the corresponding "
1363	"option.]"
1364"[c?Read the commands from the first \aarg\a.]"
1365"[i?Specifies that the shell is interactive.]"
1366"[l?Invoke the shell as a login shell; \b/etc/profile\b and \b$HOME/.profile\b, "
1367	"if they exist, are read before the first command.]"
1368"[r\f:restricted\f?Invoke the shell in a restricted mode.  A restricted "
1369	"shell does not permit any of the following:]{"
1370	"[+-?Changing the working directory.]"
1371	"[+-?Setting values or attributes of the variables \bSHELL\b, "
1372		"\bENV\b, \bFPATH\b, or \bPATH\b.]"
1373	"[+-?Executing any command whose name as a \b/\b in it.]"
1374	"[+-?Redirecting output of a command with \b>\b, \b>|\b, "
1375		"\b<>\b, or \b>>\b.]"
1376	"[+-?Adding or deleting built-in commands or libraries with "
1377		"\bbuiltin\b.]"
1378	"[+-?Executing \bcommand -p\b \a...\a .]"
1379	"}"
1380"[s?Read the commands from standard input.  The positional parameters will be "
1381	"initialized from \aarg\a.]"
1382"[D\f:dump-strings\f?Do not execute the script, but output the set of double "
1383	"quoted strings preceded by a \b$\b.  These strings are needed for "
1384	"localization of the script to different locales.]"
1385"[E?Reads the file "
1387	"\b/etc/ksh.kshrc\b, if it exists, as a profile, followed by "
1389	"\b${ENV-$HOME/.kshrc}\b, if it exists, as a profile. "
1390	"On by default for interactive shells; use \b+E\b to disable.]"
1391#if SHOPT_PFSH
1392"[P?Invoke the shell as a profile shell.  See \bpfexec\b(1).]"
1394#if SHOPT_KIA
1395"[R]:[file?Do not execute the script, but create a cross reference database "
1396	"in \afile\a that can be used a separate shell script browser.  The "
1397	"-R option requires a script to be specified as the first operand.]"
1398#endif /* SHOPT_KIA */
1400"[I:regress]:[intercept?Enable the regression test \aintercept\a. Must be "
1401	"the first command line option(s).]"
1403#if SHOPT_BASH
1404   "\fbash2\f"
1408"[T?Enable implementation specific test code defined by mask.]#[mask]"
1410"\n[arg ...]\n"
1412"[+EXIT STATUS?If \b\f?\f\b executes command, the exit status will be that "
1413        "of the last command executed.  Otherwise, it will be one of "
1414        "the following:]{"
1415        "[+0?The script or command line to be executed consists entirely "
1416		"of zero or more blank lines or comments.]"
1417        "[+>1-125?A noninteractive shell detected a syntax error, a variable "
1418		"assignment error, or an error in a special built-in.]"
1419	"[+126?\b-c\b and \b-s\b were not specified and the command script "
1420		"was found on \bPATH\b but was not executable.]"
1421	"[+127?\b-c\b and \b-s\b were not specified and the command script "
1422		"corresponding to \aarg\a could not be found.]"
1425"[+SEE ALSO?\bset\b(1), \bbuiltin\b(1)]"
1427const char sh_optset[] =
1428"+[-1c?\n@(#)$Id: set (AT&T Research) 1999-09-28 $\n]"
1430"[+NAME?set - set/unset options and positional parameters]"
1431"[+DESCRIPTION?\bset\b sets or unsets options and positional parameters.  "
1432	"Options that are specified with a \b-\b cause the options to "
1433	"be set.  Options that are specified with a \b+\b cause the "
1434	"option to be unset.]"
1435"[+?\bset\b without any options or arguments displays the names and "
1436	"values of all shell variables in the order of the collation "
1437	"sequence in the current locale.  The values are quoted so that "
1438	"they are suitable for reinput to the shell.]"
1439"[+?If no \aarg\as are specified, not even the end of options argument \b--\b, "
1440	"the positional parameters are unchanged.  Otherwise, unless "
1441	"the \b-A\b options has been specified, the positional parameters "
1442	"are replaced by the list of \aarg\as.  A first \aarg\a of "
1443	"\b--\b is ignored when setting positional parameters.]"
1444"[+?For backward compatibility, a \bset\b command without any options "
1445	"specified whose first \aarg\a is \b-\b will turn off "
1446	"the \b-v\b and \b-x\b options.  If any additional \aarg\as "
1447	"are specified, they will replace the positional parameters.]"
1448"[s?Sort the positional parameters.]"
1449"[A]:[name?Assign the arguments sequentially to the array named by \aname\a "
1450	"starting at subscript 0 rather than to the positional parameters.]"
1452"[06:default?Restore all non-command line options to the default settings.]"
1453"[07:state?List the current option state in the form of a \bset\b command "
1454	"that can be executed to restore the state.]"
1456"\n[arg ...]\n"
1458"[+EXIT STATUS?]{"
1459        "[+0?No errors occurred.]"
1460        "[+>0?An error occurred.]"
1463"[+SEE ALSO?\btypeset\b(1), \bshift\b(1)]"
1468const char sh_optshift[] =
1469"[-1c?\n@(#)$Id: shift (AT&T Research) 1999-07-07 $\n]"
1471"[+NAME?shift - shift positional parameters]"
1472"[+DESCRIPTION?\bshift\b is a shell special built-in that shifts the "
1473	"positional parameters to the left by the number of places "
1474	"defined by \an\a, or \b1\b if \an\a is omitted.  The number of "
1475	"positional parameters remaining will be reduced by the "
1476	"number of places that are shifted.]"
1477"[+?If \an\a is given, it will be evaluated as an arithmetic expression "
1478	"to determinate the number of places to shift.  It is an error "
1479	"to shift more than the number of positional parameters or a "
1480	"negative number of places.]"
1484"[+EXIT STATUS?]{"
1485        "[+0?The positional parameters were successfully shifted.]"
1486        "[+>0?An error occurred.]"
1488"[+SEE ALSO?\bset\b(1)]"
1491const char sh_optsleep[] =
1492"[-1c?\n@(#)$Id: sleep (AT&T Research) 2009-03-12 $\n]"
1494"[+NAME?sleep - suspend execution for an interval]"
1495"[+DESCRIPTION?\bsleep\b suspends execution for at least the time specified "
1496	"by \aduration\a or until a \bSIGALRM\b signal is received. "
1497	"\aduration\a may be one of the following:]"
1499	"[+integer?The number of seconds to sleep.]"
1500	"[+floating point?The number of seconds to sleep. The actual "
1501		"granularity depends on the underlying system, normally "
1502		"around 1 millisecond.]"
1503	"[+P\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bM\b\an\a\bS?An ISO 8601 duration "
1504		"where at least one of the duration parts must be specified.]"
1505	"[+P\an\a\bW?An ISO 8601 duration specifying \an\a weeks.]"
1506	"[+p\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bm\b\an\a\bS?A case insensitive "
1507		"ISO 8601 duration except that \bM\b specifies months, \bm\b before \bs\b or \bS\b "
1508		"specifies minutes and after specifies milliseconds, \bu\b or \bU\b specifies "
1509		"microseconds, and \bn\b specifies nanoseconds.]"
1510	"[+date/time?Sleep until the \bdate\b(1) compatible date/time.]"
1512"[s?Sleep until a signal or a timeout is received. If \aduration\a is omitted "
1513	"or 0 then no timeout will be used.]"
1515"\n[ duration ]\n"
1517"[+EXIT STATUS?]{"
1518	"[+0?The execution was successfully suspended for at least \aduration\a "
1519	"or a \bSIGALRM\b signal was received.]"
1520	"[+>0?An error occurred.]"
1522"[+SEE ALSO?\bdate\b(1), \btime\b(1), \bwait\b(1)]"
1525const char sh_opttrap[] =
1526"[-1c?\n@(#)$Id: trap (AT&T Research) 1999-07-17 $\n]"
1528"[+NAME?trap - trap signals and conditions]"
1529"[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be "
1530	"taken when conditions such as receiving a signal occur.  Also, "
1531	"\btrap\b can be used to display the current trap settings on "
1532	"standard output.]"
1533"[+?If \aaction\a is \b-\b, \btrap\b resets each \acondition\a "
1534	"to the default value.  If \aaction\a is an empty string, the "
1535	"shell ignores each of the \acondition\as if they arise. "
1536	"Otherwise, the argument \aaction\a will be read and executed "
1537	"by the shell as if it were processed by \beval\b(1) when one "
1538	"of the corresponding conditions arise.  The action of the trap "
1539	"will override any previous action associated with each specified "
1540	"\acondition\a.  The value of \b$?\b is not altered by the trap "
1541	"execution.]"
1542"[+?\acondition\a can be the name or number of a signal, or one of the "
1543	"following:]{"
1544	"[+EXIT?This trap is executed when the shell exits.  If defined "
1545		"within a function defined with the \bfunction\b reserved "
1546		"word, the trap is executed in the caller's environment "
1547		"when the function returns and the trap action is restored "
1548		"to the value it had when it called the function.]"
1549	"[+0?Same as EXIT.]"
1550	"[+DEBUG?Executed before each simple command is executed but after "
1551		"the arguments are expanded.]"
1552	"[+ERR?Executed whenever \bset -e\b would cause the shell to exit.]"
1553	"[+KEYBD?Executed when a key is entered from a terminal device.]"
1555"[+?Signal names are case insensitive and the \bsig\b prefix is optional.  "
1556	"Signals that were ignored on entry to a noninteractive shell cannot "
1557	"trapped or reset although doing so will not report an error.  The "
1558	"use of signal numbers other than \b1\b, \b2\b, \b3\b, \b6\b, "
1559	"\b9\b, \b14\b, and \b15\b is not portable.]"
1560"[+?Although \btrap\b is a special built-in, specifying a condition that "
1561	"the shell does not know about causes \btrap\b to exit with a "
1562	"non-zero exit status, but does not terminate the invoking shell.]"
1563"[+?If no \aaction\a or \acondition\as are specified then all the current "
1564	"trap settings are written to standard output.]"
1565"[p?Causes the current traps to be output in a format that can be processed "
1566	"as input to the shell to recreate the current traps.]"
1568"\n[action condition ...]\n"
1570"[+EXIT STATUS?]{"
1571        "[+0?Successful completion.]"
1572        "[+>0?An error occurred.]"
1575"[+SEE ALSO?\bkill\b(1), \beval\b(1), \bsignal\b(3)]"
1578const char sh_opttypeset[] =
1579"+[-1c?\n@(#)$Id: typeset (AT&T Research) 2008-08-04 $\n]"
1581"[+NAME?\f?\f - declare or display variables with attributes]"
1582"[+DESCRIPTION?Without the \b-f\b option, \b\f?\f\b sets, unsets, "
1583	"or displays attributes of variables as specified with the "
1584	"options.  If the first option is specified with a \b-\b "
1585	"then the attributes are set for each of the given \aname\as. "
1586	"If the first option is specified with a \b+\b, then the specified "
1587	"attributes are unset.  If \b=\b\avalue\a is specified value is "
1588	"assigned before the attributes are set.]"
1589"[+?When \b\f?\f\b is called inside a function defined with the "
1590	"\bfunction\b reserved word, and \aname\a does not contain a "
1591	"\b.\b, then a local variable statically scoped to  that function "
1592	"will be created.]"
1593"[+?Not all option combinations are possible.  For example, the numeric "
1594	"options \b-i\b, \b-E\b, and \b-F\b cannot be specified with "
1595	"the justification options \b-L\b, \b-R\b, and \b-Z\b.]"
1596"[+?Note that the following preset aliases are set by the shell:]{"
1597	"[+compound?\b\f?\f -C\b.]"
1598	"[+float?\b\f?\f -lE\b.]"
1599	"[+functions?\b\f?\f -f\b.]"
1600	"[+integer?\b\f?\f -li\b.]"
1601	"[+nameref?\b\f?\f -n\b.]"
1603"[+?If no \aname\as are specified then variables that have the specified "
1604	"options are displayed.  If the first option is specified with "
1605	"a leading \b-\b then the name and value of each variable is "
1606	"written to standard output.  Otherwise, only the names are "
1607	"written.  If no options are specified or just \b-p\b is "
1608	"specified, then the names and attributes of all variables that have "
1609	"attributes are written to standard output.  When \b-f\b is specified, "
1610	"the names displayed will be function names.]"
1611"[+?If \b-f\b is specified, then each \aname\a refers to a function "
1612	"and the only valid options are \b-u\b and \b-t\b.  In this "
1613	"case no \b=\b\avalue\a can be specified.]"
1614"[+?\b\f?\f\b is built-in to the shell as a declaration command so that "
1615	"field splitting and pathname expansion are not performed on "
1616	"the arguments.  Tilde expansion occurs on \avalue\a.]"
1617#if 1
1618"[a]:?[type?Indexed array.  This is the default. If \b[\b\atype\a\b]]\b is "
1619    "specified, each subscript is interpreted as a value of type \atype\a.]"
1621"[a?Indexed array. this is the default.]"
1623"[b?Each \aname\a may contain binary data.  Its value is the mime "
1624	"base64 encoding of the data. It can be used with \b-Z\b, "
1625	"to specify fixed sized fields.]"
1626"[f?Each of the options and \aname\as refers to a function.]"
1627"[i]#?[base:=10?An integer. \abase\a represents the arithmetic base "
1628	"from 2 to 64.]"
1629"[l?Convert uppercase character to lowercase.  Unsets \b-u\b attribute.  When "
1630	"used with \b-i\b, \b-E\b, or \b-F\b indicates long variant.]"
1631"[m?Move.  The value is the name of a variable whose value will be "
1632	"moved to \aname\a.  The orignal variable will be unset.  Cannot be "
1633	"used with any other options.]"
1634"[n?Name reference.  The value is the name of a variable that \aname\a "
1635	"references.  \aname\a cannot contain a \b.\b.  Cannot be use with "
1636	"any other options.]"
1637"[p?Causes the output to be in a format that can be used as input to the "
1638	"shell to recreate the attributes for variables.]"
1639"[r?Enables readonly.  Once enabled it cannot be disabled.  See "
1640	"\breadonly\b(1).]"
1641"[s?Used with \b-i\b to restrict integer size to short.]"
1642"[t?When used with \b-f\b, enables tracing for each of the specified "
1643	"functions.  Otherwise, \b-t\b is a user defined attribute and "
1644	"has no meaning to the shell.]"
1645"[u?Without \b-f\b or \b-i\b, converts lowercase character to uppercase "
1646	"and unsets \b-l\b.  With \b-f\b specifies that \aname\a is a function "
1647	"that hasn't been loaded yet.  With \b-i\b specifies that the "
1648	"value will be displayed as an unsigned integer.]"
1649"[x?Puts each \aname\a on the export list.  See \bexport\b(1).  \aname\a "
1650	"cannot contain a \b.\b.]"
1651"[A?Associative array.  Each \aname\a will converted to an associate "
1652	"array.  If a variable already exists, the current value will "
1653	"become index \b0\b.]"
1654"[C?Compound variable.  Each \aname\a will be a compound variable.  If "
1655	"\avalue\a names a compound variable it will be copied to \aname\a. "
1656	"Otherwise if the variable already exists, it will first be unset.]"
1657"[E]#?[n:=10?Floating point number represented in scientific notation. "
1658	"\an\a specifies the number of significant figures when the "
1659	"value is expanded.]"
1660"[F]#?[n:=10?Floating point.  \an\a is the number of places after the "
1661	"decimal point when the value is expanded.]"
1662"[H?Hostname mapping.  Each \aname\a holds a native pathname.  Assigning a "
1663	"UNIX format pathname will cause it to be converted to a pathname "
1664	"suitable for the current host.  This has no effect when the "
1665	"native system is UNIX.]"
1666"[L]#?[n?Left justify.  If \an\a is given it represents the field width.  If "
1667	"the \b-Z\b attribute is also specified, then leading zeros are "
1668	"stripped.]"
1669"[R]#?[n?Right justify.  If \an\a is given it represents the field width.  If "
1670	"the \b-Z\b attribute is also specified, then zeros will "
1671	"be used as the fill character.  Otherwise, spaces are used.]"
1672"[X]#?[n:=2*sizeof(long long)?Floating point number represented in hexadecimal "
1673	"notation.  \an\a specifies the number of significant figures when the "
1674	"value is expanded.]"
1676#ifdef SHOPT_TYPEDEF
1677"[h]:[string?Used within a type definition to provide a help string  "
1678	"for variable \aname\a.  Otherwise, it is ignored.]"
1679"[S?Used with a type definition to indicate that the variable is shared by "
1680	"each instance of the type.  When used inside a function defined "
1681	"with the \bfunction\b reserved word, the specified variables "
1682	"will have function static scope.  Otherwise, the variable is "
1683	"unset prior to processing the assignment list.]"
1685"[T]:[tname?\atname\a is the name of a type name given to each \aname\a.]"
1686"[Z]#?[n?Zero fill.  If \an\a is given it represents the field width.]"
1689" -f [name...]\n"
1691"[+EXIT STATUS?]{"
1692        "[+0?No errors occurred.]"
1693        "[+>0?An error occurred.]"
1696"[+SEE ALSO?\breadonly\b(1), \bexport\b(1)]"
1699const char sh_optulimit[] =
1700"[-1c?@(#)$Id: ulimit (AT&T Research) 2003-06-21 $\n]"
1702"[+NAME?ulimit - set or display resource limits]"
1703"[+DESCRIPTION?\bulimit\b sets or displays resource limits.  These "
1704	"limits apply to the current process and to each child process "
1705	"created after the resource limit has been set.  If \alimit\a "
1706	"is specified, the resource limit is set, otherwise, its current value "
1707	"is displayed on standard output.]"
1708"[+?Increasing the limit for a resource usually requires special privileges.  "
1709	"Some systems allow you to lower resource limits and later increase "
1710	"them.  These are called soft limits.  Once a hard limit is "
1711	"set the resource can not be increased.]"
1712"[+?Different systems allow you to specify different resources and some "
1713	"restrict how much you can raise the limit of the resource.]"
1714"[+?The value of \alimit\a depends on the unit of the resource listed "
1715	"for each resource.  In addition, \alimit\a can be \bunlimited\b "
1716	"to indicate no limit for that resource.]"
1717"[+?If you do not specify \b-H\b or \b-S\b, then \b-S\b is used for "
1718	"listing and both \b-S\b and \b-H\b are used for setting resources.]"
1719"[+?If you do not specify any resource, the default is \b-f\b.]"
1720"[H?A hard limit is set or displayed.]"
1721"[S?A soft limit is set or displayed.]"
1722"[a?Displays all current resource limits]"
1727"[+EXIT STATUS?]{"
1728	"[+0?Successful completion.]"
1729	"[+>0?A request for a higher limit was rejected or an error occurred.]"
1732"[+SEE ALSO?\bulimit\b(2), \bgetrlimit\b(2)]"
1735const char sh_optumask[] =
1736"[-1c?\n@(#)$Id: umask (AT&T Research) 1999-04-07 $\n]"
1738"[+NAME?umask - get or set the file creation mask]"
1739"[+DESCRIPTION?\bumask\b sets the file creation mask of the current "
1740	"shell execution environment to the value specified by the "
1741	"\amask\a operand.  This mask affects the file permission bits "
1742	"of subsequently created files.  \amask\a can either be an "
1743	"octal number or a symbolic value as described in \bchmod\b(1).  "
1744	"If a symbolic value is given, the new file creation mask is the "
1745	"complement of the result of applying \amask\a to the complement "
1746	"of the current file creation mask.]"
1747"[+?If \amask\a is not specified, \bumask\b writes the value of the "
1748	"file creation mask for the current process to standard output.]"
1749"[S?Causes the file creation mask to be written or treated as a symbolic value "
1750	"rather than an octal number.]"
1754"[+EXIT STATUS?]{"
1755	"[+0?The file creation mask was successfully changed, or no "
1756		"\amask\a operand was supplied.]"
1757	"[+>0?An error occurred.]"
1759"[+SEE ALSO?\bchmod\b(1)]"
1761const char sh_optuniverse[]	= " [name]";
1762const char sh_optunset[] =
1763"[-1c?\n@(#)$Id: unset (AT&T Research) 1999-07-07 $\n]"
1765"[+NAME?unset - unset values and attributes of variables and functions]"
1766"[+DESCRIPTION?For each \aname\a specified, \bunset\b  unsets the variable, "
1767	"or function if \b-f\b is specified, from the current shell "
1768	"execution environment.  Readonly variables cannot be unset.]"
1769"[n?If \aname\a refers to variable that is a reference, the variable \aname\a "
1770	"will be unset rather than the variable it references.  Otherwise, "
1771	"is is equivalent to \b-v\b.]"
1772"[f?\aname\a refers to a function name and the shell will unset the "
1773	"function definition.]"
1774"[v?\aname\a refers to a variable name and the shell will unset it and "
1775	"remove it from the environment.  This is the default behavior.]"
1779"[+EXIT STATUS?]{"
1780        "[+0?All \aname\as were successfully unset.]"
1781        "[+>0?One or more \aname\a operands could not be unset "
1782	"or an error occurred.]"
1785"[+SEE ALSO?\btypeset\b(1)]"
1788const char sh_optunalias[] =
1789"[-1c?\n@(#)$Id: unalias (AT&T Research) 1999-07-07 $\n]"
1791"[+NAME?unalias - remove alias definitions]"
1792"[+DESCRIPTION?\bunalias\b removes the definition of each named alias "
1793	"from the current shell execution environment, or all aliases if "
1794	"\b-a\b is specified.  It will not affect any commands that "
1795	"have already been read and subsequently executed.]"
1796"[a?Causes all alias definitions to be removed.  \aname\a operands "
1797	"are optional and ignored in this case.]"
1801"[+EXIT STATUS?]{"
1802        "[+0?Successful completion.]"
1803        "[+>0?\b-a\b was not specified and one or more \aname\a operands "
1804	"did not have an alias definition, or an error occurred.]"
1807"[+SEE ALSO?\balias\b(1)]"
1810const char sh_optwait[]	=
1811"[-1c?\n@(#)$Id: wait (AT&T Research) 1999-06-17 $\n]"
1813"[+NAME?wait - wait for process or job completion]"
1814"[+DESCRIPTION?\bwait\b with no operands, waits until all jobs "
1815	"known to the invoking shell have terminated.  If one or more "
1816	"\ajob\a operands are specified, \bwait\b waits until all of them "
1817	"have completed.]"
1818"[+?Each \ajob\a can be specified as one of the following:]{"
1819	"[+\anumber\a?\anumber\a refers to a process id.]"
1820	"[+-\anumber\a?\anumber\a refers to a process group id.]"
1821	"[+%\anumber\a?\anumber\a refer to a job number.]"
1822	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
1823	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
1824	"[+%+ \bor\b %%?Refers to the current job.]"
1825	"[+%-?Refers to the previous job.]"
1827"[+?If one ore more \ajob\a operands is a process id or process group id "
1828	"not known by the current shell environment, \bwait\b treats each "
1829	"of them as if it were a process that exited with status 127.]"
1831"\n[job ...]\n"
1833"[+EXIT STATUS?If \await\a is invoked with one or more \ajob\as, and all of "
1834	"them have terminated or were not known by the invoking shell, "
1835	"the exit status of \bwait\b  will be that of the last \ajob\a.  "
1836	"Otherwise, it will be one of the following:]{"
1837	"[+0?\bwait\b utility was invoked with no operands and all "
1838		"processes known by the invoking process have terminated.]"
1839	"[+127?\ajob\a is a process id or process group id that is unknown "
1840		"to the current shell environment.]"
1843"[+SEE ALSO?\bjobs\b(1), \bps\b(1)]"
1846#if SHOPT_FS_3D
1847    const char sh_optvpath[]	= " [top] [base]";
1848    const char sh_optvmap[]	= " [dir] [list]";
1849#endif /* SHOPT_FS_3D */
1851const char sh_optwhence[] =
1852"[-1c?\n@(#)$Id: whence (AT&T Research) 2007-04-24 $\n]"
1854"[+NAME?whence - locate a command and describe its type]"
1855"[+DESCRIPTION?Without \b-v\b, \bwhence\b writes on standard output an "
1856	"absolute pathname, if any, corresponding to \aname\a based "
1857	"on the complete search order that the shell uses.  If \aname\a "
1858	"is not found, then no output is produced.]"
1859"[+?If \b-v\b is specified, the output will also contain information "
1860	"that indicates how the given \aname\a would be interpreted by "
1861	"the shell in the current execution environment.]"
1862"[a?Displays all uses for each \aname\a rather than the first.]"
1863"[f?Do not check for functions.]"
1864"[p?Do not check to see if \aname\a is a reserved word, a built-in, "
1865	"an alias, or a function.  This turns off the \b-v\b option.]"
1866"[q?Quiet mode. Returns 0 if all arguments are built-ins, functions, or are "
1867	"programs found on the path.]"
1868"[v?For each name you specify, the shell displays a line that indicates "
1869	"if that name is one of the following:]{"
1870	"[+?Reserved word]"
1871	"[+?Alias]"
1872	"[+?Built-in]"
1873	"[+?Undefined function]"
1874	"[+?Function]"
1875	"[+?Tracked alias]"
1876	"[+?Program]"
1879"\nname  ...\n"
1881"[+EXIT STATUS?]{"
1882	"[+0?Each \aname\a was found by the shell.]"
1883	"[+1?One or more \aname\as were not found by the shell.]"
1884	"[+>1?An error occurred.]"
1887"[+SEE ALSO?\bcommand\b(1)]"
1891const char e_alrm1[]		= "alarm -r %s +%.3g\n";
1892const char e_alrm2[]		= "alarm %s %.3f\n";
1893const char e_baddisc[]		= "%s: invalid discipline function";
1894const char e_nospace[]		= "out of memory";
1895const char e_nofork[]		= "cannot fork";
1896const char e_nosignal[]		= "%s: unknown signal name";
1897const char e_condition[]	= "condition(s) required";
1898const char e_cneedsarg[]	= "-c requires argument";