More documentation updates, and minor fixes to make things sync
up with the docs. -Erik
This commit is contained in:
5
TODO
5
TODO
@ -28,6 +28,11 @@ around to it some time. If you have any good ideas, please let me know.
|
|||||||
* ftp
|
* ftp
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Add a compile option to turn off all the compiled in help
|
||||||
|
andusage information. Some folks don't need or want it...
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Compile with debugging on, run 'nm --size-sort ./busybox'
|
Compile with debugging on, run 'nm --size-sort ./busybox'
|
||||||
|
@ -44,15 +44,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_CAT
|
#ifdef BB_CAT
|
||||||
{"cat", cat_main, _BB_DIR_BIN},
|
{"cat", cat_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
|
{"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
{"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
{"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
{"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
{"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
|
||||||
{"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_CHROOT
|
#ifdef BB_CHROOT
|
||||||
{"chroot", chroot_main, _BB_DIR_SBIN},
|
{"chroot", chroot_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -65,9 +65,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_CP_MV
|
#ifdef BB_CP_MV
|
||||||
{"cp", cp_mv_main, _BB_DIR_BIN},
|
{"cp", cp_mv_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CP_MV
|
|
||||||
{"mv", cp_mv_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_DATE
|
#ifdef BB_DATE
|
||||||
{"date", date_main, _BB_DIR_BIN},
|
{"date", date_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -92,6 +89,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_ECHO
|
#ifdef BB_ECHO
|
||||||
{"echo", echo_main, _BB_DIR_BIN},
|
{"echo", echo_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_TRUE_FALSE
|
||||||
|
{"false", false_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_FBSET
|
#ifdef BB_FBSET
|
||||||
{"fbset", fbset_main, _BB_DIR_USR_SBIN},
|
{"fbset", fbset_main, _BB_DIR_USR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -113,12 +113,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_FSCK_MINIX
|
#ifdef BB_FSCK_MINIX
|
||||||
{"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
|
{"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_MKFS_MINIX
|
|
||||||
{"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_GREP
|
#ifdef BB_GREP
|
||||||
{"grep", grep_main, _BB_DIR_BIN},
|
{"grep", grep_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_GUNZIP
|
||||||
|
{"gunzip", gunzip_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
|
#ifdef BB_GZIP
|
||||||
|
{"gzip", gzip_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_HALT
|
#ifdef BB_HALT
|
||||||
{"halt", halt_main, _BB_DIR_SBIN},
|
{"halt", halt_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -137,9 +140,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_INSMOD
|
#ifdef BB_INSMOD
|
||||||
{"insmod", insmod_main, _BB_DIR_SBIN},
|
{"insmod", insmod_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_FEATURE_LINUXRC //
|
|
||||||
{"linuxrc", init_main, _BB_DIR_ROOT},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_KILL
|
#ifdef BB_KILL
|
||||||
{"kill", kill_main, _BB_DIR_BIN},
|
{"kill", kill_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -149,6 +149,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_LENGTH
|
#ifdef BB_LENGTH
|
||||||
{"length", length_main, _BB_DIR_USR_BIN},
|
{"length", length_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_FEATURE_LINUXRC //
|
||||||
|
{"linuxrc", init_main, _BB_DIR_ROOT},
|
||||||
|
#endif
|
||||||
#ifdef BB_LN
|
#ifdef BB_LN
|
||||||
{"ln", ln_main, _BB_DIR_BIN},
|
{"ln", ln_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -161,6 +164,12 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_LOADKMAP
|
#ifdef BB_LOADKMAP
|
||||||
{"loadkmap", loadkmap_main, _BB_DIR_SBIN},
|
{"loadkmap", loadkmap_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#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
|
#ifdef BB_LS
|
||||||
{"ls", ls_main, _BB_DIR_BIN},
|
{"ls", ls_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -179,6 +188,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MKFIFO
|
#ifdef BB_MKFIFO
|
||||||
{"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
|
{"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_MKFS_MINIX
|
||||||
|
{"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_MKNOD
|
#ifdef BB_MKNOD
|
||||||
{"mknod", mknod_main, _BB_DIR_BIN},
|
{"mknod", mknod_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -197,6 +209,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MT
|
#ifdef BB_MT
|
||||||
{"mt", mt_main, _BB_DIR_BIN},
|
{"mt", mt_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_CP_MV
|
||||||
|
{"mv", cp_mv_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_NSLOOKUP
|
#ifdef BB_NSLOOKUP
|
||||||
{"nslookup", nslookup_main, _BB_DIR_USR_BIN},
|
{"nslookup", nslookup_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -248,12 +263,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_SYSLOGD
|
#ifdef BB_SYSLOGD
|
||||||
{"syslogd", syslogd_main, _BB_DIR_SBIN},
|
{"syslogd", syslogd_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#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
|
#ifdef BB_SWAPONOFF
|
||||||
{"swapon", swap_on_off_main, _BB_DIR_SBIN},
|
{"swapon", swap_on_off_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -269,9 +278,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_TELNET
|
#ifdef BB_TELNET
|
||||||
{"telnet", telnet_main, _BB_DIR_USR_BIN},
|
{"telnet", telnet_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_TEST
|
|
||||||
{"[", test_main, _BB_DIR_USR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_TEST
|
#ifdef BB_TEST
|
||||||
{"test", test_main, _BB_DIR_USR_BIN},
|
{"test", test_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -287,9 +293,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_TRUE_FALSE
|
#ifdef BB_TRUE_FALSE
|
||||||
{"true", true_main, _BB_DIR_BIN},
|
{"true", true_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_TRUE_FALSE
|
|
||||||
{"false", false_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_TTY
|
#ifdef BB_TTY
|
||||||
{"tty", tty_main, _BB_DIR_USR_BIN},
|
{"tty", tty_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -299,15 +302,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_UNAME
|
#ifdef BB_UNAME
|
||||||
{"uname", uname_main, _BB_DIR_BIN},
|
{"uname", uname_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_UPTIME
|
|
||||||
{"uptime", uptime_main, _BB_DIR_USR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_UNIQ
|
#ifdef BB_UNIQ
|
||||||
{"uniq", uniq_main, _BB_DIR_BIN},
|
{"uniq", uniq_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_UPDATE
|
#ifdef BB_UPDATE
|
||||||
{"update", update_main, _BB_DIR_SBIN},
|
{"update", update_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_UPTIME
|
||||||
|
{"uptime", uptime_main, _BB_DIR_USR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_USLEEP
|
#ifdef BB_USLEEP
|
||||||
{"usleep", usleep_main, _BB_DIR_BIN},
|
{"usleep", usleep_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -323,11 +326,8 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_GUNZIP
|
#ifdef BB_GUNZIP
|
||||||
{"zcat", gunzip_main, _BB_DIR_BIN},
|
{"zcat", gunzip_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_GUNZIP
|
#ifdef BB_TEST
|
||||||
{"gunzip", gunzip_main, _BB_DIR_BIN},
|
{"[", test_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
|
||||||
#ifdef BB_GZIP
|
|
||||||
{"gzip", gzip_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
#endif
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
static const char gzip_usage[] =
|
static const char gzip_usage[] =
|
||||||
"gzip [OPTION]... FILE\n\n"
|
"gzip [OPTION]... FILE\n\n"
|
||||||
"Compress FILE with maximum compression.\n"
|
"Compress FILE with maximum compression.\n"
|
||||||
"When FILE is -, reads standard input. Implies -c.\n\n"
|
"When FILE is '-', reads standard input. Implies -c.\n\n"
|
||||||
|
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-c\tWrite output to standard output instead of FILE.gz\n";
|
"\t-c\tWrite output to standard output instead of FILE.gz\n";
|
||||||
|
64
busybox.c
64
busybox.c
@ -44,15 +44,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_CAT
|
#ifdef BB_CAT
|
||||||
{"cat", cat_main, _BB_DIR_BIN},
|
{"cat", cat_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
|
{"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
{"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
{"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||||
{"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
{"chown", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
|
||||||
{"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_CHROOT
|
#ifdef BB_CHROOT
|
||||||
{"chroot", chroot_main, _BB_DIR_SBIN},
|
{"chroot", chroot_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -65,9 +65,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_CP_MV
|
#ifdef BB_CP_MV
|
||||||
{"cp", cp_mv_main, _BB_DIR_BIN},
|
{"cp", cp_mv_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_CP_MV
|
|
||||||
{"mv", cp_mv_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_DATE
|
#ifdef BB_DATE
|
||||||
{"date", date_main, _BB_DIR_BIN},
|
{"date", date_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -92,6 +89,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_ECHO
|
#ifdef BB_ECHO
|
||||||
{"echo", echo_main, _BB_DIR_BIN},
|
{"echo", echo_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_TRUE_FALSE
|
||||||
|
{"false", false_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_FBSET
|
#ifdef BB_FBSET
|
||||||
{"fbset", fbset_main, _BB_DIR_USR_SBIN},
|
{"fbset", fbset_main, _BB_DIR_USR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -113,12 +113,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_FSCK_MINIX
|
#ifdef BB_FSCK_MINIX
|
||||||
{"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
|
{"fsck.minix", fsck_minix_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_MKFS_MINIX
|
|
||||||
{"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_GREP
|
#ifdef BB_GREP
|
||||||
{"grep", grep_main, _BB_DIR_BIN},
|
{"grep", grep_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_GUNZIP
|
||||||
|
{"gunzip", gunzip_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
|
#ifdef BB_GZIP
|
||||||
|
{"gzip", gzip_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_HALT
|
#ifdef BB_HALT
|
||||||
{"halt", halt_main, _BB_DIR_SBIN},
|
{"halt", halt_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -137,9 +140,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_INSMOD
|
#ifdef BB_INSMOD
|
||||||
{"insmod", insmod_main, _BB_DIR_SBIN},
|
{"insmod", insmod_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_FEATURE_LINUXRC //
|
|
||||||
{"linuxrc", init_main, _BB_DIR_ROOT},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_KILL
|
#ifdef BB_KILL
|
||||||
{"kill", kill_main, _BB_DIR_BIN},
|
{"kill", kill_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -149,6 +149,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_LENGTH
|
#ifdef BB_LENGTH
|
||||||
{"length", length_main, _BB_DIR_USR_BIN},
|
{"length", length_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_FEATURE_LINUXRC //
|
||||||
|
{"linuxrc", init_main, _BB_DIR_ROOT},
|
||||||
|
#endif
|
||||||
#ifdef BB_LN
|
#ifdef BB_LN
|
||||||
{"ln", ln_main, _BB_DIR_BIN},
|
{"ln", ln_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -161,6 +164,12 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_LOADKMAP
|
#ifdef BB_LOADKMAP
|
||||||
{"loadkmap", loadkmap_main, _BB_DIR_SBIN},
|
{"loadkmap", loadkmap_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#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
|
#ifdef BB_LS
|
||||||
{"ls", ls_main, _BB_DIR_BIN},
|
{"ls", ls_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -179,6 +188,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MKFIFO
|
#ifdef BB_MKFIFO
|
||||||
{"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
|
{"mkfifo", mkfifo_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_MKFS_MINIX
|
||||||
|
{"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_MKNOD
|
#ifdef BB_MKNOD
|
||||||
{"mknod", mknod_main, _BB_DIR_BIN},
|
{"mknod", mknod_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -197,6 +209,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MT
|
#ifdef BB_MT
|
||||||
{"mt", mt_main, _BB_DIR_BIN},
|
{"mt", mt_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_CP_MV
|
||||||
|
{"mv", cp_mv_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_NSLOOKUP
|
#ifdef BB_NSLOOKUP
|
||||||
{"nslookup", nslookup_main, _BB_DIR_USR_BIN},
|
{"nslookup", nslookup_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -248,12 +263,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_SYSLOGD
|
#ifdef BB_SYSLOGD
|
||||||
{"syslogd", syslogd_main, _BB_DIR_SBIN},
|
{"syslogd", syslogd_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#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
|
#ifdef BB_SWAPONOFF
|
||||||
{"swapon", swap_on_off_main, _BB_DIR_SBIN},
|
{"swapon", swap_on_off_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
@ -269,9 +278,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_TELNET
|
#ifdef BB_TELNET
|
||||||
{"telnet", telnet_main, _BB_DIR_USR_BIN},
|
{"telnet", telnet_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_TEST
|
|
||||||
{"[", test_main, _BB_DIR_USR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_TEST
|
#ifdef BB_TEST
|
||||||
{"test", test_main, _BB_DIR_USR_BIN},
|
{"test", test_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -287,9 +293,6 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_TRUE_FALSE
|
#ifdef BB_TRUE_FALSE
|
||||||
{"true", true_main, _BB_DIR_BIN},
|
{"true", true_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_TRUE_FALSE
|
|
||||||
{"false", false_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_TTY
|
#ifdef BB_TTY
|
||||||
{"tty", tty_main, _BB_DIR_USR_BIN},
|
{"tty", tty_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -299,15 +302,15 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_UNAME
|
#ifdef BB_UNAME
|
||||||
{"uname", uname_main, _BB_DIR_BIN},
|
{"uname", uname_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_UPTIME
|
|
||||||
{"uptime", uptime_main, _BB_DIR_USR_BIN},
|
|
||||||
#endif
|
|
||||||
#ifdef BB_UNIQ
|
#ifdef BB_UNIQ
|
||||||
{"uniq", uniq_main, _BB_DIR_BIN},
|
{"uniq", uniq_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_UPDATE
|
#ifdef BB_UPDATE
|
||||||
{"update", update_main, _BB_DIR_SBIN},
|
{"update", update_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_UPTIME
|
||||||
|
{"uptime", uptime_main, _BB_DIR_USR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_USLEEP
|
#ifdef BB_USLEEP
|
||||||
{"usleep", usleep_main, _BB_DIR_BIN},
|
{"usleep", usleep_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
@ -323,11 +326,8 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_GUNZIP
|
#ifdef BB_GUNZIP
|
||||||
{"zcat", gunzip_main, _BB_DIR_BIN},
|
{"zcat", gunzip_main, _BB_DIR_BIN},
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_GUNZIP
|
#ifdef BB_TEST
|
||||||
{"gunzip", gunzip_main, _BB_DIR_BIN},
|
{"[", test_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
|
||||||
#ifdef BB_GZIP
|
|
||||||
{"gzip", gzip_main, _BB_DIR_BIN},
|
|
||||||
#endif
|
#endif
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
@ -32,12 +32,12 @@
|
|||||||
#define BB_GREP
|
#define BB_GREP
|
||||||
#define BB_GUNZIP
|
#define BB_GUNZIP
|
||||||
#define BB_GZIP
|
#define BB_GZIP
|
||||||
//#define BB_HALT
|
#define BB_HALT
|
||||||
#define BB_HEAD
|
#define BB_HEAD
|
||||||
#define BB_HOSTID
|
#define BB_HOSTID
|
||||||
#define BB_HOSTNAME
|
#define BB_HOSTNAME
|
||||||
#define BB_INIT
|
#define BB_INIT
|
||||||
// Don't bother turning BB_INSMOD on. It doesn't work.
|
// Don't bother turning BB_INSMOD on. It doesn't work yet.
|
||||||
//#define BB_INSMOD
|
//#define BB_INSMOD
|
||||||
#define BB_KILL
|
#define BB_KILL
|
||||||
#define BB_KILLALL
|
#define BB_KILLALL
|
||||||
@ -65,11 +65,11 @@
|
|||||||
#define BB_MT
|
#define BB_MT
|
||||||
#define BB_NSLOOKUP
|
#define BB_NSLOOKUP
|
||||||
#define BB_PING
|
#define BB_PING
|
||||||
//#define BB_POWEROFF
|
#define BB_POWEROFF
|
||||||
#define BB_PRINTF
|
#define BB_PRINTF
|
||||||
#define BB_PS
|
#define BB_PS
|
||||||
#define BB_PWD
|
#define BB_PWD
|
||||||
//#define BB_REBOOT
|
#define BB_REBOOT
|
||||||
#define BB_RM
|
#define BB_RM
|
||||||
#define BB_RMDIR
|
#define BB_RMDIR
|
||||||
#define BB_RMMOD
|
#define BB_RMMOD
|
||||||
@ -85,7 +85,7 @@
|
|||||||
#define BB_TAR
|
#define BB_TAR
|
||||||
#define BB_TEE
|
#define BB_TEE
|
||||||
#define BB_TEST
|
#define BB_TEST
|
||||||
// Don't turn BB_TELNET on. It doesn't work.
|
// Don't bother turning BB_TELNET on. It doesn't work properly yet.
|
||||||
//#define BB_TELNET
|
//#define BB_TELNET
|
||||||
#define BB_TOUCH
|
#define BB_TOUCH
|
||||||
#define BB_TR
|
#define BB_TR
|
||||||
@ -115,6 +115,7 @@
|
|||||||
// the /proc filesystem and thereby saving lots and lots
|
// the /proc filesystem and thereby saving lots and lots
|
||||||
// memory for more important things.
|
// memory for more important things.
|
||||||
// You can't use this and USE_PROCFS at the same time...
|
// You can't use this and USE_PROCFS at the same time...
|
||||||
|
// (BTW, I emailed Linus and this patch will not be going into the stock kernel)
|
||||||
//#define BB_FEATURE_USE_DEVPS_PATCH
|
//#define BB_FEATURE_USE_DEVPS_PATCH
|
||||||
//
|
//
|
||||||
// enable features that use the /proc filesystem (apps that
|
// enable features that use the /proc filesystem (apps that
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
|
static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
|
||||||
"Create the named fifo\n\n"
|
"Creates a named pipe (identical to 'mknod name p')\n\n"
|
||||||
|
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n";
|
"\t-m\tcreate the pipe using the specified mode (default a=rw)\n";
|
||||||
|
|
||||||
extern int mkfifo_main(int argc, char **argv)
|
extern int mkfifo_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -28,23 +28,47 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n"
|
static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n\n"
|
||||||
"Make block or character special files.\n\n"
|
"Create a special file (block, character, or pipe).\n\n"
|
||||||
|
"Options:\n"
|
||||||
|
"\t-m\tcreate the special file using the specified mode (default a=rw)\n\n"
|
||||||
"TYPEs include:\n"
|
"TYPEs include:\n"
|
||||||
"\tb:\tMake a block (buffered) device.\n"
|
"\tb:\tMake a block (buffered) device.\n"
|
||||||
|
|
||||||
"\tc or u:\tMake a character (un-buffered) device.\n"
|
"\tc or u:\tMake a character (un-buffered) device.\n"
|
||||||
"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
|
"\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n";
|
||||||
|
|
||||||
int mknod_main(int argc, char **argv)
|
int mknod_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
char *thisarg;
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
mode_t perm = 0666;
|
||||||
dev_t dev = 0;
|
dev_t dev = 0;
|
||||||
|
|
||||||
if (argc != 5 || **(argv + 1) == '-') {
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
|
/* Parse any options */
|
||||||
|
while (argc > 1) {
|
||||||
|
if (**argv != '-')
|
||||||
|
break;
|
||||||
|
thisarg = *argv;
|
||||||
|
thisarg++;
|
||||||
|
switch (*thisarg) {
|
||||||
|
case 'm':
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
parse_mode(*argv, &perm);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(mknod_usage);
|
||||||
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
if (argc != 4 && argc != 2) {
|
||||||
usage(mknod_usage);
|
usage(mknod_usage);
|
||||||
}
|
}
|
||||||
switch (argv[2][0]) {
|
switch (argv[1][0]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'u':
|
case 'u':
|
||||||
mode = S_IFCHR;
|
mode = S_IFCHR;
|
||||||
@ -54,23 +78,22 @@ int mknod_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
mode = S_IFIFO;
|
mode = S_IFIFO;
|
||||||
|
if (argc!=2) {
|
||||||
|
usage(mknod_usage);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(mknod_usage);
|
usage(mknod_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == S_IFCHR || mode == S_IFBLK) {
|
if (mode == S_IFCHR || mode == S_IFBLK) {
|
||||||
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
|
dev = (atoi(argv[2]) << 8) | atoi(argv[1]);
|
||||||
if (argc != 5) {
|
|
||||||
usage(mknod_usage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mode |= 0666;
|
mode |= perm;
|
||||||
|
|
||||||
if (mknod(argv[1], mode, dev) != 0) {
|
if (mknod(argv[0], mode, dev) != 0)
|
||||||
perror(argv[1]);
|
fatalError("%s: %s\n", argv[0], strerror(errno));
|
||||||
exit (FALSE);
|
|
||||||
}
|
|
||||||
exit (TRUE);
|
exit (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static void verify __P((char *s, char *end));
|
|||||||
/* The value to return to the calling program. */
|
/* The value to return to the calling program. */
|
||||||
static int exit_status;
|
static int exit_status;
|
||||||
|
|
||||||
static const char printf_usage[] = "printf format [argument...]\n";
|
static const char printf_usage[] = "printf format [argument...]\n\nFormats and prints the given data.\n";
|
||||||
|
|
||||||
int printf_main(int argc, char **argv)
|
int printf_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ static const char sort_usage[] = "sort [-n]"
|
|||||||
#ifdef BB_FEATURE_SORT_REVERSE
|
#ifdef BB_FEATURE_SORT_REVERSE
|
||||||
" [-r]"
|
" [-r]"
|
||||||
#endif
|
#endif
|
||||||
" [FILE]...\n\n";
|
" [FILE]...\n\nSorts lines of text in the specified files\n";
|
||||||
|
|
||||||
#ifdef BB_FEATURE_SORT_REVERSE
|
#ifdef BB_FEATURE_SORT_REVERSE
|
||||||
#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
|
#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
|
||||||
@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */
|
/* $Id: sort.c,v 1.14 2000/04/15 16:34:54 erik Exp $ */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* echo implementation for busybox
|
* test implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (c) by a whole pile of folks:
|
* Copyright (c) by a whole pile of folks:
|
||||||
*
|
*
|
||||||
@ -185,6 +185,12 @@ test_main(int argc, char** argv)
|
|||||||
fatalError("missing ]");
|
fatalError("missing ]");
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
|
if (strcmp(argv[1], "--help") == 0) {
|
||||||
|
usage("test EXPRESSION\n"
|
||||||
|
"or [ EXPRESSION ]\n\n"
|
||||||
|
"Checks file types and compares values returning an exit\n"
|
||||||
|
"code determined by the value of EXPRESSION.\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
|
@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
|
|||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
|
|
||||||
"$Id: tr.c,v 1.2 2000/03/21 22:32:57 erik Exp $";
|
"$Id: tr.c,v 1.3 2000/04/15 16:34:54 erik Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif /* #if 0 */
|
#endif /* #if 0 */
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ int cflag;
|
|||||||
|
|
||||||
static void tr_usage()
|
static void tr_usage()
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
usage( "\ttr [-csu] string1 string2\n"
|
||||||
"usage: tr [-csu] string1 string2",
|
"\ttr [-cu] -d string1\n"
|
||||||
" tr [-cu] -d string1",
|
"\ttr [-cu] -s string1\n"
|
||||||
" tr [-cu] -s string1",
|
"\ttr [-cu] -ds string1 string2\n\n"
|
||||||
" tr [-cu] -ds string1 string2");
|
"Translate, squeeze, and/or delete characters from standard\n"
|
||||||
exit(1);
|
"input, writing to standard output.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
757
docs/busybox.pod
757
docs/busybox.pod
File diff suppressed because it is too large
Load Diff
2
gzip.c
2
gzip.c
@ -41,7 +41,7 @@
|
|||||||
static const char gzip_usage[] =
|
static const char gzip_usage[] =
|
||||||
"gzip [OPTION]... FILE\n\n"
|
"gzip [OPTION]... FILE\n\n"
|
||||||
"Compress FILE with maximum compression.\n"
|
"Compress FILE with maximum compression.\n"
|
||||||
"When FILE is -, reads standard input. Implies -c.\n\n"
|
"When FILE is '-', reads standard input. Implies -c.\n\n"
|
||||||
|
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-c\tWrite output to standard output instead of FILE.gz\n";
|
"\t-c\tWrite output to standard output instead of FILE.gz\n";
|
||||||
|
19
makedevs.c
19
makedevs.c
@ -17,10 +17,18 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
static const char makedevs_usage[] =
|
static const char makedevs_usage[] =
|
||||||
"makedevs 0.01 -- Create an entire range of device files\n\n"
|
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n"
|
||||||
"\tmakedevs /dev/ttyS c 4 64 0 63 (ttyS0-ttyS63)\n"
|
"Creates a range of block or character special files\n\n"
|
||||||
|
"TYPEs include:\n"
|
||||||
"\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n";
|
"\tb:\tMake a block (buffered) device.\n"
|
||||||
|
"\tc or u:\tMake a character (un-buffered) device.\n"
|
||||||
|
"\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n"
|
||||||
|
"FIRST specifies the number appended to NAME to create the first device.\n"
|
||||||
|
"LAST specifies the number of the last item that should be created.\n"
|
||||||
|
"If 's' is the last argument, the base device is created as well.\n\n"
|
||||||
|
"For example:\n"
|
||||||
|
"\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n"
|
||||||
|
"\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n";
|
||||||
|
|
||||||
int makedevs_main(int argc, char **argv)
|
int makedevs_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -38,6 +46,9 @@ int makedevs_main(int argc, char **argv)
|
|||||||
char devname[255];
|
char devname[255];
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
|
if (argc < 7 || *argv[1]=='-')
|
||||||
|
usage(makedevs_usage);
|
||||||
|
|
||||||
switch (type[0]) {
|
switch (type[0]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
mode = S_IFCHR;
|
mode = S_IFCHR;
|
||||||
|
21
math.c
21
math.c
@ -7,7 +7,10 @@
|
|||||||
|
|
||||||
/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
|
/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
|
||||||
|
|
||||||
static const char math_usage[] = "math expression ...";
|
static const char math_usage[] = "math expression ...\n\n"
|
||||||
|
"This is a Tiny RPN calculator that understands the\n"
|
||||||
|
"following operations: +, -, /, *, and, or, not, eor.\n"
|
||||||
|
"i.e. 'math 2 2 add' -> 4, and 'math 8 8 \\* 2 2 + /' -> 16\n";
|
||||||
|
|
||||||
static double stack[100];
|
static double stack[100];
|
||||||
static unsigned int pointer;
|
static unsigned int pointer;
|
||||||
@ -85,14 +88,14 @@ struct op {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct op operators[] = {
|
static const struct op operators[] = {
|
||||||
{"add", add},
|
{"+", add},
|
||||||
|
{"-", sub},
|
||||||
|
{"*", mul},
|
||||||
|
{"/", divide},
|
||||||
{"and", and},
|
{"and", and},
|
||||||
{"div", divide},
|
|
||||||
{"eor", eor},
|
|
||||||
{"mul", mul},
|
|
||||||
{"not", not},
|
|
||||||
{"or", or},
|
{"or", or},
|
||||||
{"sub", sub},
|
{"not", not},
|
||||||
|
{"eor", eor},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -127,11 +130,13 @@ static void stack_machine(const char *argument)
|
|||||||
|
|
||||||
int math_main(int argc, char **argv)
|
int math_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
if (argc < 1 || *argv[1]=='-')
|
||||||
|
usage(math_usage);
|
||||||
while (argc >= 2) {
|
while (argc >= 2) {
|
||||||
stack_machine(argv[1]);
|
stack_machine(argv[1]);
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
stack_machine(0);
|
stack_machine(0);
|
||||||
return 0;
|
exit( TRUE);
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,18 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
static const char makedevs_usage[] =
|
static const char makedevs_usage[] =
|
||||||
"makedevs 0.01 -- Create an entire range of device files\n\n"
|
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n"
|
||||||
"\tmakedevs /dev/ttyS c 4 64 0 63 (ttyS0-ttyS63)\n"
|
"Creates a range of block or character special files\n\n"
|
||||||
|
"TYPEs include:\n"
|
||||||
"\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n";
|
"\tb:\tMake a block (buffered) device.\n"
|
||||||
|
"\tc or u:\tMake a character (un-buffered) device.\n"
|
||||||
|
"\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n"
|
||||||
|
"FIRST specifies the number appended to NAME to create the first device.\n"
|
||||||
|
"LAST specifies the number of the last item that should be created.\n"
|
||||||
|
"If 's' is the last argument, the base device is created as well.\n\n"
|
||||||
|
"For example:\n"
|
||||||
|
"\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n"
|
||||||
|
"\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n";
|
||||||
|
|
||||||
int makedevs_main(int argc, char **argv)
|
int makedevs_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -38,6 +46,9 @@ int makedevs_main(int argc, char **argv)
|
|||||||
char devname[255];
|
char devname[255];
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
|
if (argc < 7 || *argv[1]=='-')
|
||||||
|
usage(makedevs_usage);
|
||||||
|
|
||||||
switch (type[0]) {
|
switch (type[0]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
mode = S_IFCHR;
|
mode = S_IFCHR;
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <sys/mtio.h>
|
#include <sys/mtio.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
|
|
||||||
static const char mt_usage[] = "mt [-f device] opcode value\n";
|
static const char mt_usage[] = "mt [-f device] opcode value\n\n"
|
||||||
|
"Control magnetic tape drive operation\n";
|
||||||
|
|
||||||
struct mt_opcodes {
|
struct mt_opcodes {
|
||||||
char *name;
|
char *name;
|
||||||
@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv)
|
|||||||
const struct mt_opcodes *code = opcodes;
|
const struct mt_opcodes *code = opcodes;
|
||||||
struct mtop op;
|
struct mtop op;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
if ((argc != 2 && argc != 3) || **(argv + 1) == '-') {
|
||||||
|
usage(mt_usage);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "-f") == 0) {
|
if (strcmp(argv[1], "-f") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (code->name == 0) {
|
if (code->name == 0) {
|
||||||
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
|
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
op.mt_op = code->value;
|
op.mt_op = code->value;
|
||||||
@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((fd = open(file, O_RDONLY, 0)) < 0) {
|
if ((fd = open(file, O_RDONLY, 0)) < 0) {
|
||||||
perror(file);
|
perror(file);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, MTIOCTOP, &op) != 0) {
|
if (ioctl(fd, MTIOCTOP, &op) != 0) {
|
||||||
perror(file);
|
perror(file);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TRUE);
|
exit (TRUE);
|
||||||
}
|
}
|
||||||
|
4
mkfifo.c
4
mkfifo.c
@ -27,10 +27,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
|
static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
|
||||||
"Create the named fifo\n\n"
|
"Creates a named pipe (identical to 'mknod name p')\n\n"
|
||||||
|
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n";
|
"\t-m\tcreate the pipe using the specified mode (default a=rw)\n";
|
||||||
|
|
||||||
extern int mkfifo_main(int argc, char **argv)
|
extern int mkfifo_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
53
mknod.c
53
mknod.c
@ -28,23 +28,47 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n"
|
static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n\n"
|
||||||
"Make block or character special files.\n\n"
|
"Create a special file (block, character, or pipe).\n\n"
|
||||||
|
"Options:\n"
|
||||||
|
"\t-m\tcreate the special file using the specified mode (default a=rw)\n\n"
|
||||||
"TYPEs include:\n"
|
"TYPEs include:\n"
|
||||||
"\tb:\tMake a block (buffered) device.\n"
|
"\tb:\tMake a block (buffered) device.\n"
|
||||||
|
|
||||||
"\tc or u:\tMake a character (un-buffered) device.\n"
|
"\tc or u:\tMake a character (un-buffered) device.\n"
|
||||||
"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
|
"\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n";
|
||||||
|
|
||||||
int mknod_main(int argc, char **argv)
|
int mknod_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
char *thisarg;
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
mode_t perm = 0666;
|
||||||
dev_t dev = 0;
|
dev_t dev = 0;
|
||||||
|
|
||||||
if (argc != 5 || **(argv + 1) == '-') {
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
|
/* Parse any options */
|
||||||
|
while (argc > 1) {
|
||||||
|
if (**argv != '-')
|
||||||
|
break;
|
||||||
|
thisarg = *argv;
|
||||||
|
thisarg++;
|
||||||
|
switch (*thisarg) {
|
||||||
|
case 'm':
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
parse_mode(*argv, &perm);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(mknod_usage);
|
||||||
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
if (argc != 4 && argc != 2) {
|
||||||
usage(mknod_usage);
|
usage(mknod_usage);
|
||||||
}
|
}
|
||||||
switch (argv[2][0]) {
|
switch (argv[1][0]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'u':
|
case 'u':
|
||||||
mode = S_IFCHR;
|
mode = S_IFCHR;
|
||||||
@ -54,23 +78,22 @@ int mknod_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
mode = S_IFIFO;
|
mode = S_IFIFO;
|
||||||
|
if (argc!=2) {
|
||||||
|
usage(mknod_usage);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(mknod_usage);
|
usage(mknod_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == S_IFCHR || mode == S_IFBLK) {
|
if (mode == S_IFCHR || mode == S_IFBLK) {
|
||||||
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
|
dev = (atoi(argv[2]) << 8) | atoi(argv[1]);
|
||||||
if (argc != 5) {
|
|
||||||
usage(mknod_usage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mode |= 0666;
|
mode |= perm;
|
||||||
|
|
||||||
if (mknod(argv[1], mode, dev) != 0) {
|
if (mknod(argv[0], mode, dev) != 0)
|
||||||
perror(argv[1]);
|
fatalError("%s: %s\n", argv[0], strerror(errno));
|
||||||
exit (FALSE);
|
|
||||||
}
|
|
||||||
exit (TRUE);
|
exit (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
mnc.c
6
mnc.c
@ -56,11 +56,11 @@ int mnc_main(int argc, char **argv)
|
|||||||
|
|
||||||
fd_set readfds, testfds;
|
fd_set readfds, testfds;
|
||||||
|
|
||||||
if (argc <= 1 || **(argv + 1) == '-') {
|
|
||||||
usage(mnc_usage);
|
|
||||||
}
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
if (argc < 2 || **(argv + 1) == '-') {
|
||||||
|
usage(mnc_usage);
|
||||||
|
}
|
||||||
|
|
||||||
sfd = socket(AF_INET, SOCK_STREAM, 0);
|
sfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|
||||||
|
15
mt.c
15
mt.c
@ -4,7 +4,8 @@
|
|||||||
#include <sys/mtio.h>
|
#include <sys/mtio.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
|
|
||||||
static const char mt_usage[] = "mt [-f device] opcode value\n";
|
static const char mt_usage[] = "mt [-f device] opcode value\n\n"
|
||||||
|
"Control magnetic tape drive operation\n";
|
||||||
|
|
||||||
struct mt_opcodes {
|
struct mt_opcodes {
|
||||||
char *name;
|
char *name;
|
||||||
@ -56,6 +57,10 @@ extern int mt_main(int argc, char **argv)
|
|||||||
const struct mt_opcodes *code = opcodes;
|
const struct mt_opcodes *code = opcodes;
|
||||||
struct mtop op;
|
struct mtop op;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
if ((argc != 2 && argc != 3) || **(argv + 1) == '-') {
|
||||||
|
usage(mt_usage);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "-f") == 0) {
|
if (strcmp(argv[1], "-f") == 0) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
@ -74,7 +79,7 @@ extern int mt_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (code->name == 0) {
|
if (code->name == 0) {
|
||||||
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
|
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
op.mt_op = code->value;
|
op.mt_op = code->value;
|
||||||
@ -85,13 +90,13 @@ extern int mt_main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((fd = open(file, O_RDONLY, 0)) < 0) {
|
if ((fd = open(file, O_RDONLY, 0)) < 0) {
|
||||||
perror(file);
|
perror(file);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, MTIOCTOP, &op) != 0) {
|
if (ioctl(fd, MTIOCTOP, &op) != 0) {
|
||||||
perror(file);
|
perror(file);
|
||||||
return (FALSE);
|
exit (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TRUE);
|
exit (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
| + find out how the real nslookup gets the default name server
|
| + find out how the real nslookup gets the default name server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char nslookup_usage[] = "nslookup [HOST]\n\n";
|
static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n";
|
||||||
|
|
||||||
|
|
||||||
/* I have to see how the real nslookup does this.
|
/* I have to see how the real nslookup does this.
|
||||||
@ -50,8 +50,8 @@ static const char nslookup_usage[] = "nslookup [HOST]\n\n";
|
|||||||
*/
|
*/
|
||||||
static void server_fprint(FILE * dst)
|
static void server_fprint(FILE * dst)
|
||||||
{
|
{
|
||||||
fprintf(dst, "Server: %s\n", "something");
|
fprintf(dst, "Server: %s\n", "default");
|
||||||
fprintf(dst, "Address: %s\n\n", "something");
|
fprintf(dst, "Address: %s\n\n", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only works for IPv4 */
|
/* only works for IPv4 */
|
||||||
@ -96,9 +96,9 @@ static int addr_list_fprint(char **h_addr_list, FILE * dst)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char *addr_string = (h_addr_list[1])
|
char *addr_string = (h_addr_list[1])
|
||||||
? "Addresses" : "Address";
|
? "Addresses: " : "Address: ";
|
||||||
|
|
||||||
fprintf(dst, "%s: ", addr_string);
|
fprintf(dst, "%s ", addr_string);
|
||||||
for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
|
for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
|
||||||
addr_fprint(h_addr_list[i], dst);
|
addr_fprint(h_addr_list[i], dst);
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ static struct hostent *gethostbyaddr_wrapper(const char *address)
|
|||||||
static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
|
static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
|
||||||
{
|
{
|
||||||
if (host) {
|
if (host) {
|
||||||
fprintf(dst, "Name: %s\n", host->h_name);
|
fprintf(dst, "Name: %s\n", host->h_name);
|
||||||
addr_list_fprint(host->h_addr_list, dst);
|
addr_list_fprint(host->h_addr_list, dst);
|
||||||
} else {
|
} else {
|
||||||
fprintf(dst, "*** %s\n", hstrerror(h_errno));
|
fprintf(dst, "*** %s\n", hstrerror(h_errno));
|
||||||
@ -159,7 +159,7 @@ int nslookup_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct hostent *host;
|
struct hostent *host;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2 || *argv[1]=='-') {
|
||||||
usage(nslookup_usage);
|
usage(nslookup_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ int nslookup_main(int argc, char **argv)
|
|||||||
host = gethostbyname(argv[1]);
|
host = gethostbyname(argv[1]);
|
||||||
}
|
}
|
||||||
hostent_fprint(host, stdout);
|
hostent_fprint(host, stdout);
|
||||||
return 0;
|
exit( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */
|
/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */
|
||||||
|
18
nslookup.c
18
nslookup.c
@ -41,7 +41,7 @@
|
|||||||
| + find out how the real nslookup gets the default name server
|
| + find out how the real nslookup gets the default name server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char nslookup_usage[] = "nslookup [HOST]\n\n";
|
static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n";
|
||||||
|
|
||||||
|
|
||||||
/* I have to see how the real nslookup does this.
|
/* I have to see how the real nslookup does this.
|
||||||
@ -50,8 +50,8 @@ static const char nslookup_usage[] = "nslookup [HOST]\n\n";
|
|||||||
*/
|
*/
|
||||||
static void server_fprint(FILE * dst)
|
static void server_fprint(FILE * dst)
|
||||||
{
|
{
|
||||||
fprintf(dst, "Server: %s\n", "something");
|
fprintf(dst, "Server: %s\n", "default");
|
||||||
fprintf(dst, "Address: %s\n\n", "something");
|
fprintf(dst, "Address: %s\n\n", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only works for IPv4 */
|
/* only works for IPv4 */
|
||||||
@ -96,9 +96,9 @@ static int addr_list_fprint(char **h_addr_list, FILE * dst)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char *addr_string = (h_addr_list[1])
|
char *addr_string = (h_addr_list[1])
|
||||||
? "Addresses" : "Address";
|
? "Addresses: " : "Address: ";
|
||||||
|
|
||||||
fprintf(dst, "%s: ", addr_string);
|
fprintf(dst, "%s ", addr_string);
|
||||||
for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
|
for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
|
||||||
addr_fprint(h_addr_list[i], dst);
|
addr_fprint(h_addr_list[i], dst);
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ static struct hostent *gethostbyaddr_wrapper(const char *address)
|
|||||||
static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
|
static struct hostent *hostent_fprint(struct hostent *host, FILE * dst)
|
||||||
{
|
{
|
||||||
if (host) {
|
if (host) {
|
||||||
fprintf(dst, "Name: %s\n", host->h_name);
|
fprintf(dst, "Name: %s\n", host->h_name);
|
||||||
addr_list_fprint(host->h_addr_list, dst);
|
addr_list_fprint(host->h_addr_list, dst);
|
||||||
} else {
|
} else {
|
||||||
fprintf(dst, "*** %s\n", hstrerror(h_errno));
|
fprintf(dst, "*** %s\n", hstrerror(h_errno));
|
||||||
@ -159,7 +159,7 @@ int nslookup_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct hostent *host;
|
struct hostent *host;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2 || *argv[1]=='-') {
|
||||||
usage(nslookup_usage);
|
usage(nslookup_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ int nslookup_main(int argc, char **argv)
|
|||||||
host = gethostbyname(argv[1]);
|
host = gethostbyname(argv[1]);
|
||||||
}
|
}
|
||||||
hostent_fprint(host, stdout);
|
hostent_fprint(host, stdout);
|
||||||
return 0;
|
exit( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: nslookup.c,v 1.6 2000/04/13 01:18:56 erik Exp $ */
|
/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */
|
||||||
|
2
printf.c
2
printf.c
@ -139,7 +139,7 @@ static void verify __P((char *s, char *end));
|
|||||||
/* The value to return to the calling program. */
|
/* The value to return to the calling program. */
|
||||||
static int exit_status;
|
static int exit_status;
|
||||||
|
|
||||||
static const char printf_usage[] = "printf format [argument...]\n";
|
static const char printf_usage[] = "printf format [argument...]\n\nFormats and prints the given data.\n";
|
||||||
|
|
||||||
int printf_main(int argc, char **argv)
|
int printf_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
4
sort.c
4
sort.c
@ -33,7 +33,7 @@ static const char sort_usage[] = "sort [-n]"
|
|||||||
#ifdef BB_FEATURE_SORT_REVERSE
|
#ifdef BB_FEATURE_SORT_REVERSE
|
||||||
" [-r]"
|
" [-r]"
|
||||||
#endif
|
#endif
|
||||||
" [FILE]...\n\n";
|
" [FILE]...\n\nSorts lines of text in the specified files\n";
|
||||||
|
|
||||||
#ifdef BB_FEATURE_SORT_REVERSE
|
#ifdef BB_FEATURE_SORT_REVERSE
|
||||||
#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
|
#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
|
||||||
@ -320,4 +320,4 @@ int sort_main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: sort.c,v 1.13 2000/04/13 01:18:56 erik Exp $ */
|
/* $Id: sort.c,v 1.14 2000/04/15 16:34:54 erik Exp $ */
|
||||||
|
8
test.c
8
test.c
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* echo implementation for busybox
|
* test implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (c) by a whole pile of folks:
|
* Copyright (c) by a whole pile of folks:
|
||||||
*
|
*
|
||||||
@ -185,6 +185,12 @@ test_main(int argc, char** argv)
|
|||||||
fatalError("missing ]");
|
fatalError("missing ]");
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
|
if (strcmp(argv[1], "--help") == 0) {
|
||||||
|
usage("test EXPRESSION\n"
|
||||||
|
"or [ EXPRESSION ]\n\n"
|
||||||
|
"Checks file types and compares values returning an exit\n"
|
||||||
|
"code determined by the value of EXPRESSION.\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
|
14
tr.c
14
tr.c
@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
|
|||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
|
|
||||||
"$Id: tr.c,v 1.2 2000/03/21 22:32:57 erik Exp $";
|
"$Id: tr.c,v 1.3 2000/04/15 16:34:54 erik Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif /* #if 0 */
|
#endif /* #if 0 */
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ int cflag;
|
|||||||
|
|
||||||
static void tr_usage()
|
static void tr_usage()
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr, "%s\n%s\n%s\n%s\n",
|
usage( "\ttr [-csu] string1 string2\n"
|
||||||
"usage: tr [-csu] string1 string2",
|
"\ttr [-cu] -d string1\n"
|
||||||
" tr [-cu] -d string1",
|
"\ttr [-cu] -s string1\n"
|
||||||
" tr [-cu] -s string1",
|
"\ttr [-cu] -ds string1 string2\n\n"
|
||||||
" tr [-cu] -ds string1 string2");
|
"Translate, squeeze, and/or delete characters from standard\n"
|
||||||
exit(1);
|
"input, writing to standard output.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user