Skip to content

Commit

Permalink
bb_applet_name -> applet_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Vlasenko committed Oct 3, 2006
1 parent 67b23e6 commit 8f8f268
Show file tree
Hide file tree
Showing 45 changed files with 71 additions and 69 deletions.
2 changes: 1 addition & 1 deletion applets/applets.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ void run_applet_by_name(const char *name, int argc, char **argv)
/* Do a binary search to find the applet entry given the name. */
applet_using = find_applet_by_name(name);
if (applet_using) {
bb_applet_name = applet_using->name;
applet_name = applet_using->name;
if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage();
if(ENABLE_FEATURE_SUID) check_suid(applet_using);
exit((*(applet_using->main))(argc, argv));
Expand Down
15 changes: 8 additions & 7 deletions applets/busybox.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#include "busybox.h"

const char *bb_applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;
const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;

#ifdef CONFIG_FEATURE_INSTALLER
/*
Expand Down Expand Up @@ -59,16 +59,16 @@ int main(int argc, char **argv)
{
const char *s;

bb_applet_name=argv[0];
if (*bb_applet_name == '-') bb_applet_name++;
for (s = bb_applet_name; *s ;)
if (*(s++) == '/') bb_applet_name = s;
applet_name=argv[0];
if (*applet_name == '-') applet_name++;
for (s = applet_name; *s ;)
if (*(s++) == '/') applet_name = s;

/* Set locale for everybody except `init' */
if(ENABLE_LOCALE_SUPPORT && getpid() != 1)
setlocale(LC_ALL, "");

run_applet_by_name(bb_applet_name, argc, argv);
run_applet_by_name(applet_name, argc, argv);
bb_error_msg_and_die("applet not found");
}

Expand Down Expand Up @@ -106,7 +106,8 @@ int busybox_main(int argc, char **argv)

if (argc==1 || !strcmp(argv[1],"--help") ) {
if (argc>2) {
run_applet_by_name(bb_applet_name=argv[2], 2, argv);
applet_name = argv[2];
run_applet_by_name(applet_name, 2, argv);
} else {
const struct BB_applet *a;
int col, output_width;
Expand Down
4 changes: 2 additions & 2 deletions applets/individual.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Licensed under GPL version 2, see file LICENSE in this tarball for details
*/

const char *bb_applet_name;
const char *applet_name;

#include <stdio.h>
#include <stdlib.h>
Expand All @@ -14,7 +14,7 @@ const char *bb_applet_name;

int main(int argc, char *argv[])
{
bb_applet_name=argv[0];
applet_name=argv[0];

return APPLET_main(argc,argv);
}
Expand Down
2 changes: 1 addition & 1 deletion archival/bunzip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int bunzip2_main(int argc, char **argv)
}

/* if called as bzcat force the stdout flag */
if ((opt & BUNZIP2_OPT_STDOUT) || bb_applet_name[2] == 'c')
if ((opt & BUNZIP2_OPT_STDOUT) || applet_name[2] == 'c')
filename = 0;

/* Check that the input is sane. */
Expand Down
2 changes: 1 addition & 1 deletion archival/gunzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int gunzip_main(int argc, char **argv)

opt = getopt32(argc, argv, "cftdv");
/* if called as zcat */
if (strcmp(bb_applet_name, "zcat") == 0) {
if (strcmp(applet_name, "zcat") == 0) {
opt |= GUNZIP_OPT_STDOUT;
}

Expand Down
2 changes: 1 addition & 1 deletion archival/unlzma.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int unlzma_main(int argc, char **argv)
}

/* if called as lzmacat force the stdout flag */
if ((opt & UNLZMA_OPT_STDOUT) || bb_applet_name[4] == 'c')
if ((opt & UNLZMA_OPT_STDOUT) || applet_name[4] == 'c')
filename = 0;

if (filename) {
Expand Down
1 change: 1 addition & 0 deletions coreutils/cut.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

/* option vars */
static const char optstring[] = "b:c:f:d:sn";

#define CUT_OPT_BYTE_FLGS (1<<0)
#define CUT_OPT_CHAR_FLGS (1<<1)
#define CUT_OPT_FIELDS_FLGS (1<<2)
Expand Down
2 changes: 1 addition & 1 deletion coreutils/dos2unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int dos2unix_main(int argc, char *argv[])
int o;

/* See if we are supposed to be doing dos2unix or unix2dos */
if (bb_applet_name[0] == 'd') {
if (applet_name[0] == 'd') {
ConvType = CT_DOS2UNIX; /*2 */
} else {
ConvType = CT_UNIX2DOS; /*1 */
Expand Down
2 changes: 1 addition & 1 deletion docs/busybox.net/FAQ.html
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ <h2><a name="source_applets"><b>The applet directories</b></a></h2>
applets.</p>

<p>Busybox execution starts with the main() function in applets/busybox.c,
which sets the global variable bb_applet_name to argv[0] and calls
which sets the global variable applet_name to argv[0] and calls
run_applet_by_name() in applets/applets.c. That uses the applets[] array
(defined in include/busybox.h and filled out in include/applets.h) to
transfer control to the appropriate APPLET_main() function (such as
Expand Down
2 changes: 1 addition & 1 deletion e2fsprogs/mke2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ static int PRS(int argc, char *argv[])
#endif

/* If called as mkfs.ext3, create a journal inode */
if (last_char_is(bb_applet_name, '3'))
if (last_char_is(applet_name, '3'))
journal_size = -1;

while ((c = getopt (argc, argv,
Expand Down
4 changes: 2 additions & 2 deletions e2fsprogs/tune2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ int tune2fs_main(int argc, char **argv)
if (ENABLE_FEATURE_CLEAN_UP)
atexit(tune2fs_clean_up);

if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */
if (ENABLE_FINDFS && (applet_name[0] == 'f')) /* findfs */
do_findfs(argc, argv); /* no return */
else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */
else if (ENABLE_E2LABEL && (applet_name[0] == 'e')) /* e2label */
parse_e2label_options(argc, argv);
else
parse_tune2fs_options(argc, argv); /* tune2fs */
Expand Down
4 changes: 2 additions & 2 deletions findutils/grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ int grep_main(int argc, char **argv)
if (opt & GREP_OPT_f)
load_regexes_from_file(fopt);

if (ENABLE_FEATURE_GREP_FGREP_ALIAS && bb_applet_name[0] == 'f')
if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f')
opt |= GREP_OPT_F;

if (!(opt & GREP_OPT_o))
reflags = REG_NOSUB;

if (ENABLE_FEATURE_GREP_EGREP_ALIAS &&
(bb_applet_name[0] == 'e' || (opt & GREP_OPT_E)))
(applet_name[0] == 'e' || (opt & GREP_OPT_E)))
reflags |= REG_EXTENDED;

if (opt & GREP_OPT_i)
Expand Down
4 changes: 2 additions & 2 deletions findutils/xargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,12 @@ int xargs_main(int argc, char **argv)

#ifdef TEST

const char *bb_applet_name = "debug stuff usage";
const char *applet_name = "debug stuff usage";

void bb_show_usage(void)
{
fprintf(stderr, "Usage: %s [-p] [-r] [-t] -[x] [-n max_arg] [-s max_chars]\n",
bb_applet_name);
applet_name);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion include/libbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c depends on them. */
FILEUTILS_INTERACTIVE = 16
};

extern const char *bb_applet_name;
extern const char *applet_name;

extern const char bb_msg_full_version[];
extern const char bb_msg_memory_exhausted[];
Expand Down
2 changes: 1 addition & 1 deletion init/halt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RB_AUTOBOOT
int which, flags, rc = 1;

/* Figure out which applet we're running */
for(which=0;delay[which]!=*bb_applet_name;which++);
for(which=0;delay[which]!=*applet_name;which++);

/* Parse and handle arguments */
flags = getopt32(argc, argv, "d:nf", &delay);
Expand Down
4 changes: 2 additions & 2 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void message(int device, const char *fmt, ...)
/* Log the message to syslogd */
if (device & LOG) {
/* don`t out "\r\n" */
openlog(bb_applet_name, 0, LOG_DAEMON);
openlog(applet_name, 0, LOG_DAEMON);
syslog(LOG_INFO, "%s", msg + 1);
closelog();
}
Expand Down Expand Up @@ -982,7 +982,7 @@ int init_main(int argc, char **argv)
#if !ENABLE_DEBUG_INIT
/* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
if (getpid() != 1 &&
(!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc")))
(!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc")))
{
bb_show_usage();
}
Expand Down
2 changes: 1 addition & 1 deletion init/init_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int bb_shutdown_system(unsigned long magic)
#endif
reboot(RB_ENABLE_CAD);

openlog(bb_applet_name, 0, pri);
openlog(applet_name, 0, pri);

message = "\nThe system is going down NOW !!";
syslog(pri, "%s", message);
Expand Down
2 changes: 1 addition & 1 deletion libbb/copy_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int copy_file(const char *source, const char *dest, int flags)

if (dest_exists) {
if (flags & FILEUTILS_INTERACTIVE) {
fprintf(stderr, "%s: overwrite `%s'? ", bb_applet_name, dest);
fprintf(stderr, "%s: overwrite `%s'? ", applet_name, dest);
if (!bb_ask_confirmation()) {
close (src_fd);
return 0;
Expand Down
6 changes: 3 additions & 3 deletions libbb/remove_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int remove_file(const char *path, int flags)
if ((!(flags & FILEUTILS_FORCE) && access(path, W_OK) < 0 &&
isatty(0)) ||
(flags & FILEUTILS_INTERACTIVE)) {
fprintf(stderr, "%s: descend into directory `%s'? ", bb_applet_name,
fprintf(stderr, "%s: descend into directory `%s'? ", applet_name,
path);
if (!bb_ask_confirmation())
return 0;
Expand All @@ -80,7 +80,7 @@ int remove_file(const char *path, int flags)
}

if (flags & FILEUTILS_INTERACTIVE) {
fprintf(stderr, "%s: remove directory `%s'? ", bb_applet_name, path);
fprintf(stderr, "%s: remove directory `%s'? ", applet_name, path);
if (!bb_ask_confirmation())
return status;
}
Expand All @@ -96,7 +96,7 @@ int remove_file(const char *path, int flags)
!S_ISLNK(path_stat.st_mode) &&
isatty(0)) ||
(flags & FILEUTILS_INTERACTIVE)) {
fprintf(stderr, "%s: remove `%s'? ", bb_applet_name, path);
fprintf(stderr, "%s: remove `%s'? ", applet_name, path);
if (!bb_ask_confirmation())
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion libbb/verror_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void bb_verror_msg(const char *s, va_list p, const char* strerr)

if (logmode & LOGMODE_STDIO) {
fflush(stdout);
fprintf(stderr, "%s: ", bb_applet_name);
fprintf(stderr, "%s: ", applet_name);
vfprintf(stderr, s, p);
if (!strerr)
fputs(msg_eol, stderr);
Expand Down
2 changes: 1 addition & 1 deletion loginutils/deluser.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int deluser_main(int argc, char **argv)
if (argc != 2) {
bb_show_usage();
} else {
if (ENABLE_DELUSER && bb_applet_name[3] == 'u') {
if (ENABLE_DELUSER && applet_name[3] == 'u') {
del_line_matching(argv[1], bb_path_passwd_file);
if (ENABLE_FEATURE_SHADOWPASSWDS)
del_line_matching(argv[1], bb_path_shadow_file);
Expand Down
2 changes: 1 addition & 1 deletion loginutils/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ int getty_main(int argc, char **argv)
dup2(nullfd, 2);
if(nullfd > 2)
close(nullfd);
openlog(bb_applet_name, LOG_PID, LOG_AUTH);
openlog(applet_name, LOG_PID, LOG_AUTH);
logmode = LOGMODE_BOTH;

#ifdef DEBUGGING
Expand Down
2 changes: 1 addition & 1 deletion loginutils/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ int login_main(int argc, char **argv)

bb_setpgrp;

openlog(bb_applet_name, LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
openlog(applet_name, LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);

while (1) {
if (!username[0])
Expand Down
2 changes: 1 addition & 1 deletion loginutils/su.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int su_main(int argc, char **argv)
in this case resort to getpwuid. */
old_user = xstrdup(USE_FEATURE_UTMP(getlogin() ? : ) (pw = getpwuid(cur_uid)) ? pw->pw_name : "");
tty = ttyname(2) ? : "none";
openlog(bb_applet_name, 0, LOG_AUTH);
openlog(applet_name, 0, LOG_AUTH);
}

pw = getpwnam(opt_username);
Expand Down
2 changes: 1 addition & 1 deletion loginutils/sulogin.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int sulogin_main(int argc, char **argv)
struct spwd *spwd;

logmode = LOGMODE_BOTH;
openlog(bb_applet_name, 0, LOG_AUTH);
openlog(applet_name, 0, LOG_AUTH);

if (getopt32 (argc, argv, "t:", &timeout_arg)) {
if (safe_strtoi(timeout_arg, &timeout)) {
Expand Down
4 changes: 2 additions & 2 deletions miscutils/crond.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ int crond_main(int ac, char **av)
*/

crondlog("\011%s " VERSION " dillon, started, log level %d\n",
bb_applet_name, LogLevel);
applet_name, LogLevel);

SynchronizeDir();

Expand Down Expand Up @@ -305,7 +305,7 @@ static int ChangeUser(const char *user)
static void startlogger(void)
{
if (LogFile == 0) {
openlog(bb_applet_name, LOG_CONS | LOG_PID, LOG_CRON);
openlog(applet_name, LOG_CONS | LOG_PID, LOG_CRON);
}
#if ENABLE_DEBUG_CROND_OPTION
else { /* test logfile */
Expand Down
6 changes: 3 additions & 3 deletions miscutils/devfsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static void msg_logger(int pri, const char * fmt, ... )
va_start(ap, fmt);
ret = access ("/dev/log", F_OK);
if (ret == 0) {
openlog(bb_applet_name, 0, LOG_DAEMON);
openlog(applet_name, 0, LOG_DAEMON);
vsyslog( pri , fmt, ap);
/* Man: A trailing newline is added when needed. */
closelog();
Expand Down Expand Up @@ -492,7 +492,7 @@ int devfsd_main (int argc, char **argv)
if ( print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) )
{
bb_printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
bb_applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)
bb_error_msg_and_die( "%s mismatch!",bb_msg_proto_rev);
Expand All @@ -509,7 +509,7 @@ int devfsd_main (int argc, char **argv)
if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 )
devfsd_error_msg_and_die( "sigaction");

bb_printf("%s v%s started for %s\n",bb_applet_name, DEVFSD_VERSION, mount_point);
bb_printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);

/* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */
umask (0);
Expand Down
2 changes: 1 addition & 1 deletion networking/fakeidentd.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int checkInput(char *buf, int len, int l)
int fakeidentd_main(int argc, char **argv)
{
/* This applet is an inetd-style daemon */
openlog(bb_applet_name, 0, LOG_DAEMON);
openlog(applet_name, 0, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;

memset(conns, 0, sizeof(conns));
Expand Down
4 changes: 2 additions & 2 deletions networking/ftpgetput.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ int ftpgetput_main(int argc, char **argv)
int (*ftp_action)(ftp_host_info_t *, FILE *, const char *, char *) = NULL;

/* Check to see if the command is ftpget or ftput */
if (ENABLE_FTPPUT && (!ENABLE_FTPGET || bb_applet_name[3] == 'p')) {
if (ENABLE_FTPPUT && (!ENABLE_FTPGET || applet_name[3] == 'p')) {
ftp_action = ftp_send;
}
if (ENABLE_FTPGET && (!ENABLE_FTPPUT || bb_applet_name[3] == 'g')) {
if (ENABLE_FTPGET && (!ENABLE_FTPPUT || applet_name[3] == 'g')) {
ftp_action = ftp_receive;
}

Expand Down
2 changes: 1 addition & 1 deletion networking/ifupdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ int ifupdown_main(int argc, char **argv)
int any_failures = 0;
int i;

if (bb_applet_name[2] == 'u') {
if (applet_name[2] == 'u') {
/* ifup command */
cmds = iface_up;
} else {
Expand Down
2 changes: 1 addition & 1 deletion networking/inetd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ inetd_main(int argc, char *argv[])
LastArg = envp[-1] + strlen(envp[-1]);
#endif

openlog(bb_applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
openlog(applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON);

opt = getopt32(argc, argv, "R:f", &stoomany);
if(opt & 1) {
Expand Down
Loading

0 comments on commit 8f8f268

Please sign in to comment.