shell: make standalone shell tab-complete "busybox"
function old new delta busybox_main - 624 +624 packed_usage 31758 31777 +19 applet_names 2638 2646 +8 applet_main 1528 1532 +4 applet_install_loc 191 192 +1 run_applet_and_exit 681 78 -603 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 656/-603) Total: 53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		@@ -760,11 +760,26 @@ static void install_links(const char *busybox UNUSED_PARAM,
 | 
			
		||||
}
 | 
			
		||||
# endif
 | 
			
		||||
 | 
			
		||||
# if ENABLE_BUSYBOX
 | 
			
		||||
static void run_applet_and_exit(const char *name, char **argv) NORETURN;
 | 
			
		||||
 | 
			
		||||
/* If we were called as "busybox..." */
 | 
			
		||||
static int busybox_main(char **argv)
 | 
			
		||||
# if ENABLE_BUSYBOX
 | 
			
		||||
#  if ENABLE_FEATURE_SH_STANDALONE && ENABLE_FEATURE_TAB_COMPLETION
 | 
			
		||||
    /*
 | 
			
		||||
     * Insert "busybox" into applet table as well.
 | 
			
		||||
     * This makes standalone shell tab-complete this name too.
 | 
			
		||||
     * (Otherwise having "busybox" in applet table is not necessary,
 | 
			
		||||
     * there is other code which routes "busyboxANY_SUFFIX" name
 | 
			
		||||
     * to busybox_main()).
 | 
			
		||||
     */
 | 
			
		||||
//usage:#define busybox_trivial_usage NOUSAGE_STR
 | 
			
		||||
//usage:#define busybox_full_usage ""
 | 
			
		||||
//applet:IF_BUSYBOX(IF_FEATURE_SH_STANDALONE(IF_FEATURE_TAB_COMPLETION(APPLET(busybox, BB_DIR_BIN, BB_SUID_MAYBE))))
 | 
			
		||||
int busybox_main(int argc, char *argv[]) MAIN_EXTERNALLY_VISIBLE;
 | 
			
		||||
#  else
 | 
			
		||||
#   define busybox_main(argc,argv) busybox_main(argv)
 | 
			
		||||
static
 | 
			
		||||
#  endif
 | 
			
		||||
int busybox_main(int argc UNUSED_PARAM, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	if (!argv[1]) {
 | 
			
		||||
		/* Called without arguments */
 | 
			
		||||
@@ -937,7 +952,7 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv)
 | 
			
		||||
{
 | 
			
		||||
#  if ENABLE_BUSYBOX
 | 
			
		||||
	if (is_prefixed_with(name, "busybox"))
 | 
			
		||||
		exit(busybox_main(argv));
 | 
			
		||||
		exit(busybox_main(/*unused:*/ 0, argv));
 | 
			
		||||
#  endif
 | 
			
		||||
#  if NUM_APPLETS > 0
 | 
			
		||||
	/* find_applet_by_name() search is more expensive, so goes second */
 | 
			
		||||
 
 | 
			
		||||
@@ -776,7 +776,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
 | 
			
		||||
	}
 | 
			
		||||
	pf_len = strlen(pfind);
 | 
			
		||||
 | 
			
		||||
#if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1
 | 
			
		||||
# if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1
 | 
			
		||||
	if (type == FIND_EXE_ONLY && !dirbuf) {
 | 
			
		||||
		const char *p = applet_names;
 | 
			
		||||
 | 
			
		||||
@@ -787,7 +787,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
 | 
			
		||||
				continue;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
# endif
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < npaths; i++) {
 | 
			
		||||
		DIR *dir;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user