mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
busybox --list option. +140 bytes. Rob wanted it.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
f2c16edf99
commit
5a7c72015c
@ -595,6 +595,17 @@ static void check_suid(int applet_no)
|
|||||||
|
|
||||||
|
|
||||||
#if ENABLE_FEATURE_INSTALLER
|
#if ENABLE_FEATURE_INSTALLER
|
||||||
|
static const char usr_bin [] ALIGN1 = "/usr/bin/";
|
||||||
|
static const char usr_sbin[] ALIGN1 = "/usr/sbin/";
|
||||||
|
static const char *const install_dir[] = {
|
||||||
|
&usr_bin [8], /* "/" */
|
||||||
|
&usr_bin [4], /* "/bin/" */
|
||||||
|
&usr_sbin[4], /* "/sbin/" */
|
||||||
|
usr_bin,
|
||||||
|
usr_sbin
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* create (sym)links for each applet */
|
/* create (sym)links for each applet */
|
||||||
static void install_links(const char *busybox, int use_symbolic_links,
|
static void install_links(const char *busybox, int use_symbolic_links,
|
||||||
char *custom_install_dir)
|
char *custom_install_dir)
|
||||||
@ -602,16 +613,6 @@ static void install_links(const char *busybox, int use_symbolic_links,
|
|||||||
/* directory table
|
/* directory table
|
||||||
* this should be consistent w/ the enum,
|
* this should be consistent w/ the enum,
|
||||||
* busybox.h::bb_install_loc_t, or else... */
|
* busybox.h::bb_install_loc_t, or else... */
|
||||||
static const char usr_bin [] ALIGN1 = "/usr/bin";
|
|
||||||
static const char usr_sbin[] ALIGN1 = "/usr/sbin";
|
|
||||||
static const char *const install_dir[] = {
|
|
||||||
&usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
|
|
||||||
&usr_bin [4], /* "/bin" */
|
|
||||||
&usr_sbin[4], /* "/sbin" */
|
|
||||||
usr_bin,
|
|
||||||
usr_sbin
|
|
||||||
};
|
|
||||||
|
|
||||||
int (*lf)(const char *, const char *);
|
int (*lf)(const char *, const char *);
|
||||||
char *fpc;
|
char *fpc;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -635,8 +636,8 @@ static void install_links(const char *busybox, int use_symbolic_links,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define install_links(x,y,z) ((void)0)
|
# define install_links(x,y,z) ((void)0)
|
||||||
#endif /* FEATURE_INSTALLER */
|
#endif
|
||||||
|
|
||||||
/* If we were called as "busybox..." */
|
/* If we were called as "busybox..." */
|
||||||
static int busybox_main(char **argv)
|
static int busybox_main(char **argv)
|
||||||
@ -657,19 +658,20 @@ static int busybox_main(char **argv)
|
|||||||
full_write2_str(bb_banner); /* reuse const string */
|
full_write2_str(bb_banner); /* reuse const string */
|
||||||
full_write2_str(" multi-call binary.\n"); /* reuse */
|
full_write2_str(" multi-call binary.\n"); /* reuse */
|
||||||
full_write2_str(
|
full_write2_str(
|
||||||
"Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko\n"
|
"Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko\n"
|
||||||
"and others. Licensed under GPLv2.\n"
|
"and others. Licensed under GPLv2.\n"
|
||||||
"See source distribution for full notice.\n"
|
"See source distribution for full notice.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Usage: busybox [function] [arguments]...\n"
|
"Usage: busybox [function] [arguments]...\n"
|
||||||
" or: function [arguments]...\n"
|
" or: function [arguments]...\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
||||||
"\tutilities into a single executable. Most people will create a\n"
|
"\tutilities into a single executable. Most people will create a\n"
|
||||||
"\tlink to busybox for each function they wish to use and BusyBox\n"
|
"\tlink to busybox for each function they wish to use and BusyBox\n"
|
||||||
"\twill act like whatever it was invoked as.\n"
|
"\twill act like whatever it was invoked as.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Currently defined functions:\n");
|
"Currently defined functions:\n"
|
||||||
|
);
|
||||||
col = 0;
|
col = 0;
|
||||||
a = applet_names;
|
a = applet_names;
|
||||||
/* prevent last comma to be in the very last pos */
|
/* prevent last comma to be in the very last pos */
|
||||||
@ -694,6 +696,23 @@ static int busybox_main(char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strncmp(argv[1], "--list", 6) == 0) {
|
||||||
|
unsigned i = 0;
|
||||||
|
const char *a = applet_names;
|
||||||
|
dup2(1, 2);
|
||||||
|
while (*a) {
|
||||||
|
#if ENABLE_FEATURE_INSTALLER
|
||||||
|
if (argv[1][6]) /* --list-path? */
|
||||||
|
full_write2_str(install_dir[APPLET_INSTALL_LOC(i)] + 1);
|
||||||
|
#endif
|
||||||
|
full_write2_str(a);
|
||||||
|
full_write2_str("\n");
|
||||||
|
i++;
|
||||||
|
a += strlen(a) + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) {
|
if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) {
|
||||||
int use_symbolic_links;
|
int use_symbolic_links;
|
||||||
const char *busybox;
|
const char *busybox;
|
||||||
|
Loading…
Reference in New Issue
Block a user