//config: variable each time it is displayed.
//config:
-//usage:#define ash_trivial_usage NOUSAGE_STR
-//usage:#define ash_full_usage ""
-//usage:#define sh_trivial_usage NOUSAGE_STR
-//usage:#define sh_full_usage ""
-//usage:#define bash_trivial_usage NOUSAGE_STR
-//usage:#define bash_full_usage ""
-
/* ============ Hash table sizes. Configurable. */
/* NOTREACHED */
}
static int
+
options(int cmdline)
{
char *p;
else if (*argptr == NULL)
setparam(argptr);
}
- break; /* "-" or "--" terminates options */
+ break; /* "-" or "--" terminates options */
}
}
/* first char was + or - */
if (!argv[1])
return showvars(nullstr, 0, VUNSET);
+
INT_OFF;
- retval = 1;
- if (!options(0)) { /* if no parse error... */
- retval = 0;
+ retval = options(/*cmdline:*/ 0);
+ if (retval == 0) { /* if no parse error... */
optschanged();
if (*argptr != NULL) {
setparam(argptr);
setvar("PPID", utoa(getppid()), 0);
p = lookupvar("PWD");
- if (p)
+ if (p) {
if (*p != '/' || stat(p, &st1) || stat(".", &st2)
- || st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
+ || st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino
+ ) {
p = '\0';
+ }
+ }
setpwd(p, 0);
}
}
+
+//usage:#define ash_trivial_usage
+//usage: "[-/+OPTCHARS] [-/+o OPTNAME]... [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]"
+//usage:#define ash_full_usage "\n\n"
+//usage: "Unix shell interpreter"
+
+//usage:#if ENABLE_FEATURE_SH_IS_ASH
+//usage:# define sh_trivial_usage ash_trivial_usage
+//usage:# define sh_full_usage ash_full_usage
+//usage:#endif
+//usage:#if ENABLE_FEATURE_BASH_IS_ASH
+//usage:# define bash_trivial_usage ash_trivial_usage
+//usage:# define bash_full_usage ash_full_usage
+//usage:#endif
+
/*
* Process the shell command line arguments.
*/
for (i = 0; i < NOPTS; i++)
optlist[i] = 2;
argptr = xargv;
- if (options(1)) {
+ if (options(/*cmdline:*/ 1)) {
/* it already printed err message */
raise_exception(EXERROR);
}
* therefore we don't show them either.
*/
//usage:#define hush_trivial_usage
-//usage: "[-nx] [-c SCRIPT]"
-//usage:#define hush_full_usage ""
+//usage: "[-nx] [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]"
+//usage:#define hush_full_usage "\n\n"
+//usage: "Unix shell interpreter"
+
//usage:#define msh_trivial_usage hush_trivial_usage
-//usage:#define msh_full_usage ""
-//usage:#define sh_trivial_usage NOUSAGE_STR
-//usage:#define sh_full_usage ""
-//usage:#define bash_trivial_usage NOUSAGE_STR
-//usage:#define bash_full_usage ""
+//usage:#define msh_full_usage hush_full_usage
+
+//usage:#if ENABLE_FEATURE_SH_IS_HUSH
+//usage:# define sh_trivial_usage hush_trivial_usage
+//usage:# define sh_full_usage hush_full_usage
+//usage:#endif
+//usage:#if ENABLE_FEATURE_BASH_IS_HUSH
+//usage:# define bash_trivial_usage hush_trivial_usage
+//usage:# define bash_full_usage hush_full_usage
+//usage:#endif
/* Build knobs */