aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-04-11 17:03:19 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-04-11 17:03:19 +0000
commit9a5db51b503eba9c9b58ceabbf03869930429565 (patch)
treefe03aa276fa5396402dc2bc88fccb7559626b976
parent9e02dd5233d637966f7b94d666033b8109cbd155 (diff)
downloadbusybox-w32-9a5db51b503eba9c9b58ceabbf03869930429565.tar.gz
busybox-w32-9a5db51b503eba9c9b58ceabbf03869930429565.tar.bz2
busybox-w32-9a5db51b503eba9c9b58ceabbf03869930429565.zip
rename: run_applet_by_name -> run_applet_and_exit
git-svn-id: svn://busybox.net/trunk/busybox@18402 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--applets/applets.c8
-rw-r--r--docs/busybox.net/FAQ.html2
-rw-r--r--include/libbb.h2
-rwxr-xr-xscripts/individual2
-rw-r--r--shell/bbsh.c2
-rw-r--r--shell/hush.c2
-rw-r--r--shell/lash.c2
-rw-r--r--shell/msh.c2
8 files changed, 11 insertions, 11 deletions
diff --git a/applets/applets.c b/applets/applets.c
index 6f38ccee8..958defe75 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -541,7 +541,7 @@ static int busybox_main(int argc, char **argv)
541 if (argc > 2) { 541 if (argc > 2) {
542 /* set name for proper "<name>: applet not found" */ 542 /* set name for proper "<name>: applet not found" */
543 applet_name = argv[2]; 543 applet_name = argv[2];
544 run_applet_by_name(applet_name, 2, argv); 544 run_applet_and_exit(applet_name, 2, argv);
545 } else { 545 } else {
546 const struct bb_applet *a; 546 const struct bb_applet *a;
547 int col, output_width; 547 int col, output_width;
@@ -582,7 +582,7 @@ static int busybox_main(int argc, char **argv)
582 } else { 582 } else {
583 /* we want "<argv[1]>: applet not found", not "busybox: ..." */ 583 /* we want "<argv[1]>: applet not found", not "busybox: ..." */
584 applet_name = argv[1]; 584 applet_name = argv[1];
585 run_applet_by_name(argv[1], argc - 1, argv + 1); 585 run_applet_and_exit(argv[1], argc - 1, argv + 1);
586 } 586 }
587 587
588 bb_error_msg_and_die("applet not found"); 588 bb_error_msg_and_die("applet not found");
@@ -598,7 +598,7 @@ void run_current_applet_and_exit(int argc, char **argv)
598 exit(current_applet->main(argc, argv)); 598 exit(current_applet->main(argc, argv));
599} 599}
600 600
601void run_applet_by_name(const char *name, int argc, char **argv) 601void run_applet_and_exit(const char *name, int argc, char **argv)
602{ 602{
603 current_applet = find_applet_by_name(name); 603 current_applet = find_applet_by_name(name);
604 if (current_applet) 604 if (current_applet)
@@ -633,6 +633,6 @@ int main(int argc, char **argv)
633 if (ENABLE_LOCALE_SUPPORT && getpid() != 1) 633 if (ENABLE_LOCALE_SUPPORT && getpid() != 1)
634 setlocale(LC_ALL, ""); 634 setlocale(LC_ALL, "");
635 635
636 run_applet_by_name(applet_name, argc, argv); 636 run_applet_and_exit(applet_name, argc, argv);
637 bb_error_msg_and_die("applet not found"); 637 bb_error_msg_and_die("applet not found");
638} 638}
diff --git a/docs/busybox.net/FAQ.html b/docs/busybox.net/FAQ.html
index c07be9027..214c1905e 100644
--- a/docs/busybox.net/FAQ.html
+++ b/docs/busybox.net/FAQ.html
@@ -531,7 +531,7 @@ applets.</p>
531 531
532<p>Busybox execution starts with the main() function in applets/busybox.c, 532<p>Busybox execution starts with the main() function in applets/busybox.c,
533which sets the global variable applet_name to argv[0] and calls 533which sets the global variable applet_name to argv[0] and calls
534run_applet_by_name() in applets/applets.c. That uses the applets[] array 534run_applet_and_exit() in applets/applets.c. That uses the applets[] array
535(defined in include/busybox.h and filled out in include/applets.h) to 535(defined in include/busybox.h and filled out in include/applets.h) to
536transfer control to the appropriate APPLET_main() function (such as 536transfer control to the appropriate APPLET_main() function (such as
537cat_main() or sed_main()). The individual applet takes it from there.</p> 537cat_main() or sed_main()). The individual applet takes it from there.</p>
diff --git a/include/libbb.h b/include/libbb.h
index 11fcd19f2..c3baf9e7c 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -675,7 +675,7 @@ const struct hwtype *get_hwntype(int type);
675struct bb_applet; 675struct bb_applet;
676extern const struct bb_applet *find_applet_by_name(const char *name); 676extern const struct bb_applet *find_applet_by_name(const char *name);
677/* Returns only if applet is not found. */ 677/* Returns only if applet is not found. */
678extern void run_applet_by_name(const char *name, int argc, char **argv); 678extern void run_applet_and_exit(const char *name, int argc, char **argv);
679extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN; 679extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN;
680#endif 680#endif
681 681
diff --git a/scripts/individual b/scripts/individual
index a09a5dc7a..e93ca5552 100755
--- a/scripts/individual
+++ b/scripts/individual
@@ -106,7 +106,7 @@ function buildit ()
106 gcc -Os -o build/$APPLET applets/individual.c $j \ 106 gcc -Os -o build/$APPLET applets/individual.c $j \
107 `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \ 107 `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \
108 -DBUILD_INDIVIDUAL \ 108 -DBUILD_INDIVIDUAL \
109 '-Drun_applet_by_name(...)' '-Dfind_applet_by_name(...)=0' \ 109 '-Drun_applet_and_exit(...)' '-Dfind_applet_by_name(...)=0' \
110 -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME} 110 -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME}
111 if [ $? -ne 0 ]; 111 if [ $? -ne 0 ];
112 then 112 then
diff --git a/shell/bbsh.c b/shell/bbsh.c
index 06fd0131e..6bef3685a 100644
--- a/shell/bbsh.c
+++ b/shell/bbsh.c
@@ -165,7 +165,7 @@ static int run_pipeline(struct pipeline *line)
165 int status; 165 int status;
166 pid_t pid=fork(); 166 pid_t pid=fork();
167 if(!pid) { 167 if(!pid) {
168 run_applet_by_name(cmd->argv[0],cmd->argc,cmd->argv); 168 run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv);
169 execvp(cmd->argv[0],cmd->argv); 169 execvp(cmd->argv[0],cmd->argv);
170 printf("No %s",cmd->argv[0]); 170 printf("No %s",cmd->argv[0]);
171 exit(1); 171 exit(1);
diff --git a/shell/hush.c b/shell/hush.c
index f6c69a221..3048d695a 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1123,7 +1123,7 @@ static void pseudo_exec(struct child_prog *child)
1123 /**/; 1123 /**/;
1124 optind = 1; 1124 optind = 1;
1125 debug_printf("running applet %s\n", name); 1125 debug_printf("running applet %s\n", name);
1126 run_applet_by_name(name, argc_l, child->argv); 1126 run_applet_and_exit(name, argc_l, child->argv);
1127 } 1127 }
1128#endif 1128#endif
1129 debug_printf("exec of %s\n", child->argv[0]); 1129 debug_printf("exec of %s\n", child->argv[0]);
diff --git a/shell/lash.c b/shell/lash.c
index 99e2b1f06..f91bec254 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1170,7 +1170,7 @@ static int pseudo_exec(struct child_prog *child)
1170 1170
1171 for (argc_l = 0; *argv_l; argv_l++, argc_l++); 1171 for (argc_l = 0; *argv_l; argv_l++, argc_l++);
1172 optind = 1; 1172 optind = 1;
1173 run_applet_by_name(child->argv[0], argc_l, child->argv); 1173 run_applet_and_exit(child->argv[0], argc_l, child->argv);
1174 } 1174 }
1175 1175
1176 execvp(child->argv[0], child->argv); 1176 execvp(child->argv[0], child->argv);
diff --git a/shell/msh.c b/shell/msh.c
index 0337a4f06..963e59446 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -3068,7 +3068,7 @@ static const char *rexecve(char *c, char **v, char **envp)
3068 optind = 1; 3068 optind = 1;
3069 if (find_applet_by_name(name)) { 3069 if (find_applet_by_name(name)) {
3070 /* We have to exec here since we vforked. Running 3070 /* We have to exec here since we vforked. Running
3071 * run_applet_by_name() won't work and bad things 3071 * run_applet_and_exit() won't work and bad things
3072 * will happen. */ 3072 * will happen. */
3073 execve(CONFIG_BUSYBOX_EXEC_PATH, v, envp); 3073 execve(CONFIG_BUSYBOX_EXEC_PATH, v, envp);
3074 } 3074 }