ash/hush: provide help text
$ ./busybox ash --help BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary. Usage: ash [-/+OPTCHARS] [-/+o OPTNAME]... [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]] Unix shell interpreter $ ./busybox hush --help BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary. Usage: hush [-nx] [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]] Unix shell interpreter function old new delta packed_usage 28163 28212 +49 setcmd 85 78 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 49/-7) Total: 42 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
aefe1c260e
commit
b0b834342f
40
shell/ash.c
40
shell/ash.c
@ -190,13 +190,6 @@
|
|||||||
//config: variable each time it is displayed.
|
//config: variable each time it is displayed.
|
||||||
//config:
|
//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. */
|
/* ============ Hash table sizes. Configurable. */
|
||||||
|
|
||||||
@ -10155,6 +10148,7 @@ setoption(int flag, int val)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
static int
|
static int
|
||||||
|
|
||||||
options(int cmdline)
|
options(int cmdline)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -10180,7 +10174,7 @@ options(int cmdline)
|
|||||||
else if (*argptr == NULL)
|
else if (*argptr == NULL)
|
||||||
setparam(argptr);
|
setparam(argptr);
|
||||||
}
|
}
|
||||||
break; /* "-" or "--" terminates options */
|
break; /* "-" or "--" terminates options */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* first char was + or - */
|
/* first char was + or - */
|
||||||
@ -10282,10 +10276,10 @@ setcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
|||||||
|
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
return showvars(nullstr, 0, VUNSET);
|
return showvars(nullstr, 0, VUNSET);
|
||||||
|
|
||||||
INT_OFF;
|
INT_OFF;
|
||||||
retval = 1;
|
retval = options(/*cmdline:*/ 0);
|
||||||
if (!options(0)) { /* if no parse error... */
|
if (retval == 0) { /* if no parse error... */
|
||||||
retval = 0;
|
|
||||||
optschanged();
|
optschanged();
|
||||||
if (*argptr != NULL) {
|
if (*argptr != NULL) {
|
||||||
setparam(argptr);
|
setparam(argptr);
|
||||||
@ -12938,14 +12932,32 @@ init(void)
|
|||||||
setvar("PPID", utoa(getppid()), 0);
|
setvar("PPID", utoa(getppid()), 0);
|
||||||
|
|
||||||
p = lookupvar("PWD");
|
p = lookupvar("PWD");
|
||||||
if (p)
|
if (p) {
|
||||||
if (*p != '/' || stat(p, &st1) || stat(".", &st2)
|
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';
|
p = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
setpwd(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.
|
* Process the shell command line arguments.
|
||||||
*/
|
*/
|
||||||
@ -12963,7 +12975,7 @@ procargs(char **argv)
|
|||||||
for (i = 0; i < NOPTS; i++)
|
for (i = 0; i < NOPTS; i++)
|
||||||
optlist[i] = 2;
|
optlist[i] = 2;
|
||||||
argptr = xargv;
|
argptr = xargv;
|
||||||
if (options(1)) {
|
if (options(/*cmdline:*/ 1)) {
|
||||||
/* it already printed err message */
|
/* it already printed err message */
|
||||||
raise_exception(EXERROR);
|
raise_exception(EXERROR);
|
||||||
}
|
}
|
||||||
|
21
shell/hush.c
21
shell/hush.c
@ -255,14 +255,21 @@
|
|||||||
* therefore we don't show them either.
|
* therefore we don't show them either.
|
||||||
*/
|
*/
|
||||||
//usage:#define hush_trivial_usage
|
//usage:#define hush_trivial_usage
|
||||||
//usage: "[-nx] [-c SCRIPT]"
|
//usage: "[-nx] [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]"
|
||||||
//usage:#define hush_full_usage ""
|
//usage:#define hush_full_usage "\n\n"
|
||||||
|
//usage: "Unix shell interpreter"
|
||||||
|
|
||||||
//usage:#define msh_trivial_usage hush_trivial_usage
|
//usage:#define msh_trivial_usage hush_trivial_usage
|
||||||
//usage:#define msh_full_usage ""
|
//usage:#define msh_full_usage hush_full_usage
|
||||||
//usage:#define sh_trivial_usage NOUSAGE_STR
|
|
||||||
//usage:#define sh_full_usage ""
|
//usage:#if ENABLE_FEATURE_SH_IS_HUSH
|
||||||
//usage:#define bash_trivial_usage NOUSAGE_STR
|
//usage:# define sh_trivial_usage hush_trivial_usage
|
||||||
//usage:#define bash_full_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 */
|
/* Build knobs */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user