summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--archival/gunzip.c2
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/test.c2
-rw-r--r--coreutils/whoami.c2
-rw-r--r--fsck_minix.c9
-rw-r--r--gunzip.c2
-rw-r--r--init.c2
-rw-r--r--init/init.c2
-rw-r--r--kill.c3
-rw-r--r--mkfs_minix.c9
-rw-r--r--mkswap.c18
-rw-r--r--procps/kill.c3
-rw-r--r--rmdir.c2
-rw-r--r--swaponoff.c8
-rw-r--r--test.c2
-rw-r--r--util-linux/fsck_minix.c9
-rw-r--r--util-linux/mkfs_minix.c9
-rw-r--r--util-linux/mkswap.c18
-rw-r--r--util-linux/swaponoff.c8
-rw-r--r--whoami.c2
20 files changed, 42 insertions, 72 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index d6382aed0..e6b8202c8 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -592,7 +592,7 @@ int gunzip_main(int argc, char **argv)
char ifname[MAX_PATH_LEN + 1]; /* input file name */
char ofname[MAX_PATH_LEN + 1]; /* output file name */
- if (strcmp(*argv, "zcat") == 0) {
+ if (strcmp(applet_name, "zcat") == 0) {
to_stdout = 1;
if (argc == 1) {
fromstdin = 1;
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 0751808c0..c88f42cf5 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv)
while (--argc > 0) {
if (rmdir(*(++argv)) == -1) {
- fprintf(stderr, "%s: %s\n", *argv, strerror(errno));
+ fprintf(stderr, "%s: %s\n", applet_name, strerror(errno));
exit(FALSE);
}
}
diff --git a/coreutils/test.c b/coreutils/test.c
index 36da4db0b..d7b34a6a4 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -183,7 +183,7 @@ test_main(int argc, char** argv)
{
int res;
- if (strcmp(argv[0], "[") == 0) {
+ if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
fatalError("missing ]\n");
argv[argc] = NULL;
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 950f52fb2..983c6725d 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -43,7 +43,7 @@ extern int whoami_main(int argc, char **argv)
puts(user);
exit(TRUE);
}
- fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0],
+ fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name,
(unsigned) uid);
return(FALSE);
}
diff --git a/fsck_minix.c b/fsck_minix.c
index 9533f40db..685e0ee6c 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -219,7 +219,6 @@ struct minix_dir_entry {
#define BITS_PER_BLOCK (BLOCK_SIZE<<3)
-static char *program_name = "fsck.minix";
static char *program_version = "1.2 - 11/11/96";
static char *device_name = NULL;
static int IN;
@@ -293,7 +292,7 @@ static void show_usage(void)
{
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
BB_VER, BB_BT);
- fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", program_name);
+ fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", applet_name);
#ifndef BB_FEATURE_TRIVIAL_HELP
fprintf(stderr,
"\nPerforms a consistency check for MINIX filesystems.\n\n");
@@ -312,7 +311,7 @@ static void show_usage(void)
static void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
leave(8);
}
@@ -1367,8 +1366,6 @@ extern int fsck_minix_main(int argc, char **argv)
* that automagically, so we can save a few bytes */
//atexit(free_name_list);
- if (argc && *argv)
- program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#ifdef HAVE_MINIX2
@@ -1432,7 +1429,7 @@ extern int fsck_minix_main(int argc, char **argv)
* flags and whether or not the -f switch was specified on the
* command line.
*/
- printf("%s, %s\n", program_name, program_version);
+ printf("%s, %s\n", applet_name, program_version);
if (!(Super.s_state & MINIX_ERROR_FS) &&
(Super.s_state & MINIX_VALID_FS) && !force) {
if (repair)
diff --git a/gunzip.c b/gunzip.c
index d6382aed0..e6b8202c8 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -592,7 +592,7 @@ int gunzip_main(int argc, char **argv)
char ifname[MAX_PATH_LEN + 1]; /* input file name */
char ofname[MAX_PATH_LEN + 1]; /* output file name */
- if (strcmp(*argv, "zcat") == 0) {
+ if (strcmp(applet_name, "zcat") == 0) {
to_stdout = 1;
if (argc == 1) {
fromstdin = 1;
diff --git a/init.c b/init.c
index 79f14ab33..f38d154b7 100644
--- a/init.c
+++ b/init.c
@@ -891,7 +891,7 @@ extern int init_main(int argc, char **argv)
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
if (getpid() != 1
#ifdef BB_FEATURE_LINUXRC
- && strstr(argv[0], "linuxrc") == NULL
+ && strstr(applet_name, "linuxrc") == NULL
#endif
)
{
diff --git a/init/init.c b/init/init.c
index 79f14ab33..f38d154b7 100644
--- a/init/init.c
+++ b/init/init.c
@@ -891,7 +891,7 @@ extern int init_main(int argc, char **argv)
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
if (getpid() != 1
#ifdef BB_FEATURE_LINUXRC
- && strstr(argv[0], "linuxrc") == NULL
+ && strstr(applet_name, "linuxrc") == NULL
#endif
)
{
diff --git a/kill.c b/kill.c
index a0b93be2b..44cb38395 100644
--- a/kill.c
+++ b/kill.c
@@ -125,8 +125,7 @@ extern int kill_main(int argc, char **argv)
#ifdef BB_KILLALL
/* Figure out what we are trying to do here */
- whichApp = (strcmp(*argv, "killall") == 0)?
- KILLALL : KILL;
+ whichApp = (strcmp(applet_name, "killall") == 0)? KILLALL : KILL;
appUsage = (whichApp == KILLALL)? killall_usage : kill_usage;
#else
whichApp = KILL;
diff --git a/mkfs_minix.c b/mkfs_minix.c
index c8c91123b..b6f958f46 100644
--- a/mkfs_minix.c
+++ b/mkfs_minix.c
@@ -202,7 +202,6 @@ struct minix_dir_entry {
#define BITS_PER_BLOCK (BLOCK_SIZE<<3)
-static char *program_name = "mkfs";
static char *device_name = NULL;
static int DEV = -1;
static long BLOCKS = 0;
@@ -264,7 +263,7 @@ static unsigned long req_nr_inodes = 0;
*/
static volatile void die(char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
exit(8);
}
@@ -275,7 +274,7 @@ static volatile void show_usage()
BB_VER, BB_BT);
fprintf(stderr,
"Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n",
- program_name);
+ applet_name);
#ifndef BB_FEATURE_TRIVIAL_HELP
fprintf(stderr, "\nMake a MINIX filesystem.\n\n");
fprintf(stderr, "Options:\n");
@@ -745,8 +744,6 @@ extern int mkfs_minix_main(int argc, char **argv)
char *listfile = NULL;
int stopIt=FALSE;
- if (argc && *argv)
- program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#ifdef HAVE_MINIX2
@@ -818,7 +815,7 @@ extern int mkfs_minix_main(int argc, char **argv)
version2 = 1;
#else
fprintf(stderr, "%s: not compiled with minix v2 support\n",
- program_name, device_name);
+ applet_name, device_name);
exit(-1);
#endif
break;
diff --git a/mkswap.c b/mkswap.c
index fc37368f4..20096361f 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -69,7 +69,6 @@ static const char mkswap_usage[] =
#define BLKGETSIZE _IO(0x12,96)
#endif
-static char *program_name = "mkswap";
static char *device_name = NULL;
static int DEV = -1;
static long PAGES = 0;
@@ -205,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
exit(FALSE);
}
@@ -316,9 +315,6 @@ int mkswap_main(int argc, char **argv)
int offset;
int force = 0;
- if (argc && *argv)
- program_name = *argv;
-
init_signature_page(); /* get pagesize */
while (argc-- > 1) {
@@ -350,7 +346,7 @@ int mkswap_main(int argc, char **argv)
}
if (!device_name) {
fprintf(stderr,
- "%s: error: Nowhere to set up swap on?\n", program_name);
+ "%s: error: Nowhere to set up swap on?\n", applet_name);
usage(mkswap_usage);
}
sz = get_size(device_name);
@@ -360,7 +356,7 @@ int mkswap_main(int argc, char **argv)
fprintf(stderr,
"%s: error: "
"size %ld is larger than device size %d\n",
- program_name,
+ applet_name,
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
exit(FALSE);
}
@@ -377,13 +373,13 @@ int mkswap_main(int argc, char **argv)
}
if (version != 0 && version != 1) {
fprintf(stderr, "%s: error: unknown version %d\n",
- program_name, version);
+ applet_name, version);
usage(mkswap_usage);
}
if (PAGES < 10) {
fprintf(stderr,
"%s: error: swap area needs to be at least %ldkB\n",
- program_name, (long) (10 * pagesize / 1024));
+ applet_name, (long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
#if 0
@@ -402,7 +398,7 @@ int mkswap_main(int argc, char **argv)
if (PAGES > maxpages) {
PAGES = maxpages;
fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
- program_name, PAGES * pagesize / 1024);
+ applet_name, PAGES * pagesize / 1024);
}
DEV = open(device_name, O_RDWR);
@@ -432,7 +428,7 @@ int mkswap_main(int argc, char **argv)
%s: Device '%s' contains a valid Sun disklabel.\n\
This probably means creating v0 swap would destroy your partition table\n\
No swap created. If you really want to create swap v0 on that device, use\n\
-the -f option to force it.\n", program_name, device_name);
+the -f option to force it.\n", applet_name, device_name);
exit(FALSE);
}
}
diff --git a/procps/kill.c b/procps/kill.c
index a0b93be2b..44cb38395 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -125,8 +125,7 @@ extern int kill_main(int argc, char **argv)
#ifdef BB_KILLALL
/* Figure out what we are trying to do here */
- whichApp = (strcmp(*argv, "killall") == 0)?
- KILLALL : KILL;
+ whichApp = (strcmp(applet_name, "killall") == 0)? KILLALL : KILL;
appUsage = (whichApp == KILLALL)? killall_usage : kill_usage;
#else
whichApp = KILL;
diff --git a/rmdir.c b/rmdir.c
index 0751808c0..c88f42cf5 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv)
while (--argc > 0) {
if (rmdir(*(++argv)) == -1) {
- fprintf(stderr, "%s: %s\n", *argv, strerror(errno));
+ fprintf(stderr, "%s: %s\n", applet_name, strerror(errno));
exit(FALSE);
}
}
diff --git a/swaponoff.c b/swaponoff.c
index b43f3cdc1..a79b93a23 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -34,7 +34,6 @@ _syscall1(int, swapoff, const char *, path);
static int whichApp;
-static const char *appName;
static const char swapoff_usage[] =
"swapoff [OPTION] [device]\n"
@@ -69,7 +68,7 @@ static void swap_enable_disable(char *device)
status = swapoff(device);
if (status != 0) {
- perror(appName);
+ perror(applet_name);
exit(FALSE);
}
}
@@ -95,12 +94,9 @@ static void do_em_all()
extern int swap_on_off_main(int argc, char **argv)
{
- if (strcmp(*argv, "swapon") == 0) {
- appName = *argv;
+ if (strcmp(applet_name, "swapon") == 0) {
whichApp = SWAPON_APP;
-
} else {
- appName = *argv;
whichApp = SWAPOFF_APP;
}
diff --git a/test.c b/test.c
index 36da4db0b..d7b34a6a4 100644
--- a/test.c
+++ b/test.c
@@ -183,7 +183,7 @@ test_main(int argc, char** argv)
{
int res;
- if (strcmp(argv[0], "[") == 0) {
+ if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
fatalError("missing ]\n");
argv[argc] = NULL;
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 9533f40db..685e0ee6c 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -219,7 +219,6 @@ struct minix_dir_entry {
#define BITS_PER_BLOCK (BLOCK_SIZE<<3)
-static char *program_name = "fsck.minix";
static char *program_version = "1.2 - 11/11/96";
static char *device_name = NULL;
static int IN;
@@ -293,7 +292,7 @@ static void show_usage(void)
{
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
BB_VER, BB_BT);
- fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", program_name);
+ fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", applet_name);
#ifndef BB_FEATURE_TRIVIAL_HELP
fprintf(stderr,
"\nPerforms a consistency check for MINIX filesystems.\n\n");
@@ -312,7 +311,7 @@ static void show_usage(void)
static void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
leave(8);
}
@@ -1367,8 +1366,6 @@ extern int fsck_minix_main(int argc, char **argv)
* that automagically, so we can save a few bytes */
//atexit(free_name_list);
- if (argc && *argv)
- program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#ifdef HAVE_MINIX2
@@ -1432,7 +1429,7 @@ extern int fsck_minix_main(int argc, char **argv)
* flags and whether or not the -f switch was specified on the
* command line.
*/
- printf("%s, %s\n", program_name, program_version);
+ printf("%s, %s\n", applet_name, program_version);
if (!(Super.s_state & MINIX_ERROR_FS) &&
(Super.s_state & MINIX_VALID_FS) && !force) {
if (repair)
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index c8c91123b..b6f958f46 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -202,7 +202,6 @@ struct minix_dir_entry {
#define BITS_PER_BLOCK (BLOCK_SIZE<<3)
-static char *program_name = "mkfs";
static char *device_name = NULL;
static int DEV = -1;
static long BLOCKS = 0;
@@ -264,7 +263,7 @@ static unsigned long req_nr_inodes = 0;
*/
static volatile void die(char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
exit(8);
}
@@ -275,7 +274,7 @@ static volatile void show_usage()
BB_VER, BB_BT);
fprintf(stderr,
"Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n",
- program_name);
+ applet_name);
#ifndef BB_FEATURE_TRIVIAL_HELP
fprintf(stderr, "\nMake a MINIX filesystem.\n\n");
fprintf(stderr, "Options:\n");
@@ -745,8 +744,6 @@ extern int mkfs_minix_main(int argc, char **argv)
char *listfile = NULL;
int stopIt=FALSE;
- if (argc && *argv)
- program_name = *argv;
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#ifdef HAVE_MINIX2
@@ -818,7 +815,7 @@ extern int mkfs_minix_main(int argc, char **argv)
version2 = 1;
#else
fprintf(stderr, "%s: not compiled with minix v2 support\n",
- program_name, device_name);
+ applet_name, device_name);
exit(-1);
#endif
break;
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index fc37368f4..20096361f 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -69,7 +69,6 @@ static const char mkswap_usage[] =
#define BLKGETSIZE _IO(0x12,96)
#endif
-static char *program_name = "mkswap";
static char *device_name = NULL;
static int DEV = -1;
static long PAGES = 0;
@@ -205,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", program_name, str);
+ fprintf(stderr, "%s: %s\n", applet_name, str);
exit(FALSE);
}
@@ -316,9 +315,6 @@ int mkswap_main(int argc, char **argv)
int offset;
int force = 0;
- if (argc && *argv)
- program_name = *argv;
-
init_signature_page(); /* get pagesize */
while (argc-- > 1) {
@@ -350,7 +346,7 @@ int mkswap_main(int argc, char **argv)
}
if (!device_name) {
fprintf(stderr,
- "%s: error: Nowhere to set up swap on?\n", program_name);
+ "%s: error: Nowhere to set up swap on?\n", applet_name);
usage(mkswap_usage);
}
sz = get_size(device_name);
@@ -360,7 +356,7 @@ int mkswap_main(int argc, char **argv)
fprintf(stderr,
"%s: error: "
"size %ld is larger than device size %d\n",
- program_name,
+ applet_name,
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
exit(FALSE);
}
@@ -377,13 +373,13 @@ int mkswap_main(int argc, char **argv)
}
if (version != 0 && version != 1) {
fprintf(stderr, "%s: error: unknown version %d\n",
- program_name, version);
+ applet_name, version);
usage(mkswap_usage);
}
if (PAGES < 10) {
fprintf(stderr,
"%s: error: swap area needs to be at least %ldkB\n",
- program_name, (long) (10 * pagesize / 1024));
+ applet_name, (long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
#if 0
@@ -402,7 +398,7 @@ int mkswap_main(int argc, char **argv)
if (PAGES > maxpages) {
PAGES = maxpages;
fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
- program_name, PAGES * pagesize / 1024);
+ applet_name, PAGES * pagesize / 1024);
}
DEV = open(device_name, O_RDWR);
@@ -432,7 +428,7 @@ int mkswap_main(int argc, char **argv)
%s: Device '%s' contains a valid Sun disklabel.\n\
This probably means creating v0 swap would destroy your partition table\n\
No swap created. If you really want to create swap v0 on that device, use\n\
-the -f option to force it.\n", program_name, device_name);
+the -f option to force it.\n", applet_name, device_name);
exit(FALSE);
}
}
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index b43f3cdc1..a79b93a23 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -34,7 +34,6 @@ _syscall1(int, swapoff, const char *, path);
static int whichApp;
-static const char *appName;
static const char swapoff_usage[] =
"swapoff [OPTION] [device]\n"
@@ -69,7 +68,7 @@ static void swap_enable_disable(char *device)
status = swapoff(device);
if (status != 0) {
- perror(appName);
+ perror(applet_name);
exit(FALSE);
}
}
@@ -95,12 +94,9 @@ static void do_em_all()
extern int swap_on_off_main(int argc, char **argv)
{
- if (strcmp(*argv, "swapon") == 0) {
- appName = *argv;
+ if (strcmp(applet_name, "swapon") == 0) {
whichApp = SWAPON_APP;
-
} else {
- appName = *argv;
whichApp = SWAPOFF_APP;
}
diff --git a/whoami.c b/whoami.c
index 950f52fb2..983c6725d 100644
--- a/whoami.c
+++ b/whoami.c
@@ -43,7 +43,7 @@ extern int whoami_main(int argc, char **argv)
puts(user);
exit(TRUE);
}
- fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0],
+ fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name,
(unsigned) uid);
return(FALSE);
}