14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*8462SApril.Chin@Sun.COM *          Copyright (c) 1982-2008 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
7*8462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                  David Korn <dgk@research.att.com>                   *
184887Schin *                                                                      *
194887Schin ***********************************************************************/
204887Schin #pragma prototyped
214887Schin 
224887Schin #include	<shell.h>
234887Schin #include	<signal.h>
244887Schin #include	"defs.h"
254887Schin #include	"shtable.h"
264887Schin #include	"ulimit.h"
274887Schin #include	"name.h"
284887Schin #include	"version.h"
294887Schin #if KSHELL
304887Schin #   include	"builtins.h"
314887Schin #   include	"jobs.h"
324887Schin #   include	"FEATURE/cmds"
334887Schin #   define	bltin(x)	(b_##x)
344887Schin     /* The following is for builtins that do not accept -- options */
354887Schin #   define	Bltin(x)	(B_##x)
364887Schin #else
374887Schin #   define bltin(x)	0
384887Schin #endif
394887Schin 
404887Schin #if defined(SHOPT_CMDLIB_DIR) && !defined(SHOPT_CMDLIB_HDR)
414887Schin #	define SHOPT_CMDLIB_HDR	<cmdlist.h>
424887Schin #endif
434887Schin #define Q(f)		#f	/* libpp cpp workaround -- fixed 2005-04-11 */
44*8462SApril.Chin@Sun.COM #define CMDLIST(f)	SH_CMDLIB_DIR "/" Q(f), NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f),
454887Schin 
464887Schin #undef	basename
474887Schin #undef	dirname
484887Schin 
494887Schin /*
504887Schin  * The order up through "[" is significant
514887Schin  */
524887Schin const struct shtable3 shtab_builtins[] =
534887Schin {
544887Schin 	"login",	NV_BLTIN|BLT_ENV|BLT_SPC,	Bltin(login),
554887Schin 	"exec",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(exec),
564887Schin 	"set",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(set),
574887Schin 	":",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(true),
584887Schin 	"true",		NV_BLTIN|BLT_ENV,		bltin(true),
594887Schin 	"command",	NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(command),
604887Schin 	"cd",		NV_BLTIN|BLT_ENV,		bltin(cd),
614887Schin 	"break",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(break),
624887Schin 	"continue",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(break),
634887Schin 	"typeset",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
64*8462SApril.Chin@Sun.COM 	"test",		NV_BLTIN|BLT_ENV,		bltin(test),
654887Schin 	"[",		NV_BLTIN|BLT_ENV,		bltin(test),
664887Schin 	"let",		NV_BLTIN|BLT_ENV,		bltin(let),
67*8462SApril.Chin@Sun.COM 	"export",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly),
68*8462SApril.Chin@Sun.COM 	".",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(dot_cmd),
69*8462SApril.Chin@Sun.COM 	"return",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(return),
704887Schin #if SHOPT_BASH
714887Schin 	"local",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(typeset),
724887Schin #endif
734887Schin #if _bin_newgrp || _usr_bin_newgrp
744887Schin 	"newgrp",	NV_BLTIN|BLT_ENV|BLT_SPC,	Bltin(login),
754887Schin #endif	/* _bin_newgrp || _usr_bin_newgrp */
764887Schin 	"alias",	NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
774887Schin 	"hash",		NV_BLTIN|BLT_SPC|BLT_DCL,	bltin(alias),
78*8462SApril.Chin@Sun.COM 	"enum",		NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(enum),
79*8462SApril.Chin@Sun.COM 	"eval",		NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
804887Schin 	"exit",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(return),
814887Schin 	"fc",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(hist),
824887Schin 	"hist",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(hist),
834887Schin 	"readonly",	NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(readonly),
844887Schin 	"shift",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(shift),
854887Schin 	"trap",		NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(trap),
864887Schin 	"unalias",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(unalias),
874887Schin 	"unset",	NV_BLTIN|BLT_ENV|BLT_SPC,	bltin(unset),
884887Schin 	"builtin",	NV_BLTIN,			bltin(builtin),
894887Schin #if SHOPT_ECHOPRINT
904887Schin 	"echo",		NV_BLTIN|BLT_ENV,		bltin(print),
914887Schin #else
924887Schin 	"echo",		NV_BLTIN|BLT_ENV,		Bltin(echo),
934887Schin #endif /* SHOPT_ECHOPRINT */
944887Schin #ifdef JOBS
954887Schin #   ifdef SIGTSTP
964887Schin 	"bg",		NV_BLTIN|BLT_ENV,		bltin(bg),
974887Schin 	"fg",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(bg),
984887Schin 	"disown",	NV_BLTIN|BLT_ENV,		bltin(bg),
99*8462SApril.Chin@Sun.COM 	"kill",		NV_BLTIN|BLT_ENV,		bltin(kill),
1004887Schin #   else
101*8462SApril.Chin@Sun.COM 	"/bin/kill",	NV_BLTIN|BLT_ENV,		bltin(kill),
1024887Schin #   endif	/* SIGTSTP */
1034887Schin 	"jobs",		NV_BLTIN|BLT_ENV,		bltin(jobs),
1044887Schin #endif	/* JOBS */
1054887Schin 	"false",	NV_BLTIN|BLT_ENV,		bltin(false),
1064887Schin 	"getopts",	NV_BLTIN|BLT_ENV,		bltin(getopts),
1074887Schin 	"print",	NV_BLTIN|BLT_ENV,		bltin(print),
108*8462SApril.Chin@Sun.COM 	"printf",	NV_BLTIN|BLT_ENV,		bltin(printf),
109*8462SApril.Chin@Sun.COM 	"pwd",		NV_BLTIN,			bltin(pwd),
1104887Schin 	"read",		NV_BLTIN|BLT_ENV,		bltin(read),
111*8462SApril.Chin@Sun.COM 	"sleep",	NV_BLTIN,			bltin(sleep),
1124887Schin 	"alarm",	NV_BLTIN,			bltin(alarm),
1134887Schin 	"ulimit",	NV_BLTIN|BLT_ENV,		bltin(ulimit),
1144887Schin 	"umask",	NV_BLTIN|BLT_ENV,		bltin(umask),
1154887Schin #ifdef _cmd_universe
1164887Schin 	"universe",	NV_BLTIN|BLT_ENV,		bltin(universe),
1174887Schin #endif /* _cmd_universe */
1184887Schin #if SHOPT_FS_3D
1194887Schin 	"vpath",	NV_BLTIN|BLT_ENV,		bltin(vpath),
1204887Schin 	"vmap",		NV_BLTIN|BLT_ENV,		bltin(vpath),
1214887Schin #endif /* SHOPT_FS_3D */
1224887Schin 	"wait",		NV_BLTIN|BLT_ENV|BLT_EXIT,	bltin(wait),
1234887Schin 	"type",		NV_BLTIN|BLT_ENV,		bltin(whence),
1244887Schin 	"whence",	NV_BLTIN|BLT_ENV,		bltin(whence),
1254887Schin #ifdef SHOPT_CMDLIB_HDR
1264887Schin #include SHOPT_CMDLIB_HDR
1274887Schin #else
1284887Schin 	CMDLIST(basename)
1294887Schin 	CMDLIST(chmod)
1304887Schin 	CMDLIST(dirname)
131*8462SApril.Chin@Sun.COM 	CMDLIST(getconf)
1324887Schin 	CMDLIST(head)
1334887Schin 	CMDLIST(mkdir)
1344887Schin 	CMDLIST(logname)
1354887Schin 	CMDLIST(cat)
1364887Schin 	CMDLIST(cmp)
1374887Schin 	CMDLIST(cut)
1384887Schin 	CMDLIST(uname)
1394887Schin 	CMDLIST(wc)
1404887Schin 	CMDLIST(sync)
1414887Schin #endif
1424887Schin 	"",		0, 0
1434887Schin };
1444887Schin 
1454887Schin 
1464887Schin const char sh_set[] =
1474887Schin "[a?Set the export attribute for each variable whose name does not "
1484887Schin 	"contain a \b.\b that you assign a value in the current shell "
1494887Schin 	"environment.]"
1504887Schin "[b?The shell writes a message to standard error as soon it detects that "
1514887Schin 	"a background job completes rather than waiting until the next prompt.]"
1524887Schin "[e?A simple command that has an non-zero exit status will cause the shell "
1534887Schin 	"to exit unless the simple command is:]{"
1544887Schin 	"[++?contained in an \b&&\b or \b||\b list.]"
1554887Schin 	"[++?the command immediately following \bif\b, \bwhile\b, or \buntil\b.]"
1564887Schin 	"[++?contained in the pipeline following \b!\b.]"
1574887Schin "}"
1584887Schin "[f?Pathname expansion is disabled.]"
1594887Schin "[h?Obsolete.  Causes each command whose name has the syntax of an "
160*8462SApril.Chin@Sun.COM 	"alias to become a tracked alias when it is first encountered.]"
1614887Schin "[k?This is obsolete.  All arguments of the form \aname\a\b=\b\avalue\a "
1624887Schin 	"are removed and placed in the variable assignment list for "
1634887Schin 	"the command.  Ordinarily, variable assignments must precede "
1644887Schin 	"command arguments.]"
1654887Schin "[m?When enabled, the shell runs background jobs in a separate process "
1664887Schin 	"group and displays a line upon completion.  This mode is enabled "
1674887Schin 	"by default for interactive shells on systems that support job "
1684887Schin 	"control.]"
1694887Schin "[n?The shell reads commands and checks for syntax errors, but does "
1704887Schin 	"not execute the command.  Usually specified on command invocation.]"
1714887Schin "[o]:?[option?If \aoption\a is not specified, the list of options and "
1724887Schin 	"their current settings will be written to standard output.  When "
1734887Schin 	"invoked with a \b+\b the options will be written in a format "
1744887Schin 	"that can be reinput to the shell to restore the settings. "
1754887Schin 	"This option can be repeated to enable/disable multiple options. "
1764887Schin 	"The value of \aoption\a must be one of the following:]{"
1774887Schin 		"[+allexport?Equivalent to \b-a\b.]"
1784887Schin 		"[+bgnice?Runs background jobs at lower priorities.]"
1794887Schin 		"[+braceexpand?Equivalent to \b-B\b.] "
1804887Schin 		"[+emacs?Enables/disables \bemacs\b editing mode.]"
1814887Schin 		"[+errexit?Equivalent to \b-e\b.]"
1824887Schin 		"[+globstar?Equivalent to \b-G\b.]"
1834887Schin 		"[+gmacs?Enables/disables \bgmacs\b editing mode.  \bgmacs\b "
1844887Schin 			"editing mode is the same as \bemacs\b editing mode "
1854887Schin 			"except for the handling of \b^T\b.]"
1864887Schin #if SHOPT_BASH
1874887Schin 		"[+hashall?Equivalent to \b-h\b and \b-o trackall\b. Available "
1884887Schin 		"in bash compatibility mode only.]"
1894887Schin 		"[+history?Enable command history. Available in bash "
1904887Schin 		"compatibility mode only. On by default in interactive "
1914887Schin 		"shells.]"
1924887Schin #endif
1934887Schin #if SHOPT_HISTEXPAND
1944887Schin 		"[+histexpand?Equivalent to \b-H\b.]"
1954887Schin #endif
1964887Schin 		"[+ignoreeof?Prevents an interactive shell from exiting on "
1974887Schin 			"reading an end-of-file.]"
1984887Schin 		"[+keyword?Equivalent to \b-k\b.]"
1994887Schin 		"[+markdirs?A trailing \b/\b is appended to directories "
2004887Schin 			"resulting from pathname expansion.]"
2014887Schin 		"[+monitor?Equivalent to \b-m\b.]"
2024887Schin 		"[+multiline?Use multiple lines when editing lines that are "
2034887Schin 			"longer than the window width.]"
2044887Schin 		"[+noclobber?Equivalent to \b-C\b.]"
2054887Schin 		"[+noexec?Equivalent to \b-n\b.]"
2064887Schin 		"[+noglob?Equivalent to \b-f\b.]"
2074887Schin 		"[+nolog?This has no effect.  It is provided for backward "
2084887Schin 			"compatibility.]"
2094887Schin 		"[+notify?Equivalent to \b-b\b.]"
2104887Schin 		"[+nounset?Equivalent to \b-u\b.]"
2114887Schin #if SHOPT_BASH
2124887Schin 		"[+onecmd?Equivalent to \b-t\b. Available in bash compatibility "
2134887Schin 		"mode only.]"
2144887Schin 		"[+physical?Equivalent to \b-P\b. Available in bash "
2154887Schin 		"compatibility mode only.]"
2164887Schin 		"[+posix?Turn on POSIX compatibility. Available in bash "
2174887Schin 		"compatibility mode only. Bash in POSIX mode is not the "
2184887Schin 		"same as ksh.]"
2194887Schin #endif
2204887Schin 		"[+pipefail?A pipeline will not complete until all components "
2214887Schin 			"of the pipeline have completed, and the exit status "
2224887Schin 			"of the pipeline will be the value of the last "
2234887Schin 			"command to exit with non-zero exit status, or will "
2244887Schin 			"be zero if all commands return zero exit status.]"
2254887Schin 		"[+privileged?Equivalent to \b-p\b.]"
2264887Schin 		"[+showme?Simple commands preceded by a \b;\b will be traced "
2274887Schin 			"as if \b-x\b were enabled but not executed.]"
2284887Schin 		"[+trackall?Equivalent to \b-h\b.]"
2294887Schin 		"[+verbose?Equivalent to \b-v\b.]"
2304887Schin 		"[+vi?Enables/disables \bvi\b editing mode.]"
2314887Schin 		"[+viraw?Does not use canonical input mode when using \bvi\b "
2324887Schin 			"edit mode.]"
2334887Schin 		"[+xtrace?Equivalent to \b-x\b.]"
2344887Schin "}"
2354887Schin "[p?Privileged mode.  Disabling \b-p\b sets the effective user id to the "
2364887Schin 	"real user id, and the effective group id to the real group id.  "
2374887Schin 	"Enabling \b-p\b restores the effective user and group ids to their "
2384887Schin 	"values when the shell was invoked.  The \b-p\b option is on "
2394887Schin 	"whenever the real and effective user id is not equal or the "
2404887Schin 	"real and effective group id is not equal.  User profiles are "
2414887Schin 	"not processed when \b-p\b is enabled.]"
2424887Schin "[r?restricted.  Enables restricted shell.  This option cannot be unset once "
2434887Schin 	"enabled.]"
2444887Schin "[t?Obsolete.  The shell reads one command and then exits.]"
2454887Schin "[u?If enabled, the shell displays an error message when it tries to expand "
2464887Schin 	"a variable that is unset.]"
2474887Schin "[v?Verbose.  The shell displays its input onto standard error as it "
2484887Schin 	"reads it.]"
2494887Schin "[x?Execution trace.  The shell will display each command after all "
2504887Schin 	"expansion and before execution preceded by the expanded value "
2514887Schin 	"of the \bPS4\b parameter.]"
2524887Schin #if SHOPT_BASH
2534887Schin 	"\fbash1\f"
2544887Schin #endif
2554887Schin #if SHOPT_BRACEPAT
2564887Schin "[B?Enable {...} group expansion. On by default.]"
2574887Schin #endif
2584887Schin "[C?Prevents existing regular files from being overwritten using the \b>\b "
2594887Schin 	"redirection operator.  The \b>|\b redirection overrides this "
2604887Schin 	"\bnoclobber\b option.]"
2614887Schin "[G?Causes \b**\b by itself to also match all sub-directories during pathname "
2624887Schin 	"expansion.]"
2634887Schin #if SHOPT_HISTEXPAND
2644887Schin    "[H?Enable \b!\b-style history expansion similar to \bcsh\b.]"
2654887Schin #endif
2664887Schin ;
2674887Schin 
2684887Schin const char sh_optbreak[] =
2694887Schin "[-1c?\n@(#)$Id: break (AT&T Research) 1999-04-07 $\n]"
2704887Schin USAGE_LICENSE
2714887Schin "[+NAME?break - break out of loop ]"
2724887Schin "[+DESCRIPTION?\bbreak\b is a shell special built-in that exits the "
2734887Schin 	"smallest enclosing \bfor\b, \bselect\b, \bwhile\b, or \buntil\b loop, "
2744887Schin 	"or the \an\a-th enclosing loop if \an\a is specified.  "
2754887Schin 	"Execution continues at the command following the loop(s).]"
2764887Schin "[+?If \an\a is given, it must be a positive integer >= 1. If \an\a "
2774887Schin 	"is larger than the number of enclosing loops, the last enclosing "
2784887Schin 	"loop will be exited.]"
2794887Schin "\n"
2804887Schin "\n[n]\n"
2814887Schin "\n"
2824887Schin "[+EXIT STATUS?0]"
2834887Schin "[+SEE ALSO?\bcontinue\b(1), \breturn\b(1)]"
2844887Schin ;
2854887Schin 
2864887Schin const char sh_optcont[] =
2874887Schin "[-1c?\n@(#)$Id: continue (AT&T Research) 1999-04-07 $\n]"
2884887Schin USAGE_LICENSE
2894887Schin "[+NAME?continue - continue execution at top of the loop]"
2904887Schin "[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues "
2914887Schin 	"execution at the top of smallest enclosing enclosing \bfor\b, "
2924887Schin 	"\bselect\b, \bwhile\b, or \buntil\b loop, if any; or the top of "
2934887Schin 	"the \an\a-th enclosing loop if \an\a is specified.]"
2944887Schin "[+?If \an\a is given, it must be a positive integer >= 1. If \an\a "
2954887Schin 	"is larger than the number of enclosing loops, the last enclosing "
2964887Schin 	" loop will be used.]"
2974887Schin 
2984887Schin "\n"
2994887Schin "\n[n]\n"
3004887Schin "\n"
3014887Schin "[+SEE ALSO?\bbreak\b(1)]"
3024887Schin ;
3034887Schin 
3044887Schin const char sh_optalarm[]	= "r [varname seconds]";
3054887Schin const char sh_optalias[] =
3064887Schin "[-1c?\n@(#)$Id: alias (AT&T Research) 1999-07-07 $\n]"
3074887Schin USAGE_LICENSE
3084887Schin "[+NAME?alias - define or display aliases]"
3094887Schin "[+DESCRIPTION?\balias\b creates or redefines alias definitions "
3104887Schin 	"or writes the existing alias definitions to standard output.  "
3114887Schin 	"An alias definitions provides a string value that will replace "
3124887Schin 	"a command name when the command is read.  Alias names can "
3134887Schin 	"contain any printable character which is not special to the shell.  "
3144887Schin 	"If an alias value ends in a space or tab, then the word "
3154887Schin 	"following the command name the alias replaces is also checked "
3164887Schin 	"to see whether it is an alias.]"
3174887Schin "[+?If no \aname\as are specified then the names and values of all "
3184887Schin 	"aliases are written to standard output.  Otherwise, for "
3194887Schin 	"each \aname\a that is specified, and \b=\b\avalue\a  is not "
3204887Schin 	"specified, the current value of the alias corresponding to "
3214887Schin 	"\aname\a is written to standard output.  If \b=\b\avalue\a is "
3224887Schin 	"specified, the alias \aname\a will be created or redefined.]"
3234887Schin "[+?\balias\b is built-in to the shell as a declaration command so that "
3244887Schin 	"field splitting and pathname expansion are not performed on "
3254887Schin 	"the arguments.  Tilde expansion occurs on \avalue\a.  An alias "
3264887Schin 	"definition only affects scripts read by the current shell "
3274887Schin 	"environment.  It does not effect scripts run by this shell.]"
3284887Schin "[p?Causes the output to be in the form of alias commands that can be used "
3294887Schin 	"as input to the shell to recreate the current aliases.]"
3304887Schin "[t?Used for tracked aliases.  These are aliases that connect a "
3314887Schin 	"command name to the pathname of the command and are reset "
3324887Schin 	"when the \bPATH\b variable is unset.  The tracked aliases feature is "
3334887Schin 	"now obsolete.]"
3344887Schin "[x?Ignored, this option is obsolete.]"
3354887Schin "\n"
3364887Schin "\n[name[=value]...]\n"
3374887Schin "\n"
3384887Schin "[+EXIT STATUS?]{"
3394887Schin         "[+0?Successful completion.]"
3404887Schin         "[+>0?One or more \aname\a operands did not have an alias "
3414887Schin 		"definition, or an error occurred.]"
3424887Schin "}"
3434887Schin 
3444887Schin "[+SEE ALSO?\bsh\b(1), \bunalias\b(1)]"
3454887Schin ;
3464887Schin 
3474887Schin const char sh_optbuiltin[] =
3484887Schin "[-1c?\n@(#)$Id: builtin (AT&T Research) 1999-07-10 $\n]"
3494887Schin USAGE_LICENSE
3504887Schin "[+NAME?builtin - add, delete, or display shell built-ins]"
3514887Schin "[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display "
3524887Schin     "built-in commands in the current shell environment. A built-in command "
3534887Schin     "executes in the current shell process and can have side effects in the "
3544887Schin     "current shell. On most systems, the invocation time for built-in "
3554887Schin     "commands is one or two orders of magnitude less than commands that "
3564887Schin     "create a separate process.]"
3574887Schin "[+?For each \apathname\a specified, the basename of the pathname "
3584887Schin     "determines the name of the built-in. For each basename, the shell looks "
3594887Schin     "for a C level function in the current shell whose name is determined by "
3604887Schin     "prepending \bb_\b to the built-in name. If \apathname\a contains a "
3614887Schin     "\b/\b, then the built-in is bound to this pathname. A built-in bound to "
3624887Schin     "a pathname will only be executed if \apathname\a is the first "
3634887Schin     "executable found during a path search. Otherwise, built-ins are found "
3644887Schin     "prior to performing the path search.]"
3654887Schin "[+?If no \apathname\a operands are specified, then \bbuiltin\b displays "
3664887Schin     "the current list of built-ins, or just the special built-ins if \b-s\b "
3674887Schin     "is specified, on standard output. The full pathname for built-ins that "
3684887Schin     "are bound to pathnames are displayed.]"
3694887Schin "[+?Libraries containing built-ins can be specified with the \b-f\b "
3704887Schin     "option. If the library contains a function named \blib_init\b(), this "
3714887Schin     "function will be invoked with argument \b0\b when the library is "
3724887Schin     "loaded. The \blib_init\b() function can load built-ins by invoking an "
3734887Schin     "appropriate C level function. In this case there is no restriction on "
3744887Schin     "the C level function name.]"
3754887Schin "[+?The C level function will be invoked with three arguments. The first "
3764887Schin     "two are the same as \bmain\b() and the third one is a pointer.]"
3774887Schin "[+?\bbuiltin\b cannot be invoked from a restricted shell.]"
3784887Schin "[d?Deletes each of the specified built-ins. Special built-ins cannot be "
3794887Schin     "deleted.]"
3804887Schin "[f]:[lib?On systems with dynamic linking, \alib\a names a shared "
3814887Schin     "library to load and search for built-ins. Libraries are search for in "
3824887Schin     "\b$PATH\b and system dependent library directories. The system "
3834887Schin     "dependent shared library prefix and/or suffix may be omitted. Once a "
3844887Schin     "library is loaded, its symbols become available for the current and "
3854887Schin     "subsequent invocations of \bbuiltin\b. Multiple libraries can be "
3864887Schin     "specified with separate invocations of \bbuiltin\b. Libraries are "
3874887Schin     "searched in the reverse order in which they are specified.]"
3884887Schin "[s?Display only the special built-ins.]"
3894887Schin "\n"
3904887Schin "\n[pathname ...]\n"
3914887Schin "\n"
3924887Schin "[+EXIT STATUS?]{"
3934887Schin 	"[+0?All \apathname\a operands and \b-f\b options processed "
3944887Schin 	"successfully.]"
3954887Schin 	"[+>0?An error occurred.]"
3964887Schin "}"
3974887Schin "[+SEE ALSO?\bwhence\b(1)]"
3984887Schin ;
3994887Schin 
4004887Schin const char sh_optcd[] =
4014887Schin "[-1c?\n@(#)$Id: cd (AT&T Research) 1999-06-05 $\n]"
4024887Schin USAGE_LICENSE
4034887Schin "[+NAME?cd - change working directory ]"
4044887Schin "[+DESCRIPTION?\bcd\b changes the current working directory of the "
4054887Schin 	"current shell environment.]"
4064887Schin "[+?In the first form with one operand, if \adirectory\a begins with "
4074887Schin 	"\b/\b, or if the first component is \b.\b or \b..\b, the "
4084887Schin 	"directory will be changed to this directory.  If directory is \b-\b, "
4094887Schin 	"the directory will be changed to the last directory visited.  "
4104887Schin 	"Otherwise, if the \bCDPATH\b environment variable is set, \bcd\b "
4114887Schin 	"searches for \adirectory\a relative to each directory named in "
4124887Schin 	"the colon separated list of directories defined by \bCDPATH\b.  "
4134887Schin 	"If \bCDPATH\b not set, \bcd\b changes to the directory specified "
4144887Schin 	"by \adirectory\a.]"
4154887Schin "[+?In the second form, the first occurrence of the string \aold\a "
4164887Schin 	"contained in the pathname of the present working directory "
4174887Schin 	"is replaced by the string \anew\a and the resulting string "
4184887Schin 	"is used as the directory to which to change.]"
4194887Schin "[+?When invoked without operands and when the \bHOME\b environment "
4204887Schin 	"variable is set to a nonempty value,  the directory named by "
4214887Schin 	"the \bHOME\b environment variable will be used.  If \bHOME\b "
4224887Schin 	"is empty or unset, \bcd\b will fail.]"
4234887Schin "[+?When \bcd\b is successful, the \bPWD\b environment variable will be set "
4244887Schin 	"to the name of an absolute pathname that does not contain any "
4254887Schin 	"\b..\b components corresponding to the new directory.  The "
4264887Schin 	"environment variable \bOLDPWD\b will be set to the previous "
4274887Schin 	"value of \bPWD\b.  If the new directory is found by searching "
4284887Schin 	"the directories named by \bCDPATH\b, or if \adirectory\a is \b-\b, "
4294887Schin 	"or if the two operand form is used, the new value of \bPWD\b will be "
4304887Schin 	"written to standard output.]"
4314887Schin "[+?If both \b-L\b and \b-P\b are specified, the last one specified will "
4324887Schin 	"be used.  If neither \b-P\b or \b-L\b is specified then the "
4334887Schin 	"behavior will be determined by the \bgetconf\b parameter "
4344887Schin 	"\bPATH_RESOLVE\b.  If \bPATH_RESOLVE\b is \bphysical\b, "
4354887Schin 	"then the behavior will be as if \b-P\b were specified.  Otherwise, "
4364887Schin 	"the behavior will be as if  \b-L\b were specified.]"
4374887Schin "[L?Handle each pathname component \b..\b in a logical fashion by moving "
4384887Schin 	"up one level by name in the present working directory.]"
4394887Schin "[P?The present working directory is first converted to an absolute pathname "
4404887Schin 	"that does not contain symbolic link components and symbolic name "
4414887Schin 	"components are expanded in the resulting directory name.]"
4424887Schin "\n"
4434887Schin "\n[directory]\n"
4444887Schin "old new\n"
4454887Schin "\n"
4464887Schin "[+EXIT STATUS?]{"
4474887Schin 	"[+0?Directory successfully changed.]"
4484887Schin 	"[+>0?An error occurred.]"
4494887Schin "}"
4504887Schin "[+SEE ALSO?\bpwd\b(1), \bgetconf\b(1)]"
4514887Schin ;
4524887Schin 
4534887Schin const char sh_optcommand[] =
4544887Schin "[-1c?\n@(#)$Id: command (AT&T Research) 2003-08-01 $\n]"
4554887Schin USAGE_LICENSE
4564887Schin "[+NAME?command - execute a simple command]"
4574887Schin "[+DESCRIPTION?Without \b-v\b or \b-V\b,  \bcommand\b executes \acommand\a "
4584887Schin 	"with arguments given by \aarg\a, suppressing the shell function lookup "
4594887Schin 	"that normally occurs.  In addition, if \acommand\a is a special "
4604887Schin 	"built-in command, then the special properties are removed so that "
4614887Schin 	"failures will not cause the script that executes it to terminate.]"
4624887Schin "[+?With the \b-v\b or \b-V\b options, \bcommand\b is equivalent to the "
4634887Schin 	"\bwhence\b(1) command.]"
4644887Schin "[p?Causes a default path to be searched rather than the one defined by the "
4654887Schin 	"value of \bPATH\b.]"
4664887Schin "[v?Equivalent to \bwhence\b \acommand\a [\aarg\a ...]].]"
4674887Schin "[x?If \acommand\a fails because there are too many \aarg\as, it will be "
4684887Schin 	"invoked multiple times with a subset of the arguments on each "
4694887Schin 	"invocation.  Arguments that occur prior to the first word that expand "
4704887Schin 	"to multiple arguments and arguments that occur after the last word "
4714887Schin 	"that expands to multiple arguments will be passed on each invocation. "
4724887Schin 	"The exit status will be the maximum invocation exit status.]"
4734887Schin "[V?Equivalent to \bwhence \b-v\b \acommand\a [\aarg\a ...]].]"
4744887Schin "\n"
4754887Schin "\n[command [arg ...]]\n"
4764887Schin "\n"
4774887Schin "[+EXIT STATUS?If \acommand\a is invoked, the exit status of \bcommand\b "
4784887Schin 	"will be that of \acommand\a.  Otherwise, it will be one of "
4794887Schin 	"the following:]{"
4804887Schin 	"[+0?\bcommand\b completed successfully.]"
4814887Schin 	"[+>0?\b-v\b or \b-V\b has been specified and an error occurred.]"
4824887Schin 	"[+126?\acommand\a was found but could not be invoked.]"
4834887Schin 	"[+127?\acommand\a could not be found.]"
4844887Schin "}"
4854887Schin 
4864887Schin "[+SEE ALSO?\bwhence\b(1), \bgetconf\b(1)]"
4874887Schin ;
4884887Schin 
4894887Schin const char sh_optdot[]	 =
4904887Schin "[-1c?@(#)$Id: \b.\b (AT&T Research) 2000-04-02 $\n]"
4914887Schin USAGE_LICENSE
4924887Schin "[+NAME?\b.\b - execute commands in the current environment]"
4934887Schin "[+DESCRIPTION?\b.\b is a special built-in command that executes commands "
4944887Schin 	"from a function or a file in the current environment.]"
4954887Schin "[+?If \aname\a refers to a function defined with the \bfunction\b \aname\a "
4964887Schin 	"syntax, the function executes in the current environment as "
4974887Schin 	"if it had been defined with the \aname\a\b()\b syntax so that "
4984887Schin 	"there is no scoping.  Otherwise, commands from the file defined "
4994887Schin 	"by \aname\a are executed in the current environment.  Note that "
5004887Schin 	"the complete script is read before it begins to execute so that "
5014887Schin 	"any aliases defined in this script will not take effect until "
5024887Schin 	"the script completes execution.]"
5034887Schin "[+?When \aname\a refers to a file, the \bPATH\b variable is searched "
5044887Schin 	"for the file containing commands.  In this case execute permission "
5054887Schin 	"is not required for \aname\a.]"
5064887Schin "[+?If any \aarg\as are specified, these become the positional parameters "
5074887Schin 	"for the duration of the function or script and are restored "
5084887Schin 	"upon completion.]"
5094887Schin "\n"
5104887Schin "\n name [arg ...]\n"
5114887Schin "\n"
5124887Schin "[+EXIT STATUS?If \aname\a is found, then the exit status is that "
5134887Schin 	"of the last command executed.  Otherwise, since this is a special "
5144887Schin 	"built-in, an error will cause a non-interactive shell to exit with "
5154887Schin 	"a non-zero exit status.  An interactive shell returns a non-zero exit "
5164887Schin 	"status to indicate an error.]"
5174887Schin 
5184887Schin "[+SEE ALSO?\bcommand\b(1), \bksh\b(1)]"
5194887Schin ;
5204887Schin 
5214887Schin #ifndef ECHOPRINT
5224887Schin     const char sh_optecho[]	= " [-n] [arg...]";
5234887Schin #endif /* !ECHOPRINT */
5244887Schin 
5254887Schin const char sh_opteval[] =
5264887Schin "[-1c?\n@(#)$Id: eval (AT&T Research) 1999-07-07 $\n]"
5274887Schin USAGE_LICENSE
5284887Schin "[+NAME?eval - create a shell command and process it]"
5294887Schin "[+DESCRIPTION?\beval\b is a shell special built-in command that constructs "
5304887Schin 	"a command by concatenating the \aarg\as together, separating each "
5314887Schin 	"with a space.  The resulting string is then taken as input to "
5324887Schin 	"the shell and evaluated in the current environment.  Note that "
5334887Schin 	"command words are expanded twice; once to construct \aarg\a, and "
5344887Schin 	"again when the shell executes the constructed command.]"
5354887Schin "[+?It is not an error if \aarg\a is not given.]"
5364887Schin "\n"
5374887Schin "\n[arg...]\n"
5384887Schin "\n"
5394887Schin "[+EXIT STATUS?If \aarg\a is not specified, the exit status is \b0\b.  "
5404887Schin 	"Otherwise, it is the exit status of the command defined by the "
5414887Schin 	"\aarg\a operands.]"
5424887Schin "[+SEE ALSO?\bexec\b(1), \btrap\b(1), \b.\b(1)]"
5434887Schin ;
5444887Schin 
5454887Schin const char sh_optexec[] =
5464887Schin "[-1c?\n@(#)$Id: exec (AT&T Research) 1999-07-10 $\n]"
5474887Schin USAGE_LICENSE
5484887Schin "[+NAME?exec - execute command, open/close and duplicate file descriptors]"
5494887Schin "[+DESCRIPTION?\bexec\b is a special built-in command that can be used to "
5504887Schin 	"manipulate file descriptors or to replace the current shell "
5514887Schin 	"with a new command.]"
5524887Schin "[+?If \acommand\a is specified, then the current shell process will be "
5534887Schin 	"replaced by \acommand\a rather than running \acommand\a and waiting "
5544887Schin 	"for it to complete.  Note that there is no need to use "
5554887Schin 	"\bexec\b to enhance performance since the shell implicitly "
5564887Schin 	"uses the exec mechanism internally whenever possible.]"
5574887Schin "[+?If no operands are specified, \bexec\b can be used to open or "
5584887Schin 	"close files, or to manipulate file descriptors from \b0\b to "
5594887Schin 	"\b9\b in the current shell environment using the standard "
5604887Schin 	"redirection mechanism available with all commands.  The "
5614887Schin 	"close-on-exec flags will be set on file descriptor numbers "
5624887Schin 	"greater than \b2\b that are opened this way so that they "
5634887Schin 	"will be closed when another program is invoked.]"
5644887Schin "[+?Because \bexec\b is a special command, any failure will cause the "
5654887Schin 	"script that invokes it to exit.  This can be prevented by "
5664887Schin 	"invoking \bexec\b from the \bcommand\b utility.]"
5674887Schin "[+?\bexec\b cannot be invoked from a restricted shell to create "
5684887Schin 	"files or to open a file for writing or appending.]"
5694887Schin "[c?Clear all environment variables before executions except variable "
5704887Schin 	"assignments that are part of the current \bexec\b command.]"
5714887Schin "[a]:[name?\bargv[0]]\b will be set to \aname\a for \acommand\a]"
5724887Schin "\n"
5734887Schin "\n[command [arg ...]]\n"
5744887Schin "\n"
5754887Schin "[+EXIT STATUS?If \acommand\a is specified, \bexec\b does not return.  "
5764887Schin 	"Otherwise, the exit status is one of the following:]{"
5774887Schin 	"[+0?All I/O redirections were successful.]"
5784887Schin 	"[+>0?An error occurred.]"
5794887Schin "}"
5804887Schin "[+SEE ALSO?\bcommand\b(1), \beval\b(1)]"
5814887Schin ;
5824887Schin 
5834887Schin 
5844887Schin const char sh_optexit[] =
5854887Schin "[-1c?\n@(#)$Id: exit (AT&T Research) 1999-07-07 $\n]"
5864887Schin USAGE_LICENSE
5874887Schin "[+NAME?exit - exit the current shell]"
5884887Schin "[+DESCRIPTION?\bexit\b is shell special built-in that causes the "
5894887Schin 	"shell that invokes it to exit.  Before exiting the shell, if the "
5904887Schin 	"\bEXIT\b trap is set it will be invoked.]"
5914887Schin "[+?If \an\a is given, it will be used to set the exit status.]"
5924887Schin "\n"
5934887Schin "\n[n]\n"
5944887Schin "\n"
5954887Schin "[+EXIT STATUS?If \an\a is specified, the exit status is the least significant "
5964887Schin 	"eight bits of the value of \an\a.  Otherwise, the exit status is the "
5974887Schin 	"exit status of preceding command.  When invoked inside a trap, the "
5984887Schin 	"preceding command means the command that invoked the trap.]"
5994887Schin "[+SEE ALSO?\bbreak\b(1), \breturn\b(1)]"
6004887Schin ;
6014887Schin 
6024887Schin const char sh_optexport[] =
6034887Schin "[-1c?\n@(#)$Id: export (AT&T Research) 1999-07-07 $\n]"
6044887Schin USAGE_LICENSE
6054887Schin "[+NAME?export - set export attribute on variables]"
6064887Schin "[+DESCRIPTION?\bexport\b sets the export attribute on each of "
6074887Schin 	"the variables specified by \aname\a which causes them "
6084887Schin 	"to be in the environment of subsequently executed commands.  "
6094887Schin 	"If \b=\b\avalue\a is specified, the variable \aname\a is "
6104887Schin 	"set to \avalue\a.]"
6114887Schin "[+?If no \aname\as are specified then the names and values of all "
6124887Schin 	"exported variables are written to standard output.]"
6134887Schin "[+?\bexport\b is built-in to the shell as a declaration command so that "
6144887Schin 	"field splitting and pathname expansion are not performed on "
6154887Schin 	"the arguments.  Tilde expansion occurs on \avalue\a.]"
6164887Schin "[p?Causes the output to be in the form of \bexport\b commands that can be "
6174887Schin 	"used as input to the shell to recreate the current exports.]"
6184887Schin "\n"
6194887Schin "\n[name[=value]...]\n"
6204887Schin "\n"
6214887Schin "[+EXIT STATUS?]{"
6224887Schin         "[+0?Successful completion.]"
6234887Schin         "[+>0?An error occurred.]"
6244887Schin "}"
6254887Schin 
6264887Schin "[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]"
6274887Schin ;
6284887Schin 
6294887Schin const char sh_optgetopts[] =
6304887Schin ":[-1c?\n@(#)$Id: getopts (AT&T Research) 2005-01-01 $\n]"
6314887Schin "[-author?Glenn Fowler <gsf@research.att.com>]"
6324887Schin USAGE_LICENSE
6334887Schin "[+NAME?\f?\f - parse utility options]"
6344887Schin "[+DESCRIPTION?The \bgetopts\b utility can be used to retrieve options and "
6354887Schin   "arguments from a list of arguments given by \aargs\a or the positional "
6364887Schin   "parameters if \aargs\a is omitted.  It can also generate usage messages "
6374887Schin   "and a man page for the command based on the information in \aoptstring\a.]"
6384887Schin "[+?Each time it is invoked, the \bgetopts\b utility places the value "
6394887Schin   "of the next option in the shell variable specified by the \aname\a "
6404887Schin   "operand and the index of the next argument to be processed in the "
6414887Schin   "shell variable \bOPTIND\b.  When the shell is invoked \bOPTIND\b "
6424887Schin   "is initialized to \b1\b.  When an option requires or permits an option "
6434887Schin   "argument, \bgetopts\b places the option argument in the shell "
6444887Schin   "variable \bOPTARG\b. Otherwise \bOPTARG\b is set to \b1\b when the "
6454887Schin   "option is set and \b0\b when the option is unset.]"
6464887Schin "[+?The \aoptstring\a string consists of alpha-numeric characters, "
6474887Schin   "the special characters +, -, ?, :, and <space>, or character groups "
6484887Schin   "enclosed in [...]].  Character groups may be nested in {...}. "
6494887Schin   "Outside of a [...]] group, a single new-line followed by zero or "
6504887Schin   "more blanks is ignored.  One or more blank lines separate the "
6514887Schin   "options from the command argument synopsis.]"
6524887Schin "[+?Each [...]] group consists of an optional label, "
6534887Schin   "optional attributes separated by :, and an "
6544887Schin   "optional description string following ?.  The characters from the ? "
6554887Schin   "to the end of the next ]] are ignored for option parsing and short "
6564887Schin   "usage messages.  They are used for generating verbose help or man pages. "
6574887Schin   "The : character may not appear in the label. "
6584887Schin   "The ? character must be specified as ?? in the label and the ]] character "
6594887Schin   "must be specified as ]]]] in the description string. "
6604887Schin   "Text between two \\b (backspace) characters indicates "
6614887Schin   "that the text should be emboldened when displayed. "
6624887Schin   "Text between two \\a (bell) characters indicates that the text should "
663*8462SApril.Chin@Sun.COM   "be emphasized or italicized when displayed. "
6644887Schin   "Text between two \\v (vertical tab) characters indicates "
6654887Schin   "that the text should displayed in a fixed width font. "
6664887Schin   "Text between two \\f (formfeed) characters will be replaced by the "
6674887Schin     "output from the shell function whose name is that of the enclosed text.]"
6684887Schin "[+?All output from this interface is written to the standard error.]"
6694887Schin "[+?There are several group types:]{"
6704887Schin   "[+1.?A group of the form "
6714887Schin     "[-[\aversion\a]][\aflag\a[\anumber\a]]]]...[?\atext\a]]]] "
6724887Schin     "appearing as the first group enables the extended interface. \aversion\a "
6734887Schin     "specifies the interface version, currently \b1\b. The latest version is "
6744887Schin     "assumed if \aversion\a is omitted. Future enhancements "
6754887Schin     "may increment \aversion\a, but all versions will be supported. \atext\a "
6764887Schin     "typically specifies an SCCS or CVS identification string. Zero or more "
6774887Schin     "\aflags\a with optional \anumber\a values may be specified to control "
6784887Schin     "option parsing. "
6794887Schin     "The flags are:]{"
6804887Schin       "[+c?Cache this \aoptstring\a for multiple passes. Used to optimize "
6814887Schin 	"builtins that may be called many times within the same process.]"
6824887Schin       "[+i?Ignore this \aoptstring\a when generating help. Used when "
6834887Schin 	"combining \aoptstring\a values from multiple passes.]"
6844887Schin       "[+l?Display only \alongname\a options in help messages.]"
685*8462SApril.Chin@Sun.COM       "[+n?Associate -\anumber\a and +\anumber\a options with the first "
686*8462SApril.Chin@Sun.COM         "option with numeric arguments.]"
6874887Schin       "[+o?The \b-\b option character prefix is optional (supports "
6884887Schin         "obsolete \bps\b(1) option syntax.)]"
6894887Schin       "[+p?\anumber\a specifies the number of \b-\b characters that must "
6904887Schin 	"prefix long option names. The default is \b2\b; \b0\b, \b1\b or "
6914887Schin 	"\b2\b are accepted (e.g., \bp0\b for \bdd\b(1) and \bp1\b for "
6924887Schin 	"\bfind\b(1).)]"
6934887Schin       "[+s?\anumber\a specifies the \b--??man\b section number, "
6944887Schin         "\b1\b by default.]"
6954887Schin   "}"
6964887Schin   "[+2.?An option specification of the form "
6974887Schin     "[\aoption\a[!]][=\anumber\a]][:\alongname\a]][?\atext\a]]]]. In this "
6984887Schin     "case the first field is the option character; this is the value returned "
6994887Schin     "in the \aname\a operand when the option is matched.  If there is no "
7004887Schin     "option character then a two or more digit number should be specified. "
7014887Schin     "This number will be returned as the value of the \aname\a operand if the "
7024887Schin     "long option is matched. If \aoption\a is followed by \b!\b then the option "
7034887Schin     "character sense is the inverse of the longname sense. For options that do "
7044887Schin     "not take values \bOPTARG\b will be set to \b0\b for \b!\b inverted option "
7054887Schin     "characters and \b1\b otherwise. =\anumber\a optionally specifies a number to "
7064887Schin     "be returned in the \aname\a operand instead of the option character. A "
7074887Schin     "longname is specified by \b--\b\alongname\a and is matched by the shortest "
7084887Schin     "non-ambiguous prefix of all long options. * in the \alongname\a field "
7094887Schin     "indicates that only characters up to that point need to match, provided "
7104887Schin     "any additional characters match exactly. The enclosing [ and ]] can be "
7114887Schin     "omitted for an option that does not have a longname or descriptive text.]"
7124887Schin   "[+3.?An option argument specification. "
7134887Schin     "Options that take arguments can be followed by : (string value) or # "
7144887Schin     "(numeric value) and an option argument specification.  An option argument "
7154887Schin     "specification consists of the option argument name as field 1. "
7164887Schin     "The remaining \b:\b separated fields are a type name and zero or more of "
7174887Schin     "the special attribute words \blistof\b, \boneof\b, and \bignorecase\b. "
7184887Schin     "A default option value may be specified in the final field as "
7194887Schin     "\b:=\b\adefault\a. The option argument specification may be followed "
7204887Schin     "by a list of option value descriptions enclosed in braces. "
7214887Schin     "A long option that takes an argument is specified as "
7224887Schin     "\b--\b\alongname\a=\avalue\a. If the : or # is followed by ? then the "
7234887Schin     "option argument is optional. If only the option character form is "
7244887Schin     "specified then the optional argument value is not set if the next "
7254887Schin     "argument starts with - or +.]"
7264887Schin   "[+4.?A option value description.]"
7274887Schin   "[+5.?A argument specification. A list of valid option argument values "
7284887Schin     "can be specified by enclosing them inside a {...} following "
7294887Schin     "the option argument specification.  Each of the permitted "
7304887Schin     "values can be specified with a [...]] containing the "
7314887Schin     "value followed by a description.]"
7324887Schin   "[+6.?A group of the form [+\\n...]] will display the characters "
7334887Schin     "representing ... in fixed with font without adding line breaks.]"
7344887Schin   "[+7.?A group of the form [+\aname\a?\atext\a]] specifies a section "
7354887Schin     "\aname\a with descriptive \atext\a. If \aname\a is omitted then "
7364887Schin     "\atext\a is placed in a new paragraph.]"
7374887Schin   "[+8.?A group of the form [-\aname\a?\atext\a]] specifies entries "
7384887Schin     "for the \bIMPLEMENTATION\b section.]"
7394887Schin "}"
7404887Schin "[+?If the leading character of \aoptstring\a is +, then arguments "
7414887Schin   "beginning with + will also be considered options.]"
7424887Schin "[+?A leading : character or a : following a leading + in \aoptstring\a "
7434887Schin   "affects the way errors are handled.  If an option character or longname "
7444887Schin   "argument not specified in \aoptstring\a is encountered when processing "
7454887Schin   "options, the shell variable whose name is \aname\a will be set to the ? "
7464887Schin   "character.  The shell variable \bOPTARG\b will be set to "
7474887Schin   "the character found.  If an option argument is missing or has an invalid "
7484887Schin   "value, then \aname\a will be set to the : character and the shell variable "
7494887Schin   "\bOPTARG\b will be set to the option character found. "
7504887Schin   "Without the leading :, \aname\a will be set to the ? character, \bOPTARG\b "
7514887Schin   "will be unset, and an error message will be written to standard error "
7524887Schin   "when errors are encountered.]"
7534887Schin "[+?The end of options occurs when:]{"
7544887Schin 	"[+1.?The special argument \b--\b is encountered.]"
7554887Schin 	"[+2.?An argument that does not begin with a \b-\b is encountered.]"
7564887Schin 	"[+3.?A help argument is specified.]"
7574887Schin 	"[+4.?An error is encountered.]"
7584887Schin "}"
7594887Schin "[+?If \bOPTIND\b is set to the value \b1\b, a new set of arguments "
7604887Schin   "can be used.]"
7614887Schin "[+?\bgetopts\b can also be used to generate help messages containing command "
7624887Schin   "usage and detailed descriptions.  Specify \aargs\a as:]"
7634887Schin "{ "
7644887Schin 	"[+-???To generate a usage synopsis.]"
7654887Schin 	"[+--?????To generate a verbose usage message.]"
7664887Schin 	"[+--????man?To generate a formatted man page.]"
7674887Schin 	"[+--????api?To generate an easy to parse usage message.]"
7684887Schin 	"[+--????html?To generate a man page in \bhtml\b format.]"
7694887Schin 	"[+--????nroff?To generate a man page in \bnroff\b format.]"
7704887Schin 	"[+--????usage?List the current \aoptstring\a.]"
7714887Schin 	"[+--??????\aname\a?List \bversion=\b\an\a, \an\a>0, "
7724887Schin 	  "if the option \aname\a is recognized by \bgetopts\b.]"
7734887Schin "}"
7744887Schin "[+?When the end of options is encountered, \bgetopts\b exits with a "
7754887Schin   "non-zero return value and the variable \bOPTIND\b is set to the "
7764887Schin   "index of the first non-option argument.]"
7774887Schin "a:[name?Use \aname\a instead of the command name in usage messages.]"
7784887Schin "\n"
7794887Schin "\nopstring name [args...]\n"
7804887Schin "\n"
7814887Schin "[+EXIT STATUS]{"
7824887Schin 	"[+0?An option specified was found.]"
7834887Schin 	"[+1?An end of options was encountered.]"
7844887Schin 	"[+2?A usage or information message was generated.]"
7854887Schin "}"
7864887Schin ;
7874887Schin 
7884887Schin const char sh_optbg[] =
7894887Schin "[-1c?@(#)$Id: bg (AT&T Research) 2000-04-02 $\n]"
7904887Schin USAGE_LICENSE
7914887Schin "[+NAME?bg - resume jobs in the background]"
7924887Schin "[+DESCRIPTION?\bbg\b places the given \ajob\as into the background "
7934887Schin 	"and sends them a \bCONT\b signal to start them running.]"
7944887Schin "[+?If \ajob\a is omitted, the most recently started or stopped "
7954887Schin 	"background job is resumed or continued in the background.]"
7964887Schin "[+?Each \ajob\a can be specified as one of the following:]{"
7974887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
7984887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
7994887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
8004887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
8014887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
8024887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
8034887Schin 	"[+%-?Refers to the previous job.]"
8044887Schin "}"
8054887Schin "\n"
8064887Schin "\n[job ...]\n"
8074887Schin "\n"
8084887Schin "[+EXIT STATUS?]{"
8094887Schin 	"[+0?If all background jobs are started.]"
8104887Schin 	"[+>0?If one more jobs does not exist or there are no background "
8114887Schin 		"jobs.]"
8124887Schin "}"
8134887Schin 
8144887Schin "[+SEE ALSO?\bwait\b(1), \bfg\b(1), \bdisown\b(1), \bjobs\b(1)]"
8154887Schin ;
8164887Schin 
8174887Schin const char sh_optfg[] =
8184887Schin "[-1c?@(#)$Id: fg (AT&T Research) 2000-04-02 $\n]"
8194887Schin USAGE_LICENSE
8204887Schin "[+NAME?fg - move jobs to the foreground]"
8214887Schin "[+DESCRIPTION?\bfg\b places the given \ajob\as into the foreground "
8224887Schin 	"in sequence and sends them a \bCONT\b signal to start each running.]"
8234887Schin "[+?If \ajob\a is omitted, the most recently started or stopped "
8244887Schin 	"background job is moved to the foreground.]"
8254887Schin "[+?Each \ajob\a can be specified as one of the following:]{"
8264887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
8274887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
8284887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
8294887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
8304887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
8314887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
8324887Schin 	"[+%-?Refers to the previous job.]"
8334887Schin "}"
8344887Schin "\n"
8354887Schin "\n[job ...]\n"
8364887Schin "\n"
8374887Schin "[+EXIT STATUS?If \bfg\b brings one or more jobs into the foreground, "
8384887Schin 	"the exit status of \bfg\b  will be that of the last \ajob\a.  "
8394887Schin 	"If one or more jobs does not exist or has completed, \bfg\b will "
8404887Schin 	"return a non-zero exit status.]"
8414887Schin "}"
8424887Schin 
8434887Schin "[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]"
8444887Schin ;
8454887Schin 
8464887Schin const char sh_optdisown[] =
8474887Schin "[-1c?@(#)$Id: disown (AT&T Research) 2000-04-02 $\n]"
8484887Schin USAGE_LICENSE
8494887Schin "[+NAME?disown - disassociate a job with the current shell]"
8504887Schin "[+DESCRIPTION?\bdisown\b prevents the current shell from sending "
8514887Schin 	"a \bHUP\b signal to each of the given \ajob\as when "
8524887Schin 	"the current shell terminates a login session.]"
8534887Schin "[+?If \ajob\a is omitted, the most recently started or stopped "
8544887Schin 	"background job is used.]"
8554887Schin "[+?Each \ajob\a can be specified as one of the following:]{"
8564887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
8574887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
8584887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
8594887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
8604887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
8614887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
8624887Schin 	"[+%-?Refers to the previous job.]"
8634887Schin "}"
8644887Schin "\n"
8654887Schin "\n[job ...]\n"
8664887Schin "\n"
8674887Schin "[+EXIT STATUS?]{"
868*8462SApril.Chin@Sun.COM 	"[+0?If all jobs are successfully disowned.]"
8694887Schin 	"[+>0?If one more \ajob\as does not exist.]"
8704887Schin "}"
8714887Schin 
8724887Schin "[+SEE ALSO?\bwait\b(1), \bbg\b(1), \bjobs\b(1)]"
8734887Schin ;
8744887Schin 
8754887Schin const char sh_optjobs[] =
8764887Schin "[-1c?@(#)$Id: jobs (AT&T Research) 2000-04-02 $\n]"
8774887Schin USAGE_LICENSE
8784887Schin "[+NAME?jobs - display status of jobs]"
8794887Schin "[+DESCRIPTION?\bjobs\b displays information about specified \ajob\as "
8804887Schin 	"that were started by the current shell environment on standard "
8814887Schin 	"output.  The information contains the job number enclosed in "
8824887Schin 	"[...]], the status, and the command line that started the job.]"
8834887Schin "[+?If \ajob\a is omitted, \bjobs\b displays the status of all stopped jobs, "
8844887Schin 	"background jobs, and all jobs whose status has changed since last "
8854887Schin 	"reported by the shell.]"
8864887Schin "[+?When \bjobs\b reports the termination status of a job, the "
8874887Schin 	"shell removes the jobs from the list of known jobs in "
8884887Schin 	"the current shell environment.]"
8894887Schin "[+?Each \ajob\a can be specified as one of the following:]{"
8904887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
8914887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
8924887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
8934887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
8944887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
8954887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
8964887Schin 	"[+%-?Refers to the previous job.]"
8974887Schin "}"
8984887Schin "[l?\bjobs\b displays process id's after the job number in addition "
8994887Schin 	"to the usual information]"
9004887Schin "[n?Only the jobs whose status has changed since the last prompt "
9014887Schin 	"is displayed.]"
9024887Schin "[p?The process group leader id's for the specified jobs are displayed.]"
9034887Schin "\n"
9044887Schin "\n[job ...]\n"
9054887Schin "\n"
9064887Schin "[+EXIT STATUS?]{"
9074887Schin 	"[+0?The information for each job is written to standard output.]"
9084887Schin 	"[+>0?One or more jobs does not exist.]"
9094887Schin "}"
9104887Schin 
9114887Schin "[+SEE ALSO?\bwait\b(1), \bps\b(1), \bfg\b(1), \bbg\b(1)]"
9124887Schin ;
9134887Schin 
9144887Schin const char sh_opthist[]	=
915*8462SApril.Chin@Sun.COM "[-1cn?@(#)$Id: hist (AT&T Research) 2000-04-02 $\n]"
9164887Schin USAGE_LICENSE
9174887Schin "[+NAME?\f?\f - process command history list]"
9184887Schin "[+DESCRIPTION?\b\f?\f\b lists, edits, or re-executes, commands  "
9194887Schin 	"previously entered into the current shell environment.]"
9204887Schin "[+?The command history list references commands by number. The first number "
9214887Schin 	"in the list is selected arbitrarily.  The relationship of a number "
9224887Schin 	"to its command does not change during a login session.  When the "
9234887Schin 	"number reaches 32767 the number wraps around to 1 but "
9244887Schin 	"maintains the ordering.]"
9254887Schin "[+?When commands are edited (when the \b-l\b option is not specified), the "
9264887Schin 	"resulting lines will be entered at the end of the history list and "
9274887Schin 	"then reexecuted by the current shell.  The \b\f?\f\b command that "
9284887Schin 	"caused the editing will not be entered into the history list.  If the "
9294887Schin 	"editor returns a non-zero exit status, this will suppress the "
9304887Schin 	"entry into the history list and the command reexecution.  Command "
9314887Schin 	"line variable assignments and redirections affect both the \f?\f "
9324887Schin 	"command and the commands that are reexecuted.]"
9334887Schin "[+?\afirst\a and \alast\a define the range of commands. \afirst\a and "
9344887Schin 		"\alast\a can be one of the following:]{"
9354887Schin 		"[+\anumber\a?A positive number representing a command "
9364887Schin 			"number.  A \b+\b sign can precede \anumber\a.]"
9374887Schin 		"[+-\anumber\a?A negative number representing a command "
9384887Schin 			"that was executed \anumber\a commands previously. "
9394887Schin 			"For example, \b-1\b is the previous command.]"
9404887Schin 		"[+\astring\a?\astring\a indicates the most recently "
9414887Schin 			"entered command that begins with \astring\a. "
9424887Schin 			"\astring\a should not contain an \b=\b.]"
9434887Schin 	"}"
9444887Schin "[+?If \afirst\a is omitted, the previous command is used, unless \b-l\b "
9454887Schin 	"is specified, in which case it will default to \b-16\b and \alast\a "
9464887Schin 	"will default to \b-1\b.]"
9474887Schin "[+?If \afirst\a is specified and \alast\a is omitted, then \alast\a will "
9484887Schin 	"default to \afirst\a unless \b-l\b is specified in which case "
9494887Schin 	"it will default to \b-1\b.]"
9504887Schin "[+?If no editor is specified, then the editor specfied by the \bHISTEDIT\b "
9514887Schin 	"variable will be used if set, or the \bFCEDIT\b variable will be "
9524887Schin 	"used if set, otherwise, \bed\b will be used.]"
9534887Schin "[e]:[editor?\aeditor\a specifies the editor to use to edit the history "
9544887Schin 	"command.   A value of \b-\b for \aeditor\a is equivalent to "
9554887Schin 	"specifiying the \b-s\b option.]"
9564887Schin "[l?List the commands rather than editing and reexecuting them.]"
9574887Schin "[N]#[num?Start at \anum\a commands back.]"
9584887Schin "[n?Suppress the command numbers when the commands are listed.]"
9594887Schin #if SHOPT_HISTEXPAND
9604887Schin "[p?Writes the result of history expansion for each operand to standard "
9614887Schin 	"output.  All other options are ignored.]"
9624887Schin #endif
9634887Schin "[r?Reverse the order of the commands.]"
9644887Schin "[s?Reexecute the command without invoking an editor.  In this case "
9654887Schin 	"an operand of the form \aold\a\b=\b\anew\a can be specified "
9664887Schin 	"to change the first occurrence of the string \aold\a in the "
9674887Schin 	"command to \anew\a before reexecuting the command.]"
9684887Schin 
9694887Schin "\n"
9704887Schin "\n[first [last] ]\n"
9714887Schin "\n"
9724887Schin "[+EXIT STATUS?If a command is reexecuted, the exit status is that of "
9734887Schin 	"the command that gets reexecuted.  Otherwise, it is one of the "
9744887Schin 	"following:]{"
9754887Schin 	"[+0?Successfully completion of the listing.]"
9764887Schin 	"[+>0?An error occurred.]"
9774887Schin "}"
9784887Schin 
9794887Schin "[+SEE ALSO?\bksh\b(1), \bsh\b(1), \bed\b(1)]"
9804887Schin ;
9814887Schin 
9824887Schin const char sh_optkill[]	 =
9834887Schin "[-1c?\n@(#)$Id: kill (AT&T Research) 1999-06-17 $\n]"
9844887Schin USAGE_LICENSE
9854887Schin "[+NAME?kill - terminate or signal process]"
9864887Schin "[+DESCRIPTION?With the first form in which \b-l\b is not specified, "
9874887Schin 	"\bkill\b sends a signal to one or more processes specified by "
9884887Schin 	"\ajob\a.  This normally terminates the processes unless the signal "
9894887Schin 	"is being caught or ignored.]"
9904887Schin "[+?A \ajob\a can be specified as one of the following:]{"
9914887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
9924887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
9934887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
9944887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
9954887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
9964887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
9974887Schin 	"[+%-?Refers to the previous job.]"
9984887Schin "}"
9994887Schin "[+?If the signal is not specified with either the \b-n\b or the \b-s\b  "
10004887Schin 	"option, the \bSIGTERM\b signal is used.]"
10014887Schin "[+?If \b-l\b is specified, and no \aarg\a is specified, then \bkill\b "
10024887Schin 	"writes the list of signals to standard output.  Otherwise, \aarg\a "
10034887Schin 	"can be either a signal name, or a number representing either a "
10044887Schin 	"signal number or exit status for a process that was terminated "
10054887Schin 	"due to a signal.  If a name is given the corresponding signal "
10064887Schin 	"number will be written to standard output.  If a number is given "
10074887Schin 	"the corresponding signal name will be written to standard output.]"
10084887Schin "[l?List signal names or signal numbers rather than sending signals as "
10094887Schin 	"described above.  "
10104887Schin 	"The \b-n\b and \b-s\b options cannot be specified.]"
10114887Schin "[n]#[signum?Specify a signal number to send.  Signal numbers are not "
10124887Schin 	"portable across platforms, except for the following:]{"
10134887Schin 		"[+0?No signal]"
10144887Schin 		"[+1?\bHUP\b]"
10154887Schin 		"[+2?\bINT\b]"
10164887Schin 		"[+3?\bQUIT\b]"
10174887Schin 		"[+6?\bABRT\b]"
10184887Schin 		"[+9?\bKILL\b]"
10194887Schin 		"[+14?\bALRM\b]"
10204887Schin 		"[+15?\bTERM\b]"
10214887Schin 	"}"
10224887Schin "[s]:[signame?Specify a signal name to send.  The signal names are derived "
10234887Schin 	"from their names in \b<signal.h>\b without the \bSIG\b prefix and "
10244887Schin 	"are case insensitive.  \bkill -l\b will generate the list of "
10254887Schin 	"signals on the current platform.]"
10264887Schin "\n"
10274887Schin "\njob ...\n"
10284887Schin " -l [arg ...]\n"
10294887Schin "\n"
10304887Schin "[+EXIT STATUS?]{"
10314887Schin 	"[+0?At least one matching process was found for each \ajob\a "
10324887Schin 	"operand, and the specified signal was successfully sent to at "
10334887Schin 	"least one matching process.]"
10344887Schin 	"[+>0?An error occurred.]"
10354887Schin "}"
10364887Schin "[+SEE ALSO?\bps\b(1), \bjobs\b(1), \bkill\b(2), \bsignal\b(2)]"
10374887Schin ;
10384887Schin 
10394887Schin const char sh_optlet[]	=
10404887Schin "[-1c?@(#)$Id: let (AT&T Research) 2000-04-02 $\n]"
10414887Schin USAGE_LICENSE
10424887Schin "[+NAME?let - evaluate arithmetic expressions]"
10434887Schin "[+DESCRIPTION?\blet\b evaluates each \aexpr\a in the current "
10444887Schin 	"shell environment as an arithmetic expression using ANSI C "
10454887Schin 	"syntax.  Variables names are shell variables and they "
10464887Schin 	"are recursively evaluated as arithmetic expressions to "
10474887Schin 	"get numerical values.]"
10484887Schin "[+?\blet\b has been made obsolete by the \b((\b...\b))\b syntax "
10494887Schin 	"of \bksh\b(1) which does not require quoting of the operators "
10504887Schin 	"to pass them as command arguments.]"
10514887Schin "\n"
10524887Schin "\n[expr ...]\n"
10534887Schin "\n"
10544887Schin "[+EXIT STATUS?]{"
10554887Schin 	"[+0?The last \aexpr\a evaluates to a non-zero value.]"
10564887Schin 	"[+>0?The last \aexpr\a evaluates to \b0\b or an error occurred.]"
10574887Schin "}"
10584887Schin 
10594887Schin "[+SEE ALSO?\bexpr\b(1), \btest\b(1), \bksh\b(1)]"
10604887Schin ;
10614887Schin 
10624887Schin const char sh_optprint[] =
10634887Schin "[-1c?\n@(#)$Id: print (AT&T Research) 1999-04-07 $\n]"
10644887Schin USAGE_LICENSE
10654887Schin "[+NAME?print - write arguments to standard output]"
10664887Schin "[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to "
10674887Schin 	"standard output and appends a newline character.]"
1068*8462SApril.Chin@Sun.COM "[+?Unless, the \b-r\b or \b-f\b option is specified, each \b\\\b "
10694887Schin 	"character in each \astring\a operand is processed specially as "
10704887Schin 	"follows:]{"
10714887Schin 		"[+\\a?Alert character.]"
10724887Schin 		"[+\\b?Backspace character.]"
10734887Schin 		"[+\\c?Terminate output without appending newline.  The "
10744887Schin 			"remaining \astring\a operands are ignored.]"
10754887Schin 		"[+\\f?Formfeed character.]"
10764887Schin 		"[+\\n?Newline character.]"
10774887Schin 		"[+\\t?Tab character.]"
10784887Schin 		"[+\\v?Vertical tab character.]"
10794887Schin 		"[+\\\\?Backslash character.]"
10804887Schin 		"[+\\E?Escape character (ASCII octal 033).]"
10814887Schin 		"[+\\0\ax\a?The 8-bit character whose ASCII code is the "
10824887Schin 			"1-, 2-, or 3-digit octal number \ax\a.]"
10834887Schin 	"}"
10844887Schin "[+?If both \b-e\b and \b-r\b are specified, the last one specified is "
10854887Schin 	"the one that is used.]"
10864887Schin "[+?When the \b-f\b option is specified and there are more \astring\a "
10874887Schin 	"operands than format specifiers, the format string is "
10884887Schin 	"reprocessed from the beginning.  If there are fewer \astring\a "
10894887Schin 	"operands than format specifiers, then outputting will end "
10904887Schin 	"at the first unneeded format specifier.]"
10914887Schin "[e?Unless \b-f\b is specified, process \b\\\b sequences in each \astring\a "
10924887Schin 	"operand as described above. This is the default behavior.]"
10934887Schin "[n?Do not append a new-line character to the output.]"
10944887Schin "[f]:[format?Write the \astring\a arguments using the format string "
10954887Schin 	"\aformat\a and do not append a new-line.  See \bprintf\b for "
10964887Schin 	"details on how to specify \aformat\a.]"
10974887Schin "[p?Write to the current co-process instead of standard output.]"
10984887Schin "[r?Do not process \b\\\b sequences in each \astring\a operand as described "
10994887Schin 	"above.]"
11004887Schin "[s?Write the output as an entry in the shell history file instead of "
11014887Schin 	"standard output.]"
11024887Schin "[u]:[fd:=1?Write to file descriptor number \afd\a instead of standard output.]"
1103*8462SApril.Chin@Sun.COM "[v?Treat each \astring\a as a variable name and write the value in \b%B\b "
1104*8462SApril.Chin@Sun.COM 	"format.  Cannot be used with \b-f\b.]"
11054887Schin "\n"
11064887Schin "\n[string ...]\n"
11074887Schin "\n"
11084887Schin "[+EXIT STATUS?]{"
11094887Schin 	"[+0?Successful completion.]"
11104887Schin 	"[+>0?An error occurred.]"
11114887Schin "}"
11124887Schin "[+SEE ALSO?\becho\b(1), \bprintf\b(1), \bread\b(1)]"
11134887Schin ;
11144887Schin 
11154887Schin const char sh_optprintf[] =
11164887Schin "[-1c?\n@(#)$Id: printf (AT&T Research) 2006-10-26 $\n]"
11174887Schin USAGE_LICENSE
11184887Schin "[+NAME?printf - write formatted output]"
11194887Schin "[+DESCRIPTION?\bprintf\b writes each \astring\a operand to "
11204887Schin 	"standard output using \aformat\a to control the output format.]"
11214887Schin "[+?The \aformat\a operands supports the full range of ANSI C formatting "
11224887Schin 	"specifiers plus the following additional specifiers:]{"
11234887Schin 	"[+%b?Each character in the \astring\a operand is processed "
11244887Schin 		"specially as follows:]{"
11254887Schin 			"[+\\a?Alert character.]"
11264887Schin 			"[+\\b?Backspace character.]"
11274887Schin 			"[+\\c?Terminate output without appending newline. "
11284887Schin 			    "The remaining \astring\a operands are ignored.]"
11294887Schin 			"[+\\f?Formfeed character.]"
11304887Schin 			"[+\\n?Newline character.]"
11314887Schin 			"[+\\t?Tab character.]"
11324887Schin 			"[+\\v?Vertical tab character.]"
11334887Schin 			"[+\\\\?Backslash character.]"
11344887Schin 			"[+\\E?Escape character (ASCII octal 033).]"
11354887Schin 			"[+\\0\ax\a?The 8-bit character whose ASCII code is "
11364887Schin 				"the 1-, 2-, or 3-digit octal number \ax\a.]"
11374887Schin 		"}"
11384887Schin 	"[+%q?Output \astring\a quoted in a manner that it can be read in "
11394887Schin 		"by the shell to get back the same string.  However, empty "
11404887Schin 		"strings resulting from missing \astring\a operands will "
11414887Schin 		"not be quoted.]"
11424887Schin 	"[+%B?Treat the argument as a variable name and output the value "
11434887Schin 		"without converting it to a string.  This is most useful for "
11444887Schin 		"variables of type \b-b\b.]"
11454887Schin 	"[+%H?Output \astring\a with characters \b<\b, \b&\b, \b>\b, "
11464887Schin 		"\b\"\b, and non-printable characters properly escaped for "
11474887Schin 		"use in HTML and XML documents.]"
11484887Schin 	"[+%P?Treat \astring\a as an extended regular expression and  "
11494887Schin 		"convert it to a shell pattern.]"
11504887Schin 	"[+%R?Treat \astring\a as an shell pattern expression and  "
11514887Schin 		"convert it to an extended regular expression.]"
11524887Schin 	"[+%T?Treat \astring\a as a date/time string and format it.  The "
11534887Schin 		"\bT\b can be preceded by \b(\b\adformat\a\b)\b, where "
11544887Schin 		"\adformat\a is a date format as defined by the \bdate\b "
11554887Schin 		"command.]"
11564887Schin 	"[+%Z?Output a byte whose value is \b0\b.]"
11574887Schin "}"
11584887Schin "[+?When performing conversions of \astring\a to satisfy a numeric "
11594887Schin 	"format specifier, if the first character of \astring\a "
11604887Schin 	"is \b\"\b or \b'\b, then the value will be the numeric value "
11614887Schin 	"in the underlying code set of the character following the "
11624887Schin 	"\b\"\b or \b'\b.  Otherwise, \astring\a is treated like a shell "
11634887Schin 	"arithmetic expression and evaluated.]"
11644887Schin "[+?If a \astring\a operand cannot be completed converted into a value "
11654887Schin 	"appropriate for that format specifier, an error will occur, "
11664887Schin 	"but remaining \astring\a operands will continue to be processed.]"
11674887Schin "[+?In addition to the format specifier extensions, the following "
11684887Schin 	"extensions of ANSI-C are permitted in format specifiers:]{"
11694887Schin 	"[+-?The escape sequences \b\\E\b and \b\\e\b expand to the escape "
11704887Schin 		"character which is octal \b033\b in ASCII.]"
11714887Schin 	"[+-?The escape sequence \b\\c\b\ax\a expands to Control-\ax\a.]"
11724887Schin 	"[+-?The escape sequence \b\\C[.\b\aname\a\b.]]\b expands to "
11734887Schin 		"the collating element \aname\a.]"
11744887Schin 	"[+-?The escape sequence \b\\x{\b\ahex\a\b}\b expands to the "
11754887Schin 		"character corresponding to the hexidecimal value \ahex\a.]"
11764887Schin 	"[+-?The format modifier flag \b=\b can be used to center a field to "
11774887Schin 		"a specified width.  When the output is a terminal, the "
11784887Schin 		"character width is used rather than the number of bytes.]"
11794887Schin 	"[+-?Each of the integral format specifiers can have a third "
11804887Schin 		"modifier after width and precision that specifies the "
11814887Schin 		"base of the conversion from 2 to 64.  In this case the "
11824887Schin 		"\b#\b modifier will cause \abase\a\b#\b to be prepended to "
11834887Schin 		"the value.]"
11844887Schin 	"[+-?The \b#\b modifier can be used with the \bd\b specifier when "
11854887Schin 		"no base is specified cause the output to be written in units "
11864887Schin 		"of \b1000\b with a suffix of one of \bk M G T P E\b.]"
11874887Schin 	"[+-?The \b#\b modifier can be used with the \bi\b specifier to "
11884887Schin 		"cause the output to be written in units of \b1024\b with "
11894887Schin 		"a suffix of one of \bKi Mi Gi Ti Pi Ei\b.]"
11904887Schin 	"}"
11914887Schin "[+?If there are more \astring\a operands than format specifiers, the "
11924887Schin 	"\aformat\a string is reprocessed from the beginning.  If there are "
11934887Schin 	"fewer \astring\a operands than format specifiers, then string "
11944887Schin 	"specifiers will be treated as if empty strings were supplied, "
11954887Schin 	"numeric conversions will be treated as if 0 were supplied, and "
11964887Schin 	"time conversions will be treated as if \bnow\b were supplied.]"
11974887Schin "[+?\bprintf\b is equivalent to \bprint -f\b which allows additional "
11984887Schin 	"options to be specified.]"
11994887Schin "\n"
12004887Schin "\nformat [string ...]\n"
12014887Schin "\n"
12024887Schin "[+EXIT STATUS?]{"
12034887Schin 	"[+0?Successful completion.]"
12044887Schin 	"[+>0?An error occurred.]"
12054887Schin "}"
12064887Schin "[+SEE ALSO?\bdate\b(1), \bprint\b(1), \bread\b(1)]"
12074887Schin ;
12084887Schin 
12094887Schin const char sh_optpwd[] =
12104887Schin "[-1c?\n@(#)$Id: pwd (AT&T Research) 1999-06-07 $\n]"
12114887Schin USAGE_LICENSE
12124887Schin "[+NAME?pwd - write working directory name]"
12134887Schin "[+DESCRIPTION?\bpwd\b writes an absolute pathname of the current working "
12144887Schin 	"directory to standard output.   An absolute pathname is a "
12154887Schin 	"pathname that begins with \b/\b that does not contains any "
12164887Schin 	"\b.\b  or \b..\b components.]"
12174887Schin "[+?If both \b-L\b and \b-P\b are specified, the last one specified will "
12184887Schin 	"be used.  If neither \b-P\b or \b-L\b is specified then the "
12194887Schin 	"behavior will be determined by the \bgetconf\b parameter "
12204887Schin 	"\bPATH_RESOLVE\b.  If \bPATH_RESOLVE\b is \bphysical\b, "
12214887Schin 	"then the behavior will be as if \b-P\b were specified.  Otherwise, "
12224887Schin 	"the behavior will be as if  \b-L\b were specified.]"
12234887Schin "[L?The absolute pathname may contains symbolic link components.  This is "
12244887Schin 	"the default.]"
12254887Schin "[P?The absolute pathname will not contain any symbolic link components.]"
12264887Schin "[+EXIT STATUS?]{"
12274887Schin 	"[+0?Successful completion.]"
12284887Schin 	"[+>0?An error occurred.]"
12294887Schin "}"
12304887Schin "[+SEE ALSO?\bcd\b(1), \bgetconf\b(1)]"
12314887Schin ;
12324887Schin 
12334887Schin const char sh_optread[] =
12344887Schin "[-1c?\n@(#)$Id: read (AT&T Research) 2006-12-19 $\n]"
12354887Schin USAGE_LICENSE
12364887Schin "[+NAME?read - read a line from standard input]"
12374887Schin "[+DESCRIPTION?\bread\b reads a line from standard input and breaks it "
12384887Schin 	"into fields using the characters in value of the \bIFS\b variable "
12394887Schin 	"as separators.  The escape character, \b\\\b, is used to remove "
12404887Schin 	"any special meaning for the next character and for line continuation "
12414887Schin 	"unless the \b-r\b option is specified.]"
12424887Schin "[+?If there are more variables than fields, the remaining variables are "
12434887Schin 	"set to empty strings.  If there are fewer variables than fields, "
12444887Schin 	"the leftover fields and their intervening separators are assigned "
1245*8462SApril.Chin@Sun.COM 	"to the last variable.  If no \avar\a is specified then the variable "
12464887Schin 	"\bREPLY\b is used.]"
12474887Schin "[+?When \avar\a has the binary attribute and \b-n\b or \b-N\b is specified, "
12484887Schin 	"the bytes that are read are stored directly into \bvar\b.]"
12494887Schin "[+?If you specify \b?\b\aprompt\a after the first \avar\a, then \bread\b "
12504887Schin 	"will display \aprompt\a on standard error when standard input "
12514887Schin 	"is a terminal or pipe.]"
12524887Schin "[A?Unset \avar\a and then create an indexed array containing each field in "
12534887Schin 	"the line starting at index 0.]"
1254*8462SApril.Chin@Sun.COM "[C?Unset \avar\a and read  \avar\a as a compound variable.]"
12554887Schin "[d]:[delim?Read until delimiter \adelim\a instead of to the end of line.]"
12564887Schin "[p?Read from the current co-process instead of standard input.  An end of "
12574887Schin 	"file causes \bread\b to disconnect the co-process so that another "
12584887Schin 	"can be created.]"
12594887Schin "[r?Do not treat \b\\\b specially when processing the input line.]"
12604887Schin "[s?Save a copy of the input as an entry in the shell history file.]"
12614887Schin "[u]#[fd:=0?Read from file descriptor number \afd\a instead of standard input.]"
12624887Schin "[t]:[timeout?Specify a timeout \atimeout\a in seconds when reading from "
12634887Schin 	"a terminal or pipe.]"
12644887Schin "[n]#[nbyte?Read at most \ansize\a characters.  For binary fields \asize\a "
12654887Schin 	"will be in bytes.]"
12664887Schin "[N]#[nbyte?Read exactly \ansize\a characters.  For binary fields \asize\a "
12674887Schin 	"will be in bytes.]"
12684887Schin "[v?When reading from a terminal the value of the first variable is displayed "
12694887Schin 	"and used as a default value.]"
12704887Schin "\n"
12714887Schin "\n[var?prompt] [var ...]\n"
12724887Schin "\n"
12734887Schin "[+EXIT STATUS?]{"
12744887Schin 	"[+0? Successful completion.]"
12754887Schin 	"[+>0?End of file was detected or an error occurred.]"
12764887Schin "}"
12774887Schin "[+SEE ALSO?\bprint\b(1), \bprintf\b(1), \bcat\b(1)]"
12784887Schin ;
12794887Schin 
12804887Schin const char sh_optreadonly[] =
1281*8462SApril.Chin@Sun.COM "[-1c?\n@(#)$Id: readonly (AT&T Research) 2008-06-16 $\n]"
12824887Schin USAGE_LICENSE
12834887Schin "[+NAME?readonly - set readonly attribute on variables]"
12844887Schin "[+DESCRIPTION?\breadonly\b sets the readonly attribute on each of "
12854887Schin 	"the variables specified by \aname\a which prevents their "
12864887Schin 	"values from being changed.  If \b=\b\avalue\a is specified, "
12874887Schin 	"the variable \aname\a is set to \avalue\a before the variable "
12884887Schin 	"is made readonly.]"
1289*8462SApril.Chin@Sun.COM "[+?Within a type definition, if the value is not specified, then a "
1290*8462SApril.Chin@Sun.COM 	"value must be specified when creating each instance of the type "
1291*8462SApril.Chin@Sun.COM         "and the value is readonly for each instance.]"
12924887Schin "[+?If no \aname\as are specified then the names and values of all "
12934887Schin 	"readonly variables are written to standard output.]"
12944887Schin "[+?\breadonly\b is built-in to the shell as a declaration command so that "
12954887Schin 	"field splitting and pathname expansion are not performed on "
12964887Schin 	"the arguments.  Tilde expansion occurs on \avalue\a.]"
12974887Schin "[p?Causes the output to be in a form of \breadonly\b commands that can be "
12984887Schin 	"used as input to the shell to recreate the current set of "
12994887Schin 	"readonly variables.]"
13004887Schin "\n"
13014887Schin "\n[name[=value]...]\n"
13024887Schin "\n"
13034887Schin "[+EXIT STATUS?]{"
13044887Schin         "[+0?Successful completion.]"
13054887Schin         "[+>0?An error occurred.]"
13064887Schin "}"
13074887Schin 
13084887Schin "[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]"
13094887Schin ;
13104887Schin 
13114887Schin const char sh_optreturn[] =
13124887Schin "[-1c?\n@(#)$Id: return (AT&T Research) 1999-07-07 $\n]"
13134887Schin USAGE_LICENSE
13144887Schin "[+NAME?return - return from a function or dot script ]"
13154887Schin "[+DESCRIPTION?\breturn\b is a shell special built-in that causes the "
13164887Schin 	"function or dot script that invokes it to exit.  "
13174887Schin 	"If \breturn\b is invoked outside of a function or dot script "
13184887Schin 	"it is equivalent to \bexit\b.]"
13194887Schin "[+?If \breturn\b is invoked inside a function defined with the \bfunction\b "
13204887Schin 	"reserved word syntax, then any \bEXIT\b trap set within the "
13214887Schin 	"then function will be invoked in the context of the caller "
13224887Schin 	"before the function returns.]"
13234887Schin "[+?If \an\a is given, it will be used to set the exit status.]"
13244887Schin "\n"
13254887Schin "\n[n]\n"
13264887Schin "\n"
13274887Schin "[+EXIT STATUS?If \an\a is specified, the exit status is the least significant "
13284887Schin 	"eight bits of the value of \an\a.  Otherwise, the exit status is the "
13294887Schin 	"exit status of preceding command.]"
13304887Schin "[+SEE ALSO?\bbreak\b(1), \bexit\b(1)]"
13314887Schin ;
13324887Schin 
13334887Schin 
13344887Schin const char sh_optksh[] =
13354887Schin "+[-1c?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
13364887Schin USAGE_LICENSE
13374887Schin "[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
13384887Schin "[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
13394887Schin 	"executes commands read from a command line string, the "
13404887Schin 	"standard input, or a specified file.]"
13414887Schin "[+?If the \b-i\b option is present, or there are no \aarg\as and "
13424887Schin 	"the standard input and standard error are attached to a "
13434887Schin 	"terminal, the shell is considered to be interactive.]"
13444887Schin "[+?The \b-s\b and \b-c\b options are mutually exclusive.  If the \b-c\b "
13454887Schin 	"option is specified, the first \aarg\a is the command-line string "
13464887Schin 	"and must be specified.  Any remaining \aarg\as will be used "
13474887Schin 	"to initialize \b$0\b and positional parameters.]"
13484887Schin "[+?If the neither \b-s\b nor \b-c\b is specified, then the first \barg\b "
13494887Schin 	"will be the pathname of the file containing commands and \b$0\b "
13504887Schin 	"will be set to this value.  If there is no file with this pathname, "
13514887Schin 	"and this pathame does not contain a \b/\b, then the \bPATH\b "
13524887Schin 	"will be searched for an executable with this name.  Any remaining "
13534887Schin 	"\aarg\as will be used to initialize the positional parmaeters.]"
13544887Schin "[+?Any option can use a \b+\b instead of a \b-\b to disable the corresponding "
13554887Schin 	"option.]"
13564887Schin "[c?Read the commands from the first \aarg\a.]"
13574887Schin "[i?Specifies that the shell is interactive.]"
13584887Schin "[l?Invoke the shell as a login shell; \b/etc/profile\b and \b$HOME/.profile\b, "
13594887Schin 	"if they exist, are read before the first command.]"
13604887Schin "[r\f:restricted\f?Invoke the shell in a restricted mode.  A restricted "
13614887Schin 	"shell does not permit any of the following:]{"
13624887Schin 	"[+-?Changing the working directory.]"
13634887Schin 	"[+-?Setting values or attributes of the variables \bSHELL\b, "
13644887Schin 		"\bENV\b, \bFPATH\b, or \bPATH\b.]"
13654887Schin 	"[+-?Executing any command whose name as a \b/\b in it.]"
13664887Schin 	"[+-?Redirecting output of a command with \b>\b, \b>|\b, "
13674887Schin 		"\b<>\b, or \b>>\b.]"
13684887Schin 	"[+-?Adding or deleting built-in commands or libraries with "
13694887Schin 		"\bbuiltin\b.]"
13704887Schin 	"[+-?Executing \bcommand -p\b \a...\a .]"
13714887Schin 	"}"
13724887Schin "[s?Read the commands from standard input.  The positional parameters will be "
13734887Schin 	"initialized from \aarg\a.]"
13744887Schin "[D\f:dump-strings\f?Do not execute the script, but output the set of double "
13754887Schin 	"quoted strings preceded by a \b$\b.  These strings are needed for "
13764887Schin 	"localization of the script to different locales.]"
1377*8462SApril.Chin@Sun.COM "[E?Reads the file "
1378*8462SApril.Chin@Sun.COM #if SHOPT_SYSRC
1379*8462SApril.Chin@Sun.COM 	"\b/etc/ksh.kshrc\b, if it exists, as a profile, followed by "
1380*8462SApril.Chin@Sun.COM #endif
1381*8462SApril.Chin@Sun.COM 	"\b${ENV-$HOME/.kshrc}\b, if it exists, as a profile. "
13824887Schin 	"On by default for interactive shells; use \b+E\b to disable.]"
13834887Schin #if SHOPT_PFSH
13844887Schin "[P?Invoke the shell as a profile shell.  See \bpfexec\b(1).]"
13854887Schin #endif
13864887Schin #if SHOPT_KIA
13874887Schin "[R]:[file?Do not execute the script, but create a cross reference database "
1388*8462SApril.Chin@Sun.COM 	"in \afile\a that can be used a separate shell script browser.  The "
1389*8462SApril.Chin@Sun.COM 	"-R option requires a script to be specified as the first operand.]"
13904887Schin #endif /* SHOPT_KIA */
13914887Schin #if SHOPT_BASH
13924887Schin    "\fbash2\f"
13934887Schin #endif
13944887Schin "\fabc\f"
13954887Schin "\n"
13964887Schin "\n[arg ...]\n"
13974887Schin "\n"
13984887Schin "[+EXIT STATUS?If \b\f?\f\b executes command, the exit status will be that "
13994887Schin         "of the last command executed.  Otherwise, it will be one of "
14004887Schin         "the following:]{"
14014887Schin         "[+0?The script or command line to be executed consists entirely "
14024887Schin 		"of zero or more blank lines or comments.]"
14034887Schin         "[+>1-125?A noninteractive shell detected a syntax error, a variable "
14044887Schin 		"assignment error, or an error in a special built-in.]"
14054887Schin 	"[+126?\b-c\b and \b-s\b were not specified and the command script "
14064887Schin 		"was found on \bPATH\b but was not executable.]"
14074887Schin 	"[+127?\b-c\b and \b-s\b were not specified and the command script "
14084887Schin 		"corresponding to \aarg\a could not be found.]"
14094887Schin "}"
14104887Schin 
14114887Schin "[+SEE ALSO?\bset\b(1), \bbuiltin\b(1)]"
14124887Schin ;
14134887Schin const char sh_optset[] =
14144887Schin "+[-1c?\n@(#)$Id: set (AT&T Research) 1999-09-28 $\n]"
14154887Schin USAGE_LICENSE
14164887Schin "[+NAME?set - set/unset options and positional parameters]"
14174887Schin "[+DESCRIPTION?\bset\b sets or unsets options and positional parameters.  "
14184887Schin 	"Options that are specified with a \b-\b cause the options to "
14194887Schin 	"be set.  Options that are specified with a \b+\b cause the "
14204887Schin 	"option to be unset.]"
14214887Schin "[+?\bset\b without any options or arguments displays the names and "
14224887Schin 	"values of all shell variables in the order of the collation "
14234887Schin 	"sequence in the current locale.  The values are quoted so that "
14244887Schin 	"they are suitable for reinput to the shell.]"
14254887Schin "[+?If no \aarg\as are specified, not even the end of options argument \b--\b, "
14264887Schin 	"the positional parameters are unchanged.  Otherwise, unless "
14274887Schin 	"the \b-A\b options has been specified, the positional parameters "
14284887Schin 	"are replaced by the list of \aarg\as.  A first \aarg\a of "
14294887Schin 	"\b--\b is ignored when setting positional parameters.]"
14304887Schin "[+?For backward compatibility, a \bset\b command without any options "
14314887Schin 	"specified whose first \aarg\a is \b-\b will turn off "
14324887Schin 	"the \b-v\b and \b-x\b options.  If any additional \aarg\as "
14334887Schin 	"are specified, they will replace the positional parameters.]"
14344887Schin "[s?Sort the positional parameters.]"
14354887Schin "[A]:[name?Assign the arguments sequentially to the array named by \aname\a "
14364887Schin 	"starting at subscript 0 rather than to the positional parameters.]"
14374887Schin "\fabc\f"
1438*8462SApril.Chin@Sun.COM "[06:default?Restore all non-command line options to the default settings.]"
1439*8462SApril.Chin@Sun.COM "[07:state?List the current option state in the form of a \bset\b command "
1440*8462SApril.Chin@Sun.COM 	"that can be executed to restore the state.]"
14414887Schin "\n"
14424887Schin "\n[arg ...]\n"
14434887Schin "\n"
14444887Schin "[+EXIT STATUS?]{"
14454887Schin         "[+0?No errors occurred.]"
14464887Schin         "[+>0?An error occurred.]"
14474887Schin "}"
14484887Schin 
14494887Schin "[+SEE ALSO?\btypeset\b(1), \bshift\b(1)]"
14504887Schin ;
14514887Schin 
14524887Schin 
14534887Schin 
14544887Schin const char sh_optshift[] =
14554887Schin "[-1c?\n@(#)$Id: shift (AT&T Research) 1999-07-07 $\n]"
14564887Schin USAGE_LICENSE
14574887Schin "[+NAME?shift - shift positional parameters]"
14584887Schin "[+DESCRIPTION?\bshift\b is a shell special built-in that shifts the "
14594887Schin 	"positional parameters to the left by the number of places "
14604887Schin 	"defined by \an\a, or \b1\b if \an\a is omitted.  The number of "
14614887Schin 	"positional parameters remaining will be reduced by the "
14624887Schin 	"number of places that are shifted.]"
14634887Schin "[+?If \an\a is given, it will be evaluated as an arithmetic expression "
14644887Schin 	"to determinate the number of places to shift.  It is an error "
14654887Schin 	"to shift more than the number of positional parameters or a "
14664887Schin 	"negative number of places.]"
14674887Schin "\n"
14684887Schin "\n[n]\n"
14694887Schin "\n"
14704887Schin "[+EXIT STATUS?]{"
14714887Schin         "[+0?The positional parameters were successfully shifted.]"
14724887Schin         "[+>0?An error occurred.]"
14734887Schin "}"
14744887Schin "[+SEE ALSO?\bset\b(1)]"
14754887Schin ;
14764887Schin 
14774887Schin const char sh_optsleep[] =
14784887Schin "[-1c?\n@(#)$Id: sleep (AT&T Research) 1999-04-07 $\n]"
14794887Schin USAGE_LICENSE
14804887Schin "[+NAME?sleep - suspend execution for an interval]"
14814887Schin "[+DESCRIPTION?\bsleep\b suspends execution for at least the time specified "
14824887Schin 	"by \aseconds\a or until a \bSIGALRM\b signal is received.  "
1483*8462SApril.Chin@Sun.COM 	"\aseconds\a can be specified as a floating point number but the "
14844887Schin 	"actual granularity depends on the underlying system, normally "
14854887Schin 	"around 1 millisecond.]"
14864887Schin "\n"
14874887Schin "\nseconds\n"
14884887Schin "\n"
14894887Schin "[+EXIT STATUS?]{"
14904887Schin 	"[+0?The execution was successfully suspended for at least \atime\a "
14914887Schin 	"seconds, or a \bSIGALRM\b signal was received.]"
14924887Schin 	"[+>0?An error occurred.]"
14934887Schin "}"
14944887Schin "[+SEE ALSO?\btime\b(1), \bwait\b(1)]"
14954887Schin ;
14964887Schin 
14974887Schin const char sh_opttrap[] =
14984887Schin "[-1c?\n@(#)$Id: trap (AT&T Research) 1999-07-17 $\n]"
14994887Schin USAGE_LICENSE
15004887Schin "[+NAME?trap - trap signals and conditions]"
15014887Schin "[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be "
15024887Schin 	"taken when conditions such as receiving a signal occur.  Also, "
15034887Schin 	"\btrap\b can be used to display the current trap settings on "
15044887Schin 	"standard output.]"
15054887Schin "[+?If \aaction\a is \b-\b, \btrap\b resets each \acondition\a "
15064887Schin 	"to the default value.  If \aaction\a is an empty string, the "
15074887Schin 	"shell ignores each of the \acondition\as if they arise. "
15084887Schin 	"Otherwise, the argument \aaction\a will be read and executed "
15094887Schin 	"by the shell as if it were processed by \beval\b(1) when one "
15104887Schin 	"of the corresponding conditions arise.  The action of the trap "
15114887Schin 	"will override any previous action associated with each specified "
15124887Schin 	"\acondition\a.  The value of \b$?\b is not altered by the trap "
15134887Schin 	"execution.]"
15144887Schin "[+?\acondition\a can be the name or number of a signal, or one of the "
15154887Schin 	"following:]{"
15164887Schin 	"[+EXIT?This trap is executed when the shell exits.  If defined "
15174887Schin 		"within a function defined with the \bfunction\b reserved "
15184887Schin 		"word, the trap is executed in the caller's environment "
15194887Schin 		"when the function returns and the trap action is restored "
15204887Schin 		"to the value it had when it called the function.]"
15214887Schin 	"[+0?Same as EXIT.]"
15224887Schin 	"[+DEBUG?Executed before each simple command is executed but after "
15234887Schin 		"the arguments are expanded.]"
15244887Schin 	"[+ERR?Executed whenever \bset -e\b would cause the shell to exit.]"
15254887Schin 	"[+KEYBD?Executed when a key is entered from a terminal device.]"
15264887Schin "}"
15274887Schin "[+?Signal names are case insensitive and the \bsig\b prefix is optional.  "
15284887Schin 	"Signals that were ignored on entry to a noninteractive shell cannot "
15294887Schin 	"trapped or reset although doing so will not report an error.  The "
15304887Schin 	"use of signal numbers other than \b1\b, \b2\b, \b3\b, \b6\b, "
15314887Schin 	"\b9\b, \b14\b, and \b15\b is not portable.]"
15324887Schin "[+?Although \btrap\b is a special built-in, specifying a condition that "
15334887Schin 	"the shell does not know about causes \btrap\b to exit with a "
15344887Schin 	"non-zero exit status, but does not terminate the invoking shell.]"
15354887Schin "[+?If no \aaction\a or \acondition\as are specified then all the current "
15364887Schin 	"trap settings are written to standard output.]"
15374887Schin "[p?Causes the current traps to be output in a format that can be processed "
15384887Schin 	"as input to the shell to recreate the current traps.]"
15394887Schin "\n"
15404887Schin "\n[action condition ...]\n"
15414887Schin "\n"
15424887Schin "[+EXIT STATUS?]{"
15434887Schin         "[+0?Successful completion.]"
15444887Schin         "[+>0?An error occurred.]"
15454887Schin "}"
15464887Schin 
15474887Schin "[+SEE ALSO?\bkill\b(1), \beval\b(1), \bsignal\b(3)]"
15484887Schin ;
15494887Schin 
15504887Schin const char sh_opttypeset[] =
1551*8462SApril.Chin@Sun.COM "+[-1c?\n@(#)$Id: typeset (AT&T Research) 2008-08-04 $\n]"
15524887Schin USAGE_LICENSE
15534887Schin "[+NAME?\f?\f - declare or display variables with attributes]"
15544887Schin "[+DESCRIPTION?Without the \b-f\b option, \b\f?\f\b sets, unsets, "
15554887Schin 	"or displays attributes of variables as specified with the "
15564887Schin 	"options.  If the first option is specified with a \b-\b "
15574887Schin 	"then the attributes are set for each of the given \aname\as. "
15584887Schin 	"If the first option is specified with a \b+\b, then the specified "
15594887Schin 	"attributes are unset.  If \b=\b\avalue\a is specified value is "
15604887Schin 	"assigned before the attributes are set.]"
15614887Schin "[+?When \b\f?\f\b is called inside a function defined with the "
15624887Schin 	"\bfunction\b reserved word, and \aname\a does not contain a "
15634887Schin 	"\b.\b, then a local variable statically scoped to  that function "
15644887Schin 	"will be created.]"
15654887Schin "[+?Not all option combinations are possible.  For example, the numeric "
15664887Schin 	"options \b-i\b, \b-E\b, and \b-F\b cannot be specified with "
15674887Schin 	"the justification options \b-L\b, \b-R\b, and \b-Z\b.]"
15684887Schin "[+?Note that the following preset aliases are set by the shell:]{"
15694887Schin 	"[+float?\b\f?\f -E\b.]"
15704887Schin 	"[+functions?\b\f?\f -f\b.]"
15714887Schin 	"[+integer?\b\f?\f -i\b.]"
15724887Schin 	"[+nameref?\b\f?\f -n\b.]"
15734887Schin "}"
15744887Schin "[+?If no \aname\as are specified then variables that have the specified "
15754887Schin 	"options are displayed.  If the first option is specified with "
15764887Schin 	"a leading \b-\b then the name and value of each variable is "
15774887Schin 	"written to standard output.  Otherwise, only the names are "
15784887Schin 	"written.  If no options are specified or just \b-p\b is "
15794887Schin 	"specified, then the names and attributes of all variables that have "
15804887Schin 	"attributes are written to standard output.  When \b-f\b is specified, "
15814887Schin 	"the names displayed will be function names.]"
15824887Schin "[+?If \b-f\b is specified, then each \aname\a refers to a function "
15834887Schin 	"and the only valid options are \b-u\b and \b-t\b.  In this "
15844887Schin 	"case no \b=\b\avalue\a can be specified.]"
15854887Schin "[+?\b\f?\f\b is built-in to the shell as a declaration command so that "
15864887Schin 	"field splitting and pathname expansion are not performed on "
15874887Schin 	"the arguments.  Tilde expansion occurs on \avalue\a.]"
1588*8462SApril.Chin@Sun.COM #if 1
1589*8462SApril.Chin@Sun.COM "[a]:?[type?Indexed array.  This is the default. If \b[\b\atype\a\b]]\b is "
1590*8462SApril.Chin@Sun.COM     "specified, each subscript is interpreted as a value of type \atype\a.]"
1591*8462SApril.Chin@Sun.COM #else
1592*8462SApril.Chin@Sun.COM "[a?Indexed array. this is the default.]"
15934887Schin #endif
15944887Schin "[b?Each \aname\a may contain binary data.  Its value is the mime "
15954887Schin 	"base64 encoding of the data. It can be used with \b-Z\b, "
15964887Schin 	"to specify fixed sized fields.]"
15974887Schin "[f?Each of the options and \aname\as refers to a function.]"
15984887Schin "[i]#?[base:=10?An integer. \abase\a represents the arithmetic base "
15994887Schin 	"from 2 to 64.]"
16004887Schin "[l?Convert uppercase character to lowercase.  Unsets \b-u\b attribute.  When "
16014887Schin 	"used with \b-i\b, \b-E\b, or \b-F\b indicates long variant.]"
1602*8462SApril.Chin@Sun.COM "[m?Move.  The value is the name of a variable whose value will be "
1603*8462SApril.Chin@Sun.COM 	"moved to \aname\a.  The orignal variable will be unset.  Cannot be "
1604*8462SApril.Chin@Sun.COM 	"used with any other options.]"
16054887Schin "[n?Name reference.  The value is the name of a variable that \aname\a "
1606*8462SApril.Chin@Sun.COM 	"references.  \aname\a cannot contain a \b.\b.  Cannot be use with "
1607*8462SApril.Chin@Sun.COM 	"any other options.]"
16084887Schin "[p?Causes the output to be in a format that can be used as input to the "
16094887Schin 	"shell to recreate the attributes for variables.]"
16104887Schin "[r?Enables readonly.  Once enabled it cannot be disabled.  See "
16114887Schin 	"\breadonly\b(1).]"
16124887Schin "[s?Used with \b-i\b to restrict integer size to short.]"
16134887Schin "[t?When used with \b-f\b, enables tracing for each of the specified "
16144887Schin 	"functions.  Otherwise, \b-t\b is a user defined attribute and "
16154887Schin 	"has no meaning to the shell.]"
16164887Schin "[u?Without \b-f\b or \b-i\b, converts lowercase character to uppercase "
16174887Schin 	"and unsets \b-l\b.  With \b-f\b specifies that \aname\a is a function "
16184887Schin 	"that hasn't been loaded yet.  With \b-i\b specifies that the "
16194887Schin 	"value will be displayed as an unsigned integer.]"
16204887Schin "[x?Puts each \aname\a on the export list.  See \bexport\b(1).  \aname\a "
16214887Schin 	"cannot contain a \b.\b.]"
16224887Schin "[A?Associative array.  Each \aname\a will converted to an associate "
16234887Schin 	"array.  If a variable already exists, the current value will "
16244887Schin 	"become index \b0\b.]"
1625*8462SApril.Chin@Sun.COM "[C?Compound variable.  Each \aname\a will be a compound variable.  If "
1626*8462SApril.Chin@Sun.COM 	"\avalue\a names a compound variable it will be copied to \aname\a. "
1627*8462SApril.Chin@Sun.COM 	"Otherwise if the variable already exists, it will first be unset.]"
16284887Schin "[E]#?[n:=10?Floating point number represented in scientific notation. "
16294887Schin 	"\an\a specifies the number of significant figures when the "
16304887Schin 	"value is expanded.]"
16314887Schin "[F]#?[n:=10?Floating point.  \an\a is the number of places after the "
16324887Schin 	"decimal point when the value is expanded.]"
16334887Schin "[H?Hostname mapping.  Each \aname\a holds a native pathname.  Assigning a "
16344887Schin 	"UNIX format pathname will cause it to be converted to a pathname "
16354887Schin 	"suitable for the current host.  This has no effect when the "
16364887Schin 	"native system is UNIX.]"
16374887Schin "[L]#?[n?Left justify.  If \an\a is given it represents the field width.  If "
16384887Schin 	"the \b-Z\b attribute is also specified, then leading zeros are "
16394887Schin 	"stripped.]"
16404887Schin "[R]#?[n?Right justify.  If \an\a is given it represents the field width.  If "
16414887Schin 	"the \b-Z\b attribute is also specified, then zeros will "
16424887Schin 	"be used as the fill character.  Otherwise, spaces are used.]"
1643*8462SApril.Chin@Sun.COM "[X]#?[n:=10?Floating point number represented in hexadecimal notation. "
1644*8462SApril.Chin@Sun.COM 	"\an\a specifies the number of significant figures when the "
1645*8462SApril.Chin@Sun.COM 	"value is expanded.]"
1646*8462SApril.Chin@Sun.COM 
1647*8462SApril.Chin@Sun.COM #ifdef SHOPT_TYPEDEF
1648*8462SApril.Chin@Sun.COM "[h]:[string?Used within a type definition to provide a help string  "
1649*8462SApril.Chin@Sun.COM 	"for variable \aname\a.  Otherwise, it is ignored.]"
1650*8462SApril.Chin@Sun.COM "[S?Used with a type definition to indicate that the variable is shared by "
1651*8462SApril.Chin@Sun.COM 	"each instance of the type.  When used inside a function defined "
1652*8462SApril.Chin@Sun.COM 	"with the \bfunction\b reserved word, the specified variables "
1653*8462SApril.Chin@Sun.COM 	"will have function static scope.  Otherwise, the variable is "
1654*8462SApril.Chin@Sun.COM 	"unset prior to processing the assignment list.]"
1655*8462SApril.Chin@Sun.COM #endif
16564887Schin "[T]:[tname?\atname\a is the name of a type name given to each \aname\a.]"
16574887Schin "[Z]#?[n?Zero fill.  If \an\a is given it represents the field width.]"
16584887Schin "\n"
16594887Schin "\n[name[=value]...]\n"
16604887Schin " -f [name...]\n"
16614887Schin "\n"
16624887Schin "[+EXIT STATUS?]{"
16634887Schin         "[+0?No errors occurred.]"
16644887Schin         "[+>0?An error occurred.]"
16654887Schin "}"
16664887Schin 
16674887Schin "[+SEE ALSO?\breadonly\b(1), \bexport\b(1)]"
16684887Schin ;
16694887Schin 
16704887Schin const char sh_optulimit[] =
16714887Schin "[-1c?@(#)$Id: ulimit (AT&T Research) 2003-06-21 $\n]"
16724887Schin USAGE_LICENSE
16734887Schin "[+NAME?ulimit - set or display resource limits]"
16744887Schin "[+DESCRIPTION?\bulimit\b sets or displays resource limits.  These "
16754887Schin 	"limits apply to the current process and to each child process "
16764887Schin 	"created after the resource limit has been set.  If \alimit\a "
16774887Schin 	"is specified, the resource limit is set, otherwise, its current value "
16784887Schin 	"is displayed on standard output.]"
16794887Schin "[+?Increasing the limit for a resource usually requires special privileges.  "
16804887Schin 	"Some systems allow you to lower resource limits and later increase "
16814887Schin 	"them.  These are called soft limits.  Once a hard limit is "
16824887Schin 	"set the resource can not be increased.]"
16834887Schin "[+?Different systems allow you to specify different resources and some "
16844887Schin 	"restrict how much you can raise the limit of the resource.]"
16854887Schin "[+?The value of \alimit\a depends on the unit of the resource listed "
16864887Schin 	"for each resource.  In addition, \alimit\a can be \bunlimited\b "
16874887Schin 	"to indicate no limit for that resource.]"
16884887Schin "[+?If you do not specify \b-H\b or \b-S\b, then \b-S\b is used for "
16894887Schin 	"listing and both \b-S\b and \b-H\b are used for setting resources.]"
16904887Schin "[+?If you do not specify any resource, the default is \b-f\b.]"
16914887Schin "[H?A hard limit is set or displayed.]"
16924887Schin "[S?A soft limit is set or displayed.]"
16934887Schin "[a?Displays all current resource limits]"
16944887Schin "\flimits\f"
16954887Schin "\n"
16964887Schin "\n[limit]\n"
16974887Schin "\n"
16984887Schin "[+EXIT STATUS?]{"
16994887Schin 	"[+0?Successful completion.]"
17004887Schin 	"[+>0?A request for a higher limit was rejected or an error occurred.]"
17014887Schin "}"
17024887Schin 
17034887Schin "[+SEE ALSO?\bulimit\b(2), \bgetrlimit\b(2)]"
17044887Schin ;
17054887Schin 
17064887Schin const char sh_optumask[] =
17074887Schin "[-1c?\n@(#)$Id: umask (AT&T Research) 1999-04-07 $\n]"
17084887Schin USAGE_LICENSE
17094887Schin "[+NAME?umask - get or set the file creation mask]"
17104887Schin "[+DESCRIPTION?\bumask\b sets the file creation mask of the current "
17114887Schin 	"shell execution environment to the value specified by the "
17124887Schin 	"\amask\a operand.  This mask affects the file permission bits "
17134887Schin 	"of subsequently created files.  \amask\a can either be an "
17144887Schin 	"octal number or a symbolic value as described in \bchmod\b(1).  "
17154887Schin 	"If a symbolic value is given, the new file creation mask is the "
17164887Schin 	"complement of the result of applying \amask\a to the complement "
17174887Schin 	"of the current file creation mask.]"
17184887Schin "[+?If \amask\a is not specified, \bumask\b writes the value of the "
17194887Schin 	"file creation mask for the current process to standard output.]"
17204887Schin "[S?Causes the file creation mask to be written or treated as a symbolic value "
17214887Schin 	"rather than an octal number.]"
17224887Schin "\n"
17234887Schin "\n[mask]\n"
17244887Schin "\n"
17254887Schin "[+EXIT STATUS?]{"
17264887Schin 	"[+0?The file creation mask was successfully changed, or no "
17274887Schin 		"\amask\a operand was supplied.]"
17284887Schin 	"[+>0?An error occurred.]"
17294887Schin "}"
17304887Schin "[+SEE ALSO?\bchmod\b(1)]"
17314887Schin ;
17324887Schin const char sh_optuniverse[]	= " [name]";
17334887Schin const char sh_optunset[] =
17344887Schin "[-1c?\n@(#)$Id: unset (AT&T Research) 1999-07-07 $\n]"
17354887Schin USAGE_LICENSE
17364887Schin "[+NAME?unset - unset values and attributes of variables and functions]"
17374887Schin "[+DESCRIPTION?For each \aname\a specified, \bunset\b  unsets the variable, "
17384887Schin 	"or function if \b-f\b is specified, from the current shell "
17394887Schin 	"execution environment.  Readonly variables cannot be unset.]"
17404887Schin "[n?If \aname\a refers to variable that is a reference, the variable \aname\a "
17414887Schin 	"will be unset rather than the variable it references.  Otherwise, "
17424887Schin 	"is is equivalent to \b-v\b.]"
17434887Schin "[f?\aname\a refers to a function name and the shell will unset the "
17444887Schin 	"function definition.]"
17454887Schin "[v?\aname\a refers to a variable name and the shell will unset it and "
17464887Schin 	"remove it from the environment.  This is the default behavior.]"
17474887Schin "\n"
17484887Schin "\nname...\n"
17494887Schin "\n"
17504887Schin "[+EXIT STATUS?]{"
17514887Schin         "[+0?All \aname\as were successfully unset.]"
17524887Schin         "[+>0?One or more \aname\a operands could not be unset "
17534887Schin 	"or an error occurred.]"
17544887Schin "}"
17554887Schin 
17564887Schin "[+SEE ALSO?\btypeset\b(1)]"
17574887Schin ;
17584887Schin 
17594887Schin const char sh_optunalias[] =
17604887Schin "[-1c?\n@(#)$Id: unalias (AT&T Research) 1999-07-07 $\n]"
17614887Schin USAGE_LICENSE
17624887Schin "[+NAME?unalias - remove alias definitions]"
17634887Schin "[+DESCRIPTION?\bunalias\b removes the definition of each named alias "
17644887Schin 	"from the current shell execution environment, or all aliases if "
17654887Schin 	"\b-a\b is specified.  It will not affect any commands that "
17664887Schin 	"have already been read and subsequently executed.]"
17674887Schin "[a?Causes all alias definitions to be removed.  \aname\a operands "
17684887Schin 	"are optional and ignored in this case.]"
17694887Schin "\n"
17704887Schin "\nname...\n"
17714887Schin "\n"
17724887Schin "[+EXIT STATUS?]{"
17734887Schin         "[+0?Successful completion.]"
17744887Schin         "[+>0?\b-a\b was not specified and one or more \aname\a operands "
17754887Schin 	"did not have an alias definition, or an error occurred.]"
17764887Schin "}"
17774887Schin 
17784887Schin "[+SEE ALSO?\balias\b(1)]"
17794887Schin ;
17804887Schin 
17814887Schin const char sh_optwait[]	=
17824887Schin "[-1c?\n@(#)$Id: wait (AT&T Research) 1999-06-17 $\n]"
17834887Schin USAGE_LICENSE
17844887Schin "[+NAME?wait - wait for process or job completion]"
17854887Schin "[+DESCRIPTION?\bwait\b with no operands, waits until all jobs "
17864887Schin 	"known to the invoking shell have terminated.  If one or more "
17874887Schin 	"\ajob\a operands are specified, \bwait\b waits until all of them "
17884887Schin 	"have completed.]"
17894887Schin "[+?Each \ajob\a can be specified as one of the following:]{"
17904887Schin 	"[+\anumber\a?\anumber\a refers to a process id.]"
17914887Schin 	"[+-\anumber\a?\anumber\a refers to a process group id.]"
17924887Schin 	"[+%\anumber\a?\anumber\a refer to a job number.]"
17934887Schin 	"[+%\astring\a?Refers to a job whose name begins with \astring\a.]"
17944887Schin 	"[+%??\astring\a?Refers to a job whose name contains \astring\a.]"
17954887Schin 	"[+%+ \bor\b %%?Refers to the current job.]"
17964887Schin 	"[+%-?Refers to the previous job.]"
17974887Schin "}"
17984887Schin "[+?If one ore more \ajob\a operands is a process id or process group id "
17994887Schin 	"not known by the current shell environment, \bwait\b treats each "
18004887Schin 	"of them as if it were a process that exited with status 127.]"
18014887Schin "\n"
18024887Schin "\n[job ...]\n"
18034887Schin "\n"
18044887Schin "[+EXIT STATUS?If \await\a is invoked with one or more \ajob\as, and all of "
18054887Schin 	"them have terminated or were not known by the invoking shell, "
18064887Schin 	"the exit status of \bwait\b  will be that of the last \ajob\a.  "
18074887Schin 	"Otherwise, it will be one of the following:]{"
18084887Schin 	"[+0?\bwait\b utility was invoked with no operands and all "
18094887Schin 		"processes known by the invoking process have terminated.]"
18104887Schin 	"[+127?\ajob\a is a process id or process group id that is unknown "
18114887Schin 		"to the current shell environment.]"
18124887Schin "}"
18134887Schin 
18144887Schin "[+SEE ALSO?\bjobs\b(1), \bps\b(1)]"
18154887Schin ;
18164887Schin 
18174887Schin #if SHOPT_FS_3D
18184887Schin     const char sh_optvpath[]	= " [top] [base]";
18194887Schin     const char sh_optvmap[]	= " [dir] [list]";
18204887Schin #endif /* SHOPT_FS_3D */
18214887Schin 
18224887Schin const char sh_optwhence[] =
1823*8462SApril.Chin@Sun.COM "[-1c?\n@(#)$Id: whence (AT&T Research) 2007-04-24 $\n]"
18244887Schin USAGE_LICENSE
18254887Schin "[+NAME?whence - locate a command and describe its type]"
18264887Schin "[+DESCRIPTION?Without \b-v\b, \bwhence\b writes on standard output an "
18274887Schin 	"absolute pathname, if any, corresponding to \aname\a based "
18284887Schin 	"on the complete search order that the shell uses.  If \aname\a "
18294887Schin 	"is not found, then no output is produced.]"
18304887Schin "[+?If \b-v\b is specified, the output will also contain information "
1831*8462SApril.Chin@Sun.COM 	"that indicates how the given \aname\a would be interpreted by "
18324887Schin 	"the shell in the current execution environment.]"
18334887Schin "[a?Displays all uses for each \aname\a rather than the first.]"
18344887Schin "[f?Do not check for functions.]"
18354887Schin "[p?Do not check to see if \aname\a is a reserved word, a built-in, "
1836*8462SApril.Chin@Sun.COM 	"an alias, or a function.  This turns off the \b-v\b option.]"
1837*8462SApril.Chin@Sun.COM "[q?Quiet mode. Returns 0 if all arguments are built-ins, functions, or are "
1838*8462SApril.Chin@Sun.COM 	"programs found on the path.]"
18394887Schin "[v?For each name you specify, the shell displays a line that indicates "
18404887Schin 	"if that name is one of the following:]{"
18414887Schin 	"[+?Reserved word]"
18424887Schin 	"[+?Alias]"
18434887Schin 	"[+?Built-in]"
18444887Schin 	"[+?Undefined function]"
18454887Schin 	"[+?Function]"
18464887Schin 	"[+?Tracked alias]"
18474887Schin 	"[+?Program]"
18484887Schin "}"
18494887Schin "\n"
18504887Schin "\nname  ...\n"
18514887Schin "\n"
18524887Schin "[+EXIT STATUS?]{"
18534887Schin 	"[+0?Each \aname\a was found by the shell.]"
18544887Schin 	"[+1?One or more \aname\as were not found by the shell.]"
18554887Schin 	"[+>1?An error occurred.]"
18564887Schin "}"
18574887Schin 
18584887Schin "[+SEE ALSO?\bcommand\b(1)]"
18594887Schin ;
18604887Schin 
18614887Schin 
18624887Schin const char e_alrm1[]		= "alarm -r %s +%.3g\n";
18634887Schin const char e_alrm2[]		= "alarm %s %.3f\n";
18644887Schin const char e_baddisc[]		= "%s: invalid discipline function";
18654887Schin const char e_nospace[]		= "out of memory";
18664887Schin const char e_nofork[]		= "cannot fork";
18674887Schin const char e_nosignal[]		= "%s: unknown signal name";
18684887Schin const char e_condition[]	= "condition(s) required";
18694887Schin const char e_cneedsarg[]	= "-c requires argument";
1870