+ in the interest of robustness, I added
[oweals/busybox.git] / busybox.c
index 9a48f496146cb24390fe956df7374099d4259a30..15d53eb054dadc4abc429a272333f482bb58f790 100644 (file)
--- a/busybox.c
+++ b/busybox.c
@@ -45,13 +45,13 @@ static const struct Applet applets[] = {
        {"cat", cat_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_CHMOD_CHOWN_CHGRP
-       {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
+       {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_CHMOD_CHOWN_CHGRP
-       {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
+       {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_CHMOD_CHOWN_CHGRP
-       {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
+       {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_CHROOT
        {"chroot", chroot_main, _BB_DIR_SBIN},
@@ -65,9 +65,6 @@ static const struct Applet applets[] = {
 #ifdef BB_CP_MV
        {"cp", cp_mv_main, _BB_DIR_BIN},
 #endif
-#ifdef BB_CP_MV
-       {"mv", cp_mv_main, _BB_DIR_BIN},
-#endif
 #ifdef BB_DATE
        {"date", date_main, _BB_DIR_BIN},
 #endif
@@ -92,6 +89,9 @@ static const struct Applet applets[] = {
 #ifdef BB_ECHO
        {"echo", echo_main, _BB_DIR_BIN},
 #endif
+#ifdef BB_TRUE_FALSE
+       {"false", false_main, _BB_DIR_BIN},
+#endif
 #ifdef BB_FBSET
        {"fbset", fbset_main, _BB_DIR_USR_SBIN},
 #endif
@@ -113,12 +113,15 @@ static const struct Applet applets[] = {
 #ifdef BB_FSCK_MINIX
        {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
 #endif
-#ifdef BB_MKFS_MINIX
-       {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
-#endif
 #ifdef BB_GREP
        {"grep", grep_main, _BB_DIR_BIN},
 #endif
+#ifdef BB_GUNZIP
+       {"gunzip", gunzip_main, _BB_DIR_BIN},
+#endif
+#ifdef BB_GZIP
+       {"gzip", gzip_main, _BB_DIR_BIN},
+#endif
 #ifdef BB_HALT
        {"halt", halt_main, _BB_DIR_SBIN},
 #endif
@@ -137,9 +140,6 @@ static const struct Applet applets[] = {
 #ifdef BB_INSMOD
        {"insmod", insmod_main, _BB_DIR_SBIN},
 #endif
-#ifdef BB_FEATURE_LINUXRC              //
-       {"linuxrc", init_main, _BB_DIR_ROOT},
-#endif
 #ifdef BB_KILL
        {"kill", kill_main, _BB_DIR_BIN},
 #endif
@@ -149,6 +149,9 @@ static const struct Applet applets[] = {
 #ifdef BB_LENGTH
        {"length", length_main, _BB_DIR_USR_BIN},
 #endif
+#ifdef BB_FEATURE_LINUXRC              //
+       {"linuxrc", init_main, _BB_DIR_ROOT},
+#endif
 #ifdef BB_LN
        {"ln", ln_main, _BB_DIR_BIN},
 #endif
@@ -161,6 +164,12 @@ static const struct Applet applets[] = {
 #ifdef BB_LOADKMAP
        {"loadkmap", loadkmap_main, _BB_DIR_SBIN},
 #endif
+#ifdef BB_LOGGER
+       {"logger", logger_main, _BB_DIR_USR_BIN},
+#endif
+#ifdef BB_LOGNAME
+       {"logname", logname_main, _BB_DIR_USR_BIN},
+#endif
 #ifdef BB_LS
        {"ls", ls_main, _BB_DIR_BIN},
 #endif
@@ -179,6 +188,9 @@ static const struct Applet applets[] = {
 #ifdef BB_MKFIFO
        {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
 #endif
+#ifdef BB_MKFS_MINIX
+       {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
+#endif
 #ifdef BB_MKNOD
        {"mknod", mknod_main, _BB_DIR_BIN},
 #endif
@@ -197,6 +209,9 @@ static const struct Applet applets[] = {
 #ifdef BB_MT
        {"mt", mt_main, _BB_DIR_BIN},
 #endif
+#ifdef BB_CP_MV
+       {"mv", cp_mv_main, _BB_DIR_BIN},
+#endif
 #ifdef BB_NSLOOKUP
        {"nslookup", nslookup_main, _BB_DIR_USR_BIN},
 #endif
@@ -234,9 +249,6 @@ static const struct Applet applets[] = {
        {"sh", shell_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_SFDISK
-       {"fdisk", sfdisk_main, _BB_DIR_SBIN},
-#ifdef BB_SFDISK
-#endif
        {"sfdisk", sfdisk_main, _BB_DIR_SBIN},
 #endif
 #ifdef BB_SLEEP
@@ -251,12 +263,6 @@ static const struct Applet applets[] = {
 #ifdef BB_SYSLOGD
        {"syslogd", syslogd_main, _BB_DIR_SBIN},
 #endif
-#ifdef BB_LOGGER
-       {"logger", logger_main, _BB_DIR_USR_BIN},
-#endif
-#ifdef BB_LOGNAME
-       {"logname", logname_main, _BB_DIR_USR_BIN},
-#endif
 #ifdef BB_SWAPONOFF
        {"swapon", swap_on_off_main, _BB_DIR_SBIN},
 #endif
@@ -272,9 +278,6 @@ static const struct Applet applets[] = {
 #ifdef BB_TELNET
        {"telnet", telnet_main, _BB_DIR_USR_BIN},
 #endif
-#ifdef BB_TEST
-       {"[", test_main, _BB_DIR_USR_BIN},
-#endif
 #ifdef BB_TEST
        {"test", test_main, _BB_DIR_USR_BIN},
 #endif
@@ -290,9 +293,6 @@ static const struct Applet applets[] = {
 #ifdef BB_TRUE_FALSE
        {"true", true_main, _BB_DIR_BIN},
 #endif
-#ifdef BB_TRUE_FALSE
-       {"false", false_main, _BB_DIR_BIN},
-#endif
 #ifdef BB_TTY
        {"tty", tty_main, _BB_DIR_USR_BIN},
 #endif
@@ -302,15 +302,15 @@ static const struct Applet applets[] = {
 #ifdef BB_UNAME
        {"uname", uname_main, _BB_DIR_BIN},
 #endif
-#ifdef BB_UPTIME
-       {"uptime", uptime_main, _BB_DIR_USR_BIN},
-#endif
 #ifdef BB_UNIQ
        {"uniq", uniq_main, _BB_DIR_BIN},
 #endif
 #ifdef BB_UPDATE
        {"update", update_main, _BB_DIR_SBIN},
 #endif
+#ifdef BB_UPTIME
+       {"uptime", uptime_main, _BB_DIR_USR_BIN},
+#endif
 #ifdef BB_USLEEP
        {"usleep", usleep_main, _BB_DIR_BIN},
 #endif
@@ -326,11 +326,8 @@ static const struct Applet applets[] = {
 #ifdef BB_GUNZIP
        {"zcat", gunzip_main, _BB_DIR_BIN},
 #endif
-#ifdef BB_GUNZIP
-       {"gunzip", gunzip_main, _BB_DIR_BIN},
-#endif
-#ifdef BB_GZIP
-       {"gzip", gzip_main, _BB_DIR_BIN},
+#ifdef BB_TEST
+       {"[", test_main, _BB_DIR_USR_BIN},
 #endif
        {0}
 };
@@ -382,8 +379,10 @@ int busybox_main(int argc, char **argv)
                fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
                fprintf(stderr, "   or: [function] [arguments]...\n\n");
                fprintf(stderr,
-                               "\tMost people will create a link to busybox for each function\n"
-                               "\tname, and busybox will act like whatever you invoke it as.\n");
+                               "\tBusyBox is a multi-call binary that combines many common Unix\n"
+                               "\tutilities into a single executable.  Most people will create a\n"
+                               "\tlink to busybox for each function they wish to use, and BusyBox\n"
+                               "\twill act like whatever it was invoked as.\n");
                fprintf(stderr, "\nCurrently defined functions:\n");
 
                while (a->name != 0) {