Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-09-03 23:21:07 +0400
committerEric Andersen <andersen@codepoet.org>2001-09-03 23:21:07 +0400
commit9b2afe6dd66bcb975f037cb7b78ef0e6f9e87212 (patch)
tree2a741843d8f2c9fdd1e1fefa2b60e2cbf8d9f719
parent3cba82678b139965fc37a277c6162a9e2795679f (diff)
Backport fix from Matt, for when applet names contain a leading dash
and a full pathname.
-rw-r--r--busybox/applets/busybox.c12
-rw-r--r--busybox/busybox.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/busybox/applets/busybox.c b/busybox/applets/busybox.c
index 7a220f7b0..33efb5d84 100644
--- a/busybox/applets/busybox.c
+++ b/busybox/applets/busybox.c
@@ -69,16 +69,16 @@ int main(int argc, char **argv)
{
const char *s;
- for (s = applet_name = argv[0]; *s != '\0';) {
+ applet_name = argv[0];
+
+ if (applet_name[0] == '-')
+ applet_name++;
+
+ for (s = applet_name; *s != '\0';) {
if (*s++ == '/')
applet_name = s;
}
- /* Add in a special case hack for a leading hyphen */
- if (**argv == '-' && *(*argv+1)!= '-') {
- applet_name = (*argv+1);
- }
-
#ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT
if(getpid()!=1) /* Do not set locale for `init' */
diff --git a/busybox/busybox.c b/busybox/busybox.c
index 7a220f7b0..33efb5d84 100644
--- a/busybox/busybox.c
+++ b/busybox/busybox.c
@@ -69,16 +69,16 @@ int main(int argc, char **argv)
{
const char *s;
- for (s = applet_name = argv[0]; *s != '\0';) {
+ applet_name = argv[0];
+
+ if (applet_name[0] == '-')
+ applet_name++;
+
+ for (s = applet_name; *s != '\0';) {
if (*s++ == '/')
applet_name = s;
}
- /* Add in a special case hack for a leading hyphen */
- if (**argv == '-' && *(*argv+1)!= '-') {
- applet_name = (*argv+1);
- }
-
#ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT
if(getpid()!=1) /* Do not set locale for `init' */