This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make usage messages occupy less space and simplify how usage messages are displayed.
This commit is contained in:
parent
68be2ab914
commit
67991cf824
286
applets.h
286
applets.h
@ -10,403 +10,417 @@
|
||||
* file result in the listing remaining in ascii order. You have been warned.
|
||||
*/
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_ODDNAME
|
||||
#undef APPLET_NOUSAGE
|
||||
|
||||
#if defined(PROTOTYPES)
|
||||
#define APPLET(a,b,c,d) \
|
||||
extern int b(int argc, char **argv); \
|
||||
extern const char d[];
|
||||
#define APPLET(a,b,c) \
|
||||
extern int b(int argc, char **argv);
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) APPLET(a,b,c)
|
||||
#define APPLET_NOUSAGE(a,b,c) \
|
||||
extern int b(int argc, char **argv);
|
||||
#elif defined(MAKE_LINKS)
|
||||
#define APPLET(a,b,c,d) LINK c a
|
||||
#define APPLET_NOUSAGE(a,b,c) LINK c a
|
||||
#define APPLET(a,b,c) LINK c #a
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) LINK c a
|
||||
#define APPLET_NOUSAGE(a,b,c) LINK c #a
|
||||
#elif defined(APPLET_ENUM)
|
||||
#define APPLET(a,b,c) a##_applet_number,
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) e##_applet_number,
|
||||
#define APPLET_NOUSAGE(a,b,c) a##applet_number,
|
||||
#else
|
||||
#define USAGE_ENUM
|
||||
#include "usage.h"
|
||||
const struct BB_applet applets[] = {
|
||||
#define APPLET(a,b,c,d) {a,b,c,d},
|
||||
#define APPLET_NOUSAGE(a,b,c) {a,b,c,NULL},
|
||||
#define APPLET(a,b,c) {#a,b,c,a##_usage_index},
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) {a,b,c,d},
|
||||
#define APPLET_NOUSAGE(a,b,c) {#a,b,c,-1},
|
||||
#define zcat_usage_index gunzip_usage_index
|
||||
#define sh_usage_index shell_usage_index
|
||||
#endif
|
||||
|
||||
#ifdef BB_TEST
|
||||
APPLET("[", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
APPLET_ODDNAME("[", test_main, _BB_DIR_USR_BIN, test_usage_index, open_bracket)
|
||||
#endif
|
||||
#ifdef BB_AR
|
||||
APPLET("ar", ar_main, _BB_DIR_USR_BIN, ar_usage)
|
||||
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET("basename", basename_main, _BB_DIR_USR_BIN, basename_usage)
|
||||
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
|
||||
APPLET_NOUSAGE(busybox, busybox_main, _BB_DIR_BIN)
|
||||
#ifdef BB_CAT
|
||||
APPLET("cat", cat_main, _BB_DIR_BIN, cat_usage)
|
||||
APPLET(cat, cat_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage)
|
||||
APPLET(chgrp, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage)
|
||||
APPLET(chmod, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage)
|
||||
APPLET(chown, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHROOT
|
||||
APPLET("chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage)
|
||||
APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_CHVT
|
||||
APPLET("chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage)
|
||||
APPLET(chvt, chvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CLEAR
|
||||
APPLET("clear", clear_main, _BB_DIR_USR_BIN, clear_usage)
|
||||
APPLET(clear, clear_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CMP
|
||||
APPLET("cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage)
|
||||
APPLET(cmp, cmp_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("cp", cp_mv_main, _BB_DIR_BIN, cp_usage)
|
||||
APPLET(cp, cp_mv_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CUT
|
||||
APPLET("cut", cut_main, _BB_DIR_USR_BIN, cut_usage)
|
||||
APPLET(cut, cut_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DATE
|
||||
APPLET("date", date_main, _BB_DIR_BIN, date_usage)
|
||||
APPLET(date, date_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DC
|
||||
APPLET("dc", dc_main, _BB_DIR_USR_BIN, dc_usage)
|
||||
APPLET(dc, dc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DD
|
||||
APPLET("dd", dd_main, _BB_DIR_BIN, dd_usage)
|
||||
APPLET(dd, dd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT
|
||||
APPLET("deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage)
|
||||
APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DF
|
||||
APPLET("df", df_main, _BB_DIR_BIN, df_usage)
|
||||
APPLET(df, df_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DIRNAME
|
||||
APPLET("dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage)
|
||||
APPLET(dirname, dirname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DMESG
|
||||
APPLET("dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage)
|
||||
APPLET(dmesg, dmesg_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DOS2UNIX
|
||||
APPLET("dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage)
|
||||
APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG
|
||||
APPLET("dpkg", dpkg_main, _BB_DIR_USR_BIN, dpkg_usage)
|
||||
APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG_DEB
|
||||
APPLET("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage)
|
||||
APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage_index, dpkg_deb)
|
||||
#endif
|
||||
#ifdef BB_DU
|
||||
APPLET("du", du_main, _BB_DIR_USR_BIN, du_usage)
|
||||
APPLET(du, du_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUMPKMAP
|
||||
APPLET("dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage)
|
||||
APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUTMP
|
||||
APPLET("dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage)
|
||||
APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ECHO
|
||||
APPLET("echo", echo_main, _BB_DIR_BIN, echo_usage)
|
||||
APPLET(echo, echo_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_EXPR
|
||||
APPLET("expr", expr_main, _BB_DIR_USR_BIN, expr_usage)
|
||||
APPLET(expr, expr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("false", false_main, _BB_DIR_BIN, false_usage)
|
||||
APPLET(false, false_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FBSET
|
||||
APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
|
||||
APPLET_NOUSAGE(fbset, fbset_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH
|
||||
APPLET("fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage)
|
||||
APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FIND
|
||||
APPLET("find", find_main, _BB_DIR_USR_BIN, find_usage)
|
||||
APPLET(find, find_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREE
|
||||
APPLET("free", free_main, _BB_DIR_USR_BIN, free_usage)
|
||||
APPLET(free, free_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK
|
||||
APPLET("freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage)
|
||||
APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX
|
||||
APPLET("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage)
|
||||
APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage_index, fsck_minix)
|
||||
#endif
|
||||
#ifdef BB_GETOPT
|
||||
APPLET("getopt", getopt_main, _BB_DIR_BIN, getopt_usage)
|
||||
APPLET(getopt, getopt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GREP
|
||||
APPLET("grep", grep_main, _BB_DIR_BIN, grep_usage)
|
||||
APPLET(grep, grep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
APPLET(gunzip, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GZIP
|
||||
APPLET("gzip", gzip_main, _BB_DIR_BIN, gzip_usage)
|
||||
APPLET(gzip, gzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HALT
|
||||
APPLET("halt", halt_main, _BB_DIR_SBIN, halt_usage)
|
||||
APPLET(halt, halt_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_HEAD
|
||||
APPLET("head", head_main, _BB_DIR_USR_BIN, head_usage)
|
||||
APPLET(head, head_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTID
|
||||
APPLET("hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage)
|
||||
APPLET(hostid, hostid_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET("hostname", hostname_main, _BB_DIR_BIN, hostname_usage)
|
||||
APPLET(hostname, hostname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET("id", id_main, _BB_DIR_USR_BIN, id_usage)
|
||||
APPLET(id, id_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_IFCONFIG
|
||||
APPLET("ifconfig", ifconfig_main, _BB_DIR_SBIN, ifconfig_usage)
|
||||
APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INIT
|
||||
APPLET_NOUSAGE("init", init_main, _BB_DIR_SBIN)
|
||||
APPLET(init, init_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INSMOD
|
||||
APPLET("insmod", insmod_main, _BB_DIR_SBIN, insmod_usage)
|
||||
APPLET(insmod, insmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_KILL
|
||||
APPLET("kill", kill_main, _BB_DIR_BIN, kill_usage)
|
||||
APPLET(kill, kill_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_KILLALL
|
||||
APPLET("killall", kill_main, _BB_DIR_USR_BIN, killall_usage)
|
||||
APPLET(killall, kill_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET("length", length_main, _BB_DIR_USR_BIN, length_usage)
|
||||
APPLET(length, length_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LINUXRC
|
||||
APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
|
||||
APPLET_NOUSAGE(linuxrc, init_main, _BB_DIR_ROOT)
|
||||
#endif
|
||||
#ifdef BB_LN
|
||||
APPLET("ln", ln_main, _BB_DIR_BIN, ln_usage)
|
||||
APPLET(ln, ln_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADACM
|
||||
APPLET("loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage)
|
||||
APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADFONT
|
||||
APPLET("loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage)
|
||||
APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP
|
||||
APPLET("loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage)
|
||||
APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LOGGER
|
||||
APPLET("logger", logger_main, _BB_DIR_USR_BIN, logger_usage)
|
||||
APPLET(logger, logger_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOGNAME
|
||||
APPLET("logname", logname_main, _BB_DIR_USR_BIN, logname_usage)
|
||||
APPLET(logname, logname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LS
|
||||
APPLET("ls", ls_main, _BB_DIR_BIN, ls_usage)
|
||||
APPLET(ls, ls_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LSMOD
|
||||
APPLET("lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage)
|
||||
APPLET(lsmod, lsmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS
|
||||
APPLET("makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage)
|
||||
APPLET(makedevs, makedevs_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MD5SUM
|
||||
APPLET("md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage)
|
||||
APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKDIR
|
||||
APPLET("mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage)
|
||||
APPLET(mkdir, mkdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFIFO
|
||||
APPLET("mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage)
|
||||
APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX
|
||||
APPLET("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage)
|
||||
APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage_index, mkfs_minix)
|
||||
#endif
|
||||
#ifdef BB_MKNOD
|
||||
APPLET("mknod", mknod_main, _BB_DIR_BIN, mknod_usage)
|
||||
APPLET(mknod, mknod_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKSWAP
|
||||
APPLET("mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage)
|
||||
APPLET(mkswap, mkswap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET("mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage)
|
||||
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET("more", more_main, _BB_DIR_BIN, more_usage)
|
||||
APPLET(more, more_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET("mount", mount_main, _BB_DIR_BIN, mount_usage)
|
||||
APPLET(mount, mount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET("mt", mt_main, _BB_DIR_BIN, mt_usage)
|
||||
APPLET(mt, mt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("mv", cp_mv_main, _BB_DIR_BIN, mv_usage)
|
||||
APPLET(mv, cp_mv_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NC
|
||||
APPLET("nc", nc_main, _BB_DIR_USR_BIN, nc_usage)
|
||||
APPLET(nc, nc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET("nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage)
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET("ping", ping_main, _BB_DIR_BIN, ping_usage)
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIVOT_ROOT
|
||||
APPLET("pivot_root", pivot_root_main, _BB_DIR_SBIN, pivot_root_usage)
|
||||
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_POWEROFF
|
||||
APPLET("poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage)
|
||||
APPLET(poweroff, poweroff_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_PRINTF
|
||||
APPLET("printf", printf_main, _BB_DIR_USR_BIN, printf_usage)
|
||||
APPLET(printf, printf_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PS
|
||||
APPLET("ps", ps_main, _BB_DIR_BIN, ps_usage)
|
||||
APPLET(ps, ps_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PWD
|
||||
APPLET("pwd", pwd_main, _BB_DIR_BIN, pwd_usage)
|
||||
APPLET(pwd, pwd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RDATE
|
||||
APPLET("rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage)
|
||||
APPLET(rdate, rdate_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_READLINK
|
||||
APPLET("readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage)
|
||||
APPLET(readlink, readlink_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_REBOOT
|
||||
APPLET("reboot", reboot_main, _BB_DIR_SBIN, reboot_usage)
|
||||
APPLET(reboot, reboot_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_RENICE
|
||||
APPLET("renice", renice_main, _BB_DIR_USR_BIN, renice_usage)
|
||||
APPLET(renice, renice_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RESET
|
||||
APPLET("reset", reset_main, _BB_DIR_USR_BIN, reset_usage)
|
||||
APPLET(reset, reset_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RM
|
||||
APPLET("rm", rm_main, _BB_DIR_BIN, rm_usage)
|
||||
APPLET(rm, rm_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMDIR
|
||||
APPLET("rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage)
|
||||
APPLET(rmdir, rmdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMMOD
|
||||
APPLET("rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage)
|
||||
APPLET(rmmod, rmmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ROUTE
|
||||
APPLET("route", route_main, _BB_DIR_USR_BIN, route_usage)
|
||||
APPLET(route, route_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RPMUNPACK
|
||||
APPLET("rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage)
|
||||
APPLET(rpmunpack, rpmunpack_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SED
|
||||
APPLET("sed", sed_main, _BB_DIR_BIN, sed_usage)
|
||||
APPLET(sed, sed_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET("setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage)
|
||||
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET("sh", shell_main, _BB_DIR_BIN, shell_usage)
|
||||
APPLET(sh, shell_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET("sleep", sleep_main, _BB_DIR_BIN, sleep_usage)
|
||||
APPLET(sleep, sleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SORT
|
||||
APPLET("sort", sort_main, _BB_DIR_USR_BIN, sort_usage)
|
||||
APPLET(sort, sort_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_STTY
|
||||
APPLET("stty", stty_main, _BB_DIR_BIN, stty_usage)
|
||||
APPLET(stty, stty_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage)
|
||||
APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage)
|
||||
APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SYNC
|
||||
APPLET("sync", sync_main, _BB_DIR_BIN, sync_usage)
|
||||
APPLET(sync, sync_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD
|
||||
APPLET("syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage)
|
||||
APPLET(syslogd, syslogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_TAIL
|
||||
APPLET("tail", tail_main, _BB_DIR_USR_BIN, tail_usage)
|
||||
APPLET(tail, tail_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TAR
|
||||
APPLET("tar", tar_main, _BB_DIR_BIN, tar_usage)
|
||||
APPLET(tar, tar_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEE
|
||||
APPLET("tee", tee_main, _BB_DIR_USR_BIN, tee_usage)
|
||||
APPLET(tee, tee_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TELNET
|
||||
APPLET("telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage)
|
||||
APPLET(telnet, telnet_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEST
|
||||
APPLET("test", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
APPLET(test, test_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TOUCH
|
||||
APPLET("touch", touch_main, _BB_DIR_BIN, touch_usage)
|
||||
APPLET(touch, touch_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TR
|
||||
APPLET("tr", tr_main, _BB_DIR_USR_BIN, tr_usage)
|
||||
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("true", true_main, _BB_DIR_BIN, true_usage)
|
||||
APPLET(true, true_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TTY
|
||||
APPLET("tty", tty_main, _BB_DIR_USR_BIN, tty_usage)
|
||||
APPLET(tty, tty_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UMOUNT
|
||||
APPLET("umount", umount_main, _BB_DIR_BIN, umount_usage)
|
||||
APPLET(umount, umount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNAME
|
||||
APPLET("uname", uname_main, _BB_DIR_BIN, uname_usage)
|
||||
APPLET(uname, uname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIQ
|
||||
APPLET("uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage)
|
||||
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET("unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage)
|
||||
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET("update", update_main, _BB_DIR_SBIN, update_usage)
|
||||
APPLET(update, update_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_UPTIME
|
||||
APPLET("uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage)
|
||||
APPLET(uptime, uptime_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_USLEEP
|
||||
APPLET("usleep", usleep_main, _BB_DIR_BIN, usleep_usage)
|
||||
APPLET(usleep, usleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUDECODE
|
||||
APPLET("uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage)
|
||||
APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUENCODE
|
||||
APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
|
||||
APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WATCHDOG
|
||||
APPLET("watchdog", watchdog_main, _BB_DIR_SBIN, watchdog_usage)
|
||||
APPLET(watchdog, watchdog_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_WC
|
||||
APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
|
||||
APPLET(wc, wc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WGET
|
||||
APPLET("wget", wget_main, _BB_DIR_USR_BIN, wget_usage)
|
||||
APPLET(wget, wget_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHICH
|
||||
APPLET("which", which_main, _BB_DIR_USR_BIN, which_usage)
|
||||
APPLET(which, which_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHOAMI
|
||||
APPLET("whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage)
|
||||
APPLET(whoami, whoami_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_XARGS
|
||||
APPLET("xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage)
|
||||
APPLET(xargs, xargs_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_YES
|
||||
APPLET("yes", yes_main, _BB_DIR_USR_BIN, yes_usage)
|
||||
APPLET(yes, yes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
APPLET(zcat, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_LINKS)
|
||||
{ 0,NULL,0,NULL}
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_LINKS) && !defined(APPLET_ENUM)
|
||||
{ 0,NULL,0,-1}
|
||||
};
|
||||
|
||||
/* The -1 arises because of the {0,NULL,0,NULL} entry above. */
|
||||
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
|
||||
size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,6 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct BB_applet *applet;
|
||||
const char *s;
|
||||
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
@ -103,13 +102,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
if ((applet = find_applet_by_name(applet_name)) != NULL) {
|
||||
if (applet->usage && argv[1] && strcmp(argv[1], "--help") == 0)
|
||||
usage(applet->usage);
|
||||
exit((*(applet->main)) (argc, argv));
|
||||
}
|
||||
|
||||
run_applet_by_name(applet_name, argc, argv);
|
||||
error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
1637
applets/usage.c
1637
applets/usage.c
File diff suppressed because it is too large
Load Diff
4
ar.c
4
ar.c
@ -163,13 +163,13 @@ extern int ar_main(int argc, char **argv)
|
||||
funct |= extract_to_file;
|
||||
break;
|
||||
default:
|
||||
usage(ar_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc)
|
||||
usage(ar_usage);
|
||||
show_usage();
|
||||
|
||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
||||
error_msg_and_die("Cannot read %s", argv[optind]);
|
||||
|
@ -163,13 +163,13 @@ extern int ar_main(int argc, char **argv)
|
||||
funct |= extract_to_file;
|
||||
break;
|
||||
default:
|
||||
usage(ar_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc)
|
||||
usage(ar_usage);
|
||||
show_usage();
|
||||
|
||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
||||
error_msg_and_die("Cannot read %s", argv[optind]);
|
||||
|
@ -840,7 +840,7 @@ extern int dpkg_main(int argc, char **argv)
|
||||
case 'c':
|
||||
return dpkg_configure(packages, status);
|
||||
default :
|
||||
usage(dpkg_usage);
|
||||
show_usage();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
@ -141,14 +141,12 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
usage(dpkg_deb_usage);
|
||||
return EXIT_FAILURE;
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (((optind + 1 ) > argc) || (optflag == 0)) {
|
||||
usage(dpkg_deb_usage);
|
||||
return(EXIT_FAILURE);
|
||||
show_usage();
|
||||
}
|
||||
if ((optflag & dpkg_deb_control) || (optflag & dpkg_deb_extract) || (optflag & dpkg_deb_verbose_extract)) {
|
||||
if ( (optind + 1) == argc ) {
|
||||
|
@ -1250,7 +1250,7 @@ int gunzip_main(int argc, char **argv)
|
||||
force = 1;
|
||||
break;
|
||||
default:
|
||||
usage(gunzip_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1275,7 +1275,7 @@ int gunzip_main(int argc, char **argv)
|
||||
} else {
|
||||
/* Open up the input file */
|
||||
if (argc <= 0)
|
||||
usage(gunzip_usage);
|
||||
show_usage();
|
||||
if (strlen(*argv) > MAX_PATH_LEN) {
|
||||
error_msg(name_too_long);
|
||||
exit(WARNING);
|
||||
|
@ -1812,7 +1812,7 @@ int gzip_main(int argc, char **argv)
|
||||
case 'd':
|
||||
exit(gunzip_main(argc, argv));
|
||||
default:
|
||||
usage(gzip_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ int gzip_main(int argc, char **argv)
|
||||
} else {
|
||||
/* Open up the input file */
|
||||
if (argc <= 0)
|
||||
usage(gzip_usage);
|
||||
show_usage();
|
||||
strncpy(ifname, *argv, MAX_PATH_LEN);
|
||||
|
||||
/* Open input file */
|
||||
|
@ -214,7 +214,7 @@ extern int tar_main(int argc, char **argv)
|
||||
int opt;
|
||||
|
||||
if (argc <= 1)
|
||||
usage(tar_usage);
|
||||
show_usage();
|
||||
|
||||
if (argv[1][0] != '-') {
|
||||
char *tmp = xmalloc(strlen(argv[1]) + 2);
|
||||
@ -283,7 +283,7 @@ extern int tar_main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage(tar_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ extern int basename_main(int argc, char **argv)
|
||||
char *s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(basename_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
argv++;
|
||||
|
@ -87,7 +87,6 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct BB_applet *applet;
|
||||
const char *s;
|
||||
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
@ -103,13 +102,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
if ((applet = find_applet_by_name(applet_name)) != NULL) {
|
||||
if (applet->usage && argv[1] && strcmp(argv[1], "--help") == 0)
|
||||
usage(applet->usage);
|
||||
exit((*(applet->main)) (argc, argv));
|
||||
}
|
||||
|
||||
run_applet_by_name(applet_name, argc, argv);
|
||||
error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
11
busybox.h
11
busybox.h
@ -72,7 +72,7 @@ struct BB_applet {
|
||||
const char* name;
|
||||
int (*main)(int argc, char** argv);
|
||||
enum Location location;
|
||||
const char* usage;
|
||||
int usage_index;
|
||||
};
|
||||
/* From busybox.c */
|
||||
extern const struct BB_applet applets[];
|
||||
@ -87,9 +87,15 @@ extern const struct BB_applet applets[];
|
||||
#include "applets.h"
|
||||
#undef PROTOTYPES
|
||||
|
||||
#define APPLET_ENUM
|
||||
enum APPLET_INDEX_NUMBERS {
|
||||
#include "applets.h"
|
||||
};
|
||||
#undef APPLET_ENUM
|
||||
|
||||
extern const char *applet_name;
|
||||
|
||||
extern void usage(const char *usage) __attribute__ ((noreturn));
|
||||
extern void show_usage(void) __attribute__ ((noreturn));
|
||||
extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
||||
extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
@ -153,6 +159,7 @@ extern FILE *wfopen(const char *path, const char *mode);
|
||||
extern FILE *xfopen(const char *path, const char *mode);
|
||||
extern void chomp(char *s);
|
||||
extern struct BB_applet *find_applet_by_name(const char *name);
|
||||
void run_applet_by_name(const char *name, int argc, char **argv);
|
||||
|
||||
#ifndef DMALLOC
|
||||
extern void *xmalloc (size_t size);
|
||||
|
@ -81,17 +81,13 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
||||
int recursiveFlag = FALSE;
|
||||
char *groupName=NULL;
|
||||
char *p=NULL;
|
||||
const char *appUsage;
|
||||
|
||||
whichApp = (applet_name[2]=='o')? /* chown */
|
||||
CHOWN_APP : (applet_name[2]=='m')? /* chmod */
|
||||
CHMOD_APP : CHGRP_APP;
|
||||
|
||||
appUsage = (whichApp == CHOWN_APP)?
|
||||
chown_usage : (whichApp == CHMOD_APP) ? chmod_usage : chgrp_usage;
|
||||
|
||||
if (argc < 2)
|
||||
usage(appUsage);
|
||||
show_usage();
|
||||
argv++;
|
||||
|
||||
/* Parse options */
|
||||
|
2
chroot.c
2
chroot.c
@ -33,7 +33,7 @@ int chroot_main(int argc, char **argv)
|
||||
char *prog;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(chroot_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
2
chvt.c
2
chvt.c
@ -20,7 +20,7 @@ int chvt_main(int argc, char **argv)
|
||||
int fd, num;
|
||||
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
usage (chvt_usage);
|
||||
show_usage();
|
||||
fd = get_console_fd("/dev/console");
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num))
|
||||
|
2
cmp.c
2
cmp.c
@ -36,7 +36,7 @@ int cmp_main(int argc, char **argv)
|
||||
|
||||
/* parse argv[] */
|
||||
if (argc < 2 || 3 < argc)
|
||||
usage(cmp_usage);
|
||||
show_usage();
|
||||
|
||||
fp1 = xfopen(argv[1], "r");
|
||||
if (argv[2] != NULL) {
|
||||
|
@ -20,7 +20,7 @@ int chvt_main(int argc, char **argv)
|
||||
int fd, num;
|
||||
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
usage (chvt_usage);
|
||||
show_usage();
|
||||
fd = get_console_fd("/dev/console");
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num))
|
||||
|
@ -19,7 +19,7 @@ int deallocvt_main(int argc, char *argv[])
|
||||
|
||||
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
|
||||
if (argc > 2)
|
||||
usage(deallocvt_usage);
|
||||
show_usage();
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
|
||||
|
@ -48,7 +48,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
usage(dumpkmap_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
|
@ -34,7 +34,7 @@ int loadacm_main(int argc, char **argv)
|
||||
int fd;
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
usage(loadacm_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
|
@ -44,7 +44,7 @@ extern int loadfont_main(int argc, char **argv)
|
||||
int fd;
|
||||
|
||||
if (argc != 1)
|
||||
usage(loadfont_usage);
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0)
|
||||
|
@ -51,7 +51,7 @@ int loadkmap_main(int argc, char **argv)
|
||||
char flags[MAX_NR_KEYMAPS], buff[7];
|
||||
|
||||
if (argc != 1)
|
||||
usage(loadkmap_usage);
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0)
|
||||
|
@ -43,7 +43,7 @@ setkeycodes_main(int argc, char** argv)
|
||||
struct kbkeycode a;
|
||||
|
||||
if (argc % 2 != 1 || argc < 2) {
|
||||
usage(setkeycodes_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
|
@ -31,7 +31,7 @@ extern int basename_main(int argc, char **argv)
|
||||
char *s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(basename_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
argv++;
|
||||
|
@ -33,7 +33,7 @@ int chroot_main(int argc, char **argv)
|
||||
char *prog;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(chroot_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
@ -36,7 +36,7 @@ int cmp_main(int argc, char **argv)
|
||||
|
||||
/* parse argv[] */
|
||||
if (argc < 2 || 3 < argc)
|
||||
usage(cmp_usage);
|
||||
show_usage();
|
||||
|
||||
fp1 = xfopen(argv[1], "r");
|
||||
if (argv[2] != NULL) {
|
||||
|
@ -151,7 +151,7 @@ int date_main(int argc, char **argv)
|
||||
case 's':
|
||||
set_time = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
@ -162,10 +162,10 @@ int date_main(int argc, char **argv)
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL))
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
break;
|
||||
default:
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ int date_main(int argc, char **argv)
|
||||
#if 0
|
||||
else {
|
||||
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -84,7 +84,7 @@ int dd_main(int argc, char **argv)
|
||||
buf++;
|
||||
}
|
||||
} else
|
||||
usage(dd_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
buf = xmalloc(bs);
|
||||
|
@ -143,7 +143,7 @@ extern int df_main(int argc, char **argv)
|
||||
return status;
|
||||
|
||||
print_df_usage:
|
||||
usage(df_usage);
|
||||
show_usage();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ extern int dirname_main(int argc, char **argv)
|
||||
char* s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-'))
|
||||
usage(dirname_usage);
|
||||
show_usage();
|
||||
argv++;
|
||||
|
||||
s=*argv+strlen(*argv)-1;
|
||||
|
@ -31,7 +31,7 @@ int dos2unix_main( int argc, char **argv ) {
|
||||
if (argc > 1) {
|
||||
c = *argv[1];
|
||||
if (c == '-') {
|
||||
usage(dos2unix_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
c = getchar();
|
||||
|
@ -163,7 +163,7 @@ int du_main(int argc, char **argv)
|
||||
case 'k': break;
|
||||
#endif
|
||||
default:
|
||||
usage(du_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ int du_main(int argc, char **argv)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* $Id: du.c,v 1.36 2001/01/27 09:33:38 andersen Exp $ */
|
||||
/* $Id: du.c,v 1.37 2001/02/14 21:23:05 andersen Exp $ */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
|
@ -57,7 +57,7 @@ int head_main(int argc, char **argv)
|
||||
break;
|
||||
/* fallthrough */
|
||||
default:
|
||||
usage(head_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,11 @@ extern int id_main(int argc, char **argv)
|
||||
name_not_number++;
|
||||
break;
|
||||
default:
|
||||
usage(id_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (no_user && no_group) usage(id_usage);
|
||||
if (no_user && no_group) show_usage();
|
||||
|
||||
if (argv[optind] == NULL) {
|
||||
if (print_real) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
extern int length_main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2 || **(argv + 1) == '-')
|
||||
usage(length_usage);
|
||||
show_usage();
|
||||
printf("%lu\n", (long)strlen(argv[1]));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ extern int ln_main(int argc, char **argv)
|
||||
flag |= LN_NODEREFERENCE;
|
||||
break;
|
||||
default:
|
||||
usage(ln_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
while(optind<(argc-1)) {
|
||||
|
@ -30,7 +30,7 @@ extern int logname_main(int argc, char **argv)
|
||||
char user[9];
|
||||
|
||||
if (argc > 1)
|
||||
usage(logname_usage);
|
||||
show_usage();
|
||||
|
||||
my_getpwuid(user, geteuid());
|
||||
if (*user) {
|
||||
|
@ -928,5 +928,5 @@ extern int ls_main(int argc, char **argv)
|
||||
return(status);
|
||||
|
||||
print_usage_message:
|
||||
usage(ls_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ int md5sum_main(int argc,
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(md5sum_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ extern int mkdir_main(int argc, char **argv)
|
||||
switch (**argv) {
|
||||
case 'm':
|
||||
if (--argc == 0)
|
||||
usage(mkdir_usage);
|
||||
show_usage();
|
||||
/* Find the specified modes */
|
||||
mode = 0;
|
||||
if (parse_mode(*(++argv), &mode) == FALSE) {
|
||||
@ -63,7 +63,7 @@ extern int mkdir_main(int argc, char **argv)
|
||||
parentFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(mkdir_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
argc--;
|
||||
@ -71,7 +71,7 @@ extern int mkdir_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
usage(mkdir_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
while (argc > 0) {
|
||||
|
@ -37,7 +37,7 @@ extern int mkfifo_main(int argc, char **argv)
|
||||
/* Parse any options */
|
||||
while (argc > 1) {
|
||||
if (**argv != '-')
|
||||
usage(mkfifo_usage);
|
||||
show_usage();
|
||||
thisarg = *argv;
|
||||
thisarg++;
|
||||
switch (*thisarg) {
|
||||
@ -47,13 +47,13 @@ extern int mkfifo_main(int argc, char **argv)
|
||||
parse_mode(*argv, &mode);
|
||||
break;
|
||||
default:
|
||||
usage(mkfifo_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if (argc < 1 || *argv[0] == '-')
|
||||
usage(mkfifo_usage);
|
||||
show_usage();
|
||||
if (mkfifo(*argv, mode) < 0)
|
||||
perror_msg_and_die("mkfifo");
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -53,13 +53,13 @@ int mknod_main(int argc, char **argv)
|
||||
umask(0);
|
||||
break;
|
||||
default:
|
||||
usage(mknod_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if (argc != 4 && argc != 2) {
|
||||
usage(mknod_usage);
|
||||
show_usage();
|
||||
}
|
||||
switch (argv[1][0]) {
|
||||
case 'c':
|
||||
@ -72,11 +72,11 @@ int mknod_main(int argc, char **argv)
|
||||
case 'p':
|
||||
mode = S_IFIFO;
|
||||
if (argc!=2) {
|
||||
usage(mknod_usage);
|
||||
show_usage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage(mknod_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (mode == S_IFCHR || mode == S_IFBLK) {
|
||||
|
@ -143,7 +143,7 @@ int printf_main(int argc, char **argv)
|
||||
|
||||
exit_status = 0;
|
||||
if (argc <= 1 || **(argv + 1) == '-') {
|
||||
usage(printf_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
format = argv[1];
|
||||
|
@ -84,7 +84,7 @@ extern int rm_main(int argc, char **argv)
|
||||
stopIt = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(rm_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
@ -94,7 +94,7 @@ extern int rm_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc < 1 && forceFlag == FALSE) {
|
||||
usage(rm_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
while (argc-- > 0) {
|
||||
|
@ -33,7 +33,7 @@ extern int rmdir_main(int argc, char **argv)
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
if (argc == 1 || **(argv + 1) == '-')
|
||||
usage(rmdir_usage);
|
||||
show_usage();
|
||||
|
||||
while (--argc > 0) {
|
||||
if (rmdir(*(++argv)) == -1) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
extern int sleep_main(int argc, char **argv)
|
||||
{
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(sleep_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (sleep(atoi(*(++argv))) != 0)
|
||||
|
@ -56,7 +56,7 @@ int sort_main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage(sort_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,6 @@
|
||||
extern int sync_main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1 && **(argv + 1) == '-')
|
||||
usage(sync_usage);
|
||||
show_usage();
|
||||
return(sync());
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ int tail_main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage(tail_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ tee_main(int argc, char **argv)
|
||||
mode = "a";
|
||||
break;
|
||||
default:
|
||||
usage(tee_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ extern int touch_main(int argc, char **argv)
|
||||
create = FALSE;
|
||||
break;
|
||||
default:
|
||||
usage(touch_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
usage(touch_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
while (argc > 0) {
|
||||
|
@ -170,7 +170,7 @@ extern int tr_main(int argc, char **argv)
|
||||
sq_fl = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(tr_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
index++;
|
||||
|
@ -32,7 +32,7 @@ extern int tty_main(int argc, char **argv)
|
||||
|
||||
if (argc > 1) {
|
||||
if (argv[1][0] != '-' || argv[1][1] != 's')
|
||||
usage(tty_usage);
|
||||
show_usage();
|
||||
} else {
|
||||
tty = ttyname(0);
|
||||
if (tty)
|
||||
|
@ -106,7 +106,7 @@ int uname_main(int argc, char **argv)
|
||||
PRINT_MACHINE);
|
||||
break;
|
||||
default:
|
||||
usage(uname_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
extern int usleep_main(int argc, char **argv)
|
||||
{
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(usleep_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
usleep(atoi(*(++argv))); /* return void */
|
||||
|
@ -292,7 +292,7 @@ int uudecode_main (int argc,
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(uudecode_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ int uuencode_main (int argc,
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(uuencode_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ int uuencode_main (int argc,
|
||||
|
||||
case 0:
|
||||
default:
|
||||
usage(uuencode_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
printf("begin%s %o %s\n", trans_ptr == uu_std ? "" : "-base64",
|
||||
|
@ -126,7 +126,7 @@ int wc_main(int argc, char **argv)
|
||||
print_words = 1;
|
||||
break;
|
||||
default:
|
||||
usage(wc_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ extern int whoami_main(int argc, char **argv)
|
||||
uid_t uid = geteuid();
|
||||
|
||||
if (argc > 1)
|
||||
usage(whoami_usage);
|
||||
show_usage();
|
||||
|
||||
my_getpwuid(user, uid);
|
||||
if (*user) {
|
||||
|
@ -29,7 +29,7 @@ extern int yes_main(int argc, char **argv)
|
||||
int i;
|
||||
|
||||
if (argc >= 2 && *argv[1] == '-')
|
||||
usage(yes_usage);
|
||||
show_usage();
|
||||
|
||||
if (argc == 1) {
|
||||
while (1)
|
||||
|
11
cp_mv.c
11
cp_mv.c
@ -48,11 +48,6 @@ static const int is_cp = 0;
|
||||
static const int is_mv = 1;
|
||||
static int dz_i; /* index into cp_mv_usage */
|
||||
|
||||
static const char *cp_mv_usage[] = /* .rodata */
|
||||
{
|
||||
cp_usage,
|
||||
mv_usage
|
||||
};
|
||||
|
||||
static int recursiveFlag;
|
||||
static int followLinks;
|
||||
@ -184,7 +179,7 @@ extern int cp_mv_main(int argc, char **argv)
|
||||
else
|
||||
dz_i = is_mv;
|
||||
if (argc < 3)
|
||||
usage(cp_mv_usage[dz_i]);
|
||||
show_usage();
|
||||
|
||||
if (dz_i == is_cp) {
|
||||
recursiveFlag = preserveFlag = forceFlag = FALSE;
|
||||
@ -209,11 +204,11 @@ extern int cp_mv_main(int argc, char **argv)
|
||||
forceFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(cp_mv_usage[is_cp]);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
if ((argc - optind) < 2) {
|
||||
usage(cp_mv_usage[dz_i]);
|
||||
show_usage();
|
||||
}
|
||||
} else { /* (dz_i == is_mv) */
|
||||
/* Initialize optind to 1, since in libc5 optind
|
||||
|
8
date.c
8
date.c
@ -151,7 +151,7 @@ int date_main(int argc, char **argv)
|
||||
case 's':
|
||||
set_time = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
@ -162,10 +162,10 @@ int date_main(int argc, char **argv)
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL))
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
break;
|
||||
default:
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ int date_main(int argc, char **argv)
|
||||
#if 0
|
||||
else {
|
||||
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
|
||||
usage(date_usage);
|
||||
show_usage();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
2
dc.c
2
dc.c
@ -169,7 +169,7 @@ int dc_main(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
if (*argv[1]=='-')
|
||||
usage(dc_usage);
|
||||
show_usage();
|
||||
while (argc >= 2) {
|
||||
stack_machine(argv[1]);
|
||||
argv++;
|
||||
|
2
dd.c
2
dd.c
@ -84,7 +84,7 @@ int dd_main(int argc, char **argv)
|
||||
buf++;
|
||||
}
|
||||
} else
|
||||
usage(dd_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
buf = xmalloc(bs);
|
||||
|
@ -19,7 +19,7 @@ int deallocvt_main(int argc, char *argv[])
|
||||
|
||||
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
|
||||
if (argc > 2)
|
||||
usage(deallocvt_usage);
|
||||
show_usage();
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
|
||||
|
2
df.c
2
df.c
@ -143,7 +143,7 @@ extern int df_main(int argc, char **argv)
|
||||
return status;
|
||||
|
||||
print_df_usage:
|
||||
usage(df_usage);
|
||||
show_usage();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ extern int dirname_main(int argc, char **argv)
|
||||
char* s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-'))
|
||||
usage(dirname_usage);
|
||||
show_usage();
|
||||
argv++;
|
||||
|
||||
s=*argv+strlen(*argv)-1;
|
||||
|
11
dmesg.c
11
dmesg.c
@ -53,21 +53,21 @@ int dmesg_main(int argc, char **argv)
|
||||
case 'n':
|
||||
cmd = 8;
|
||||
if (optarg == NULL)
|
||||
usage(dmesg_usage);
|
||||
show_usage();
|
||||
level = atoi(optarg);
|
||||
break;
|
||||
case 's':
|
||||
if (optarg == NULL)
|
||||
usage(dmesg_usage);
|
||||
show_usage();
|
||||
bufsize = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
usage(dmesg_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
goto end;
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (cmd == 8) {
|
||||
@ -97,7 +97,4 @@ int dmesg_main(int argc, char **argv)
|
||||
if (lastc != '\n')
|
||||
putchar('\n');
|
||||
return EXIT_SUCCESS;
|
||||
end:
|
||||
usage(dmesg_usage);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ int dos2unix_main( int argc, char **argv ) {
|
||||
if (argc > 1) {
|
||||
c = *argv[1];
|
||||
if (c == '-') {
|
||||
usage(dos2unix_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
c = getchar();
|
||||
|
2
dpkg.c
2
dpkg.c
@ -840,7 +840,7 @@ extern int dpkg_main(int argc, char **argv)
|
||||
case 'c':
|
||||
return dpkg_configure(packages, status);
|
||||
default :
|
||||
usage(dpkg_usage);
|
||||
show_usage();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
@ -141,14 +141,12 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
usage(dpkg_deb_usage);
|
||||
return EXIT_FAILURE;
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (((optind + 1 ) > argc) || (optflag == 0)) {
|
||||
usage(dpkg_deb_usage);
|
||||
return(EXIT_FAILURE);
|
||||
show_usage();
|
||||
}
|
||||
if ((optflag & dpkg_deb_control) || (optflag & dpkg_deb_extract) || (optflag & dpkg_deb_verbose_extract)) {
|
||||
if ( (optind + 1) == argc ) {
|
||||
|
4
du.c
4
du.c
@ -163,7 +163,7 @@ int du_main(int argc, char **argv)
|
||||
case 'k': break;
|
||||
#endif
|
||||
default:
|
||||
usage(du_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ int du_main(int argc, char **argv)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* $Id: du.c,v 1.36 2001/01/27 09:33:38 andersen Exp $ */
|
||||
/* $Id: du.c,v 1.37 2001/02/14 21:23:05 andersen Exp $ */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
|
@ -48,7 +48,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
usage(dumpkmap_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
|
4
dutmp.c
4
dutmp.c
@ -33,7 +33,7 @@ extern int dutmp_main(int argc, char **argv)
|
||||
if (argc<2) {
|
||||
file = fileno(stdin);
|
||||
} else if (*argv[1] == '-' ) {
|
||||
usage(dutmp_usage);
|
||||
show_usage();
|
||||
} else {
|
||||
file = open(argv[1], O_RDONLY);
|
||||
if (file < 0) {
|
||||
@ -45,7 +45,7 @@ extern int dutmp_main(int argc, char **argv)
|
||||
* fact the stupid libc doesn't have a reliable #define to announce that libc5
|
||||
* is being used. sigh.
|
||||
*/
|
||||
#if ! defined __GLIBC__
|
||||
#if ! defined __GLIBC__ || defined __UCLIBC__
|
||||
while (read(file, (void*)&ut, sizeof(struct utmp))) {
|
||||
printf("%d|%d|%s|%s|%s|%s|%s|%lx\n",
|
||||
ut.ut_type, ut.ut_pid, ut.ut_line,
|
||||
|
@ -673,7 +673,7 @@ extern int sed_main(int argc, char **argv)
|
||||
while ((opt = getopt(argc, argv, "hne:f:")) > 0) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage(sed_usage);
|
||||
show_usage();
|
||||
break;
|
||||
case 'n':
|
||||
be_quiet++;
|
||||
@ -691,7 +691,7 @@ extern int sed_main(int argc, char **argv)
|
||||
* argv[optind] should be the pattern. no pattern, no worky */
|
||||
if (ncmds == 0) {
|
||||
if (argv[optind] == NULL)
|
||||
usage(sed_usage);
|
||||
show_usage();
|
||||
else {
|
||||
add_cmd_str(argv[optind]);
|
||||
optind++;
|
||||
|
@ -35,7 +35,7 @@ extern int fdflush_main(int argc, char **argv)
|
||||
int fd;
|
||||
|
||||
if (argc <= 1 || **(++argv) == '-')
|
||||
usage(fdflush_usage);
|
||||
show_usage();
|
||||
|
||||
if ((fd = open(*argv, 0)) < 0)
|
||||
perror_msg_and_die("%s", *argv);
|
||||
|
2
find.c
2
find.c
@ -178,7 +178,7 @@ int find_main(int argc, char **argv)
|
||||
mtime_days = -mtime_days;
|
||||
#endif
|
||||
} else
|
||||
usage(find_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (firstopt == 1) {
|
||||
|
@ -178,7 +178,7 @@ int find_main(int argc, char **argv)
|
||||
mtime_days = -mtime_days;
|
||||
#endif
|
||||
} else
|
||||
usage(find_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (firstopt == 1) {
|
||||
|
@ -237,7 +237,7 @@ extern int grep_main(int argc, char **argv)
|
||||
|
||||
/* argv[optind] should be the regex pattern; no pattern, no worky */
|
||||
if (argv[optind] == NULL)
|
||||
usage(grep_usage);
|
||||
show_usage();
|
||||
|
||||
/* sanity check */
|
||||
if (print_count_only || be_quiet) {
|
||||
|
@ -33,7 +33,7 @@ extern int which_main(int argc, char **argv)
|
||||
int i, count=1, found, status = EXIT_SUCCESS;
|
||||
|
||||
if (argc <= 1 || **(argv + 1) == '-')
|
||||
usage(which_usage);
|
||||
show_usage();
|
||||
argc--;
|
||||
|
||||
path_list = getenv("PATH");
|
||||
|
2
free.c
2
free.c
@ -46,7 +46,7 @@ extern int free_main(int argc, char **argv)
|
||||
info.bufferram/=info.mem_unit;
|
||||
|
||||
if (argc > 1 && **(argv + 1) == '-')
|
||||
usage(free_usage);
|
||||
show_usage();
|
||||
|
||||
printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free",
|
||||
"shared", "buffers");
|
||||
|
@ -40,7 +40,7 @@ freeramdisk_main(int argc, char **argv)
|
||||
int f;
|
||||
|
||||
if (argc != 2 || *argv[1] == '-') {
|
||||
usage(freeramdisk_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if ((f = open(argv[1], O_RDWR)) == -1) {
|
||||
|
@ -283,11 +283,6 @@ static void leave(int status)
|
||||
exit(status);
|
||||
}
|
||||
|
||||
static void show_usage(void)
|
||||
{
|
||||
usage(fsck_minix_usage);
|
||||
}
|
||||
|
||||
static void die(const char *str)
|
||||
{
|
||||
error_msg("%s", str);
|
||||
|
2
getopt.c
2
getopt.c
@ -372,7 +372,7 @@ int getopt_main(int argc, char *argv[])
|
||||
quote=0;
|
||||
break;
|
||||
default:
|
||||
usage(getopt_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (!optstr) {
|
||||
|
2
grep.c
2
grep.c
@ -237,7 +237,7 @@ extern int grep_main(int argc, char **argv)
|
||||
|
||||
/* argv[optind] should be the regex pattern; no pattern, no worky */
|
||||
if (argv[optind] == NULL)
|
||||
usage(grep_usage);
|
||||
show_usage();
|
||||
|
||||
/* sanity check */
|
||||
if (print_count_only || be_quiet) {
|
||||
|
4
gunzip.c
4
gunzip.c
@ -1250,7 +1250,7 @@ int gunzip_main(int argc, char **argv)
|
||||
force = 1;
|
||||
break;
|
||||
default:
|
||||
usage(gunzip_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1275,7 +1275,7 @@ int gunzip_main(int argc, char **argv)
|
||||
} else {
|
||||
/* Open up the input file */
|
||||
if (argc <= 0)
|
||||
usage(gunzip_usage);
|
||||
show_usage();
|
||||
if (strlen(*argv) > MAX_PATH_LEN) {
|
||||
error_msg(name_too_long);
|
||||
exit(WARNING);
|
||||
|
4
gzip.c
4
gzip.c
@ -1812,7 +1812,7 @@ int gzip_main(int argc, char **argv)
|
||||
case 'd':
|
||||
exit(gunzip_main(argc, argv));
|
||||
default:
|
||||
usage(gzip_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ int gzip_main(int argc, char **argv)
|
||||
} else {
|
||||
/* Open up the input file */
|
||||
if (argc <= 0)
|
||||
usage(gzip_usage);
|
||||
show_usage();
|
||||
strncpy(ifname, *argv, MAX_PATH_LEN);
|
||||
|
||||
/* Open input file */
|
||||
|
2
head.c
2
head.c
@ -57,7 +57,7 @@ int head_main(int argc, char **argv)
|
||||
break;
|
||||
/* fallthrough */
|
||||
default:
|
||||
usage(head_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
10
hostname.c
10
hostname.c
@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: hostname.c,v 1.23 2001/02/01 16:49:29 kraai Exp $
|
||||
* $Id: hostname.c,v 1.24 2001/02/14 21:23:06 andersen Exp $
|
||||
* Mini hostname implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@ -66,7 +66,7 @@ int hostname_main(int argc, char **argv)
|
||||
char *s = NULL;
|
||||
|
||||
if (argc < 1)
|
||||
usage(hostname_usage);
|
||||
show_usage();
|
||||
|
||||
while (--argc > 0 && **(++argv) == '-') {
|
||||
while (*(++(*argv))) {
|
||||
@ -82,18 +82,18 @@ int hostname_main(int argc, char **argv)
|
||||
break;
|
||||
case 'F':
|
||||
if (--argc == 0) {
|
||||
usage(hostname_usage);
|
||||
show_usage();
|
||||
}
|
||||
filename = *(++argv);
|
||||
break;
|
||||
case '-':
|
||||
if (strcmp(++(*argv), "file") || --argc ==0 ) {
|
||||
usage(hostname_usage);
|
||||
show_usage();
|
||||
}
|
||||
filename = *(++argv);
|
||||
break;
|
||||
default:
|
||||
usage(hostname_usage);
|
||||
show_usage();
|
||||
}
|
||||
if (filename != NULL)
|
||||
break;
|
||||
|
4
id.c
4
id.c
@ -53,11 +53,11 @@ extern int id_main(int argc, char **argv)
|
||||
name_not_number++;
|
||||
break;
|
||||
default:
|
||||
usage(id_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (no_user && no_group) usage(id_usage);
|
||||
if (no_user && no_group) show_usage();
|
||||
|
||||
if (argv[optind] == NULL) {
|
||||
if (print_real) {
|
||||
|
20
ifconfig.c
20
ifconfig.c
@ -15,7 +15,7 @@
|
||||
* Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* $Id: ifconfig.c,v 1.1 2001/02/14 08:11:27 andersen Exp $
|
||||
* $Id: ifconfig.c,v 1.2 2001/02/14 21:23:06 andersen Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -183,7 +183,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
char host[128];
|
||||
|
||||
if(argc < 2) {
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
/* Create a channel to the NET kernel. */
|
||||
@ -269,7 +269,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
|
||||
if (!strcmp(*spp, "metric")) {
|
||||
if (*++spp == NULL)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
ifr.ifr_metric = atoi(*spp);
|
||||
if (ioctl(sockfd, SIOCSIFMETRIC, &ifr) < 0) {
|
||||
fprintf(stderr, "SIOCSIFMETRIC: %s\n", strerror(errno));
|
||||
@ -280,7 +280,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
}
|
||||
if (!strcmp(*spp, "mtu")) {
|
||||
if (*++spp == NULL)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
ifr.ifr_mtu = atoi(*spp);
|
||||
if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) {
|
||||
fprintf(stderr, "SIOCSIFMTU: %s\n", strerror(errno));
|
||||
@ -292,7 +292,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
#ifdef SIOCSKEEPALIVE
|
||||
if (!strcmp(*spp, "keepalive")) {
|
||||
if (*++spp == NULL)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
ifr.ifr_data = (caddr_t) atoi(*spp);
|
||||
if (ioctl(sockfd, SIOCSKEEPALIVE, &ifr) < 0) {
|
||||
fprintf(stderr, "SIOCSKEEPALIVE: %s\n", strerror(errno));
|
||||
@ -306,7 +306,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
#ifdef SIOCSOUTFILL
|
||||
if (!strcmp(*spp, "outfill")) {
|
||||
if (*++spp == NULL)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
ifr.ifr_data = (caddr_t) atoi(*spp);
|
||||
if (ioctl(sockfd, SIOCSOUTFILL, &ifr) < 0) {
|
||||
fprintf(stderr, "SIOCSOUTFILL: %s\n", strerror(errno));
|
||||
@ -344,7 +344,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
}
|
||||
if (!strcmp(*spp, "dstaddr")) {
|
||||
if (*++spp == NULL)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
safe_strncpy(host, *spp, (sizeof host));
|
||||
if (INET_resolve(host, &sa) < 0) {
|
||||
goterr++;
|
||||
@ -363,7 +363,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
}
|
||||
if (!strcmp(*spp, "netmask")) {
|
||||
if (*++spp == NULL || didnetmask)
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
safe_strncpy(host, *spp, (sizeof host));
|
||||
if (INET_resolve(host, &sa) < 0) {
|
||||
goterr++;
|
||||
@ -409,7 +409,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
|
||||
if (!strcmp(*spp, "hw")) {
|
||||
if (*++spp == NULL || strcmp("ether", *spp)) {
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (*++spp == NULL) {
|
||||
@ -438,7 +438,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
safe_strncpy(host, *spp, (sizeof host));
|
||||
|
||||
if (INET_resolve(host, &sa) < 0) {
|
||||
usage(ifconfig_usage);
|
||||
show_usage();
|
||||
}
|
||||
memcpy((char *) &ifr.ifr_addr,
|
||||
(char *) &sa, sizeof(struct sockaddr));
|
||||
|
@ -10,403 +10,417 @@
|
||||
* file result in the listing remaining in ascii order. You have been warned.
|
||||
*/
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_ODDNAME
|
||||
#undef APPLET_NOUSAGE
|
||||
|
||||
#if defined(PROTOTYPES)
|
||||
#define APPLET(a,b,c,d) \
|
||||
extern int b(int argc, char **argv); \
|
||||
extern const char d[];
|
||||
#define APPLET(a,b,c) \
|
||||
extern int b(int argc, char **argv);
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) APPLET(a,b,c)
|
||||
#define APPLET_NOUSAGE(a,b,c) \
|
||||
extern int b(int argc, char **argv);
|
||||
#elif defined(MAKE_LINKS)
|
||||
#define APPLET(a,b,c,d) LINK c a
|
||||
#define APPLET_NOUSAGE(a,b,c) LINK c a
|
||||
#define APPLET(a,b,c) LINK c #a
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) LINK c a
|
||||
#define APPLET_NOUSAGE(a,b,c) LINK c #a
|
||||
#elif defined(APPLET_ENUM)
|
||||
#define APPLET(a,b,c) a##_applet_number,
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) e##_applet_number,
|
||||
#define APPLET_NOUSAGE(a,b,c) a##applet_number,
|
||||
#else
|
||||
#define USAGE_ENUM
|
||||
#include "usage.h"
|
||||
const struct BB_applet applets[] = {
|
||||
#define APPLET(a,b,c,d) {a,b,c,d},
|
||||
#define APPLET_NOUSAGE(a,b,c) {a,b,c,NULL},
|
||||
#define APPLET(a,b,c) {#a,b,c,a##_usage_index},
|
||||
#define APPLET_ODDNAME(a,b,c,d,e) {a,b,c,d},
|
||||
#define APPLET_NOUSAGE(a,b,c) {#a,b,c,-1},
|
||||
#define zcat_usage_index gunzip_usage_index
|
||||
#define sh_usage_index shell_usage_index
|
||||
#endif
|
||||
|
||||
#ifdef BB_TEST
|
||||
APPLET("[", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
APPLET_ODDNAME("[", test_main, _BB_DIR_USR_BIN, test_usage_index, open_bracket)
|
||||
#endif
|
||||
#ifdef BB_AR
|
||||
APPLET("ar", ar_main, _BB_DIR_USR_BIN, ar_usage)
|
||||
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET("basename", basename_main, _BB_DIR_USR_BIN, basename_usage)
|
||||
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
|
||||
APPLET_NOUSAGE(busybox, busybox_main, _BB_DIR_BIN)
|
||||
#ifdef BB_CAT
|
||||
APPLET("cat", cat_main, _BB_DIR_BIN, cat_usage)
|
||||
APPLET(cat, cat_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage)
|
||||
APPLET(chgrp, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage)
|
||||
APPLET(chmod, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage)
|
||||
APPLET(chown, chmod_chown_chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHROOT
|
||||
APPLET("chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage)
|
||||
APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_CHVT
|
||||
APPLET("chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage)
|
||||
APPLET(chvt, chvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CLEAR
|
||||
APPLET("clear", clear_main, _BB_DIR_USR_BIN, clear_usage)
|
||||
APPLET(clear, clear_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CMP
|
||||
APPLET("cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage)
|
||||
APPLET(cmp, cmp_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("cp", cp_mv_main, _BB_DIR_BIN, cp_usage)
|
||||
APPLET(cp, cp_mv_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CUT
|
||||
APPLET("cut", cut_main, _BB_DIR_USR_BIN, cut_usage)
|
||||
APPLET(cut, cut_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DATE
|
||||
APPLET("date", date_main, _BB_DIR_BIN, date_usage)
|
||||
APPLET(date, date_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DC
|
||||
APPLET("dc", dc_main, _BB_DIR_USR_BIN, dc_usage)
|
||||
APPLET(dc, dc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DD
|
||||
APPLET("dd", dd_main, _BB_DIR_BIN, dd_usage)
|
||||
APPLET(dd, dd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT
|
||||
APPLET("deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage)
|
||||
APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DF
|
||||
APPLET("df", df_main, _BB_DIR_BIN, df_usage)
|
||||
APPLET(df, df_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DIRNAME
|
||||
APPLET("dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage)
|
||||
APPLET(dirname, dirname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DMESG
|
||||
APPLET("dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage)
|
||||
APPLET(dmesg, dmesg_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DOS2UNIX
|
||||
APPLET("dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage)
|
||||
APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG
|
||||
APPLET("dpkg", dpkg_main, _BB_DIR_USR_BIN, dpkg_usage)
|
||||
APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG_DEB
|
||||
APPLET("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage)
|
||||
APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage_index, dpkg_deb)
|
||||
#endif
|
||||
#ifdef BB_DU
|
||||
APPLET("du", du_main, _BB_DIR_USR_BIN, du_usage)
|
||||
APPLET(du, du_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUMPKMAP
|
||||
APPLET("dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage)
|
||||
APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUTMP
|
||||
APPLET("dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage)
|
||||
APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ECHO
|
||||
APPLET("echo", echo_main, _BB_DIR_BIN, echo_usage)
|
||||
APPLET(echo, echo_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_EXPR
|
||||
APPLET("expr", expr_main, _BB_DIR_USR_BIN, expr_usage)
|
||||
APPLET(expr, expr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("false", false_main, _BB_DIR_BIN, false_usage)
|
||||
APPLET(false, false_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FBSET
|
||||
APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
|
||||
APPLET_NOUSAGE(fbset, fbset_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH
|
||||
APPLET("fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage)
|
||||
APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FIND
|
||||
APPLET("find", find_main, _BB_DIR_USR_BIN, find_usage)
|
||||
APPLET(find, find_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREE
|
||||
APPLET("free", free_main, _BB_DIR_USR_BIN, free_usage)
|
||||
APPLET(free, free_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK
|
||||
APPLET("freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage)
|
||||
APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX
|
||||
APPLET("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage)
|
||||
APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage_index, fsck_minix)
|
||||
#endif
|
||||
#ifdef BB_GETOPT
|
||||
APPLET("getopt", getopt_main, _BB_DIR_BIN, getopt_usage)
|
||||
APPLET(getopt, getopt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GREP
|
||||
APPLET("grep", grep_main, _BB_DIR_BIN, grep_usage)
|
||||
APPLET(grep, grep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
APPLET(gunzip, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GZIP
|
||||
APPLET("gzip", gzip_main, _BB_DIR_BIN, gzip_usage)
|
||||
APPLET(gzip, gzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HALT
|
||||
APPLET("halt", halt_main, _BB_DIR_SBIN, halt_usage)
|
||||
APPLET(halt, halt_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_HEAD
|
||||
APPLET("head", head_main, _BB_DIR_USR_BIN, head_usage)
|
||||
APPLET(head, head_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTID
|
||||
APPLET("hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage)
|
||||
APPLET(hostid, hostid_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET("hostname", hostname_main, _BB_DIR_BIN, hostname_usage)
|
||||
APPLET(hostname, hostname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET("id", id_main, _BB_DIR_USR_BIN, id_usage)
|
||||
APPLET(id, id_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_IFCONFIG
|
||||
APPLET("ifconfig", ifconfig_main, _BB_DIR_SBIN, ifconfig_usage)
|
||||
APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INIT
|
||||
APPLET_NOUSAGE("init", init_main, _BB_DIR_SBIN)
|
||||
APPLET(init, init_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INSMOD
|
||||
APPLET("insmod", insmod_main, _BB_DIR_SBIN, insmod_usage)
|
||||
APPLET(insmod, insmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_KILL
|
||||
APPLET("kill", kill_main, _BB_DIR_BIN, kill_usage)
|
||||
APPLET(kill, kill_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_KILLALL
|
||||
APPLET("killall", kill_main, _BB_DIR_USR_BIN, killall_usage)
|
||||
APPLET(killall, kill_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET("length", length_main, _BB_DIR_USR_BIN, length_usage)
|
||||
APPLET(length, length_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LINUXRC
|
||||
APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
|
||||
APPLET_NOUSAGE(linuxrc, init_main, _BB_DIR_ROOT)
|
||||
#endif
|
||||
#ifdef BB_LN
|
||||
APPLET("ln", ln_main, _BB_DIR_BIN, ln_usage)
|
||||
APPLET(ln, ln_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADACM
|
||||
APPLET("loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage)
|
||||
APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADFONT
|
||||
APPLET("loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage)
|
||||
APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP
|
||||
APPLET("loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage)
|
||||
APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LOGGER
|
||||
APPLET("logger", logger_main, _BB_DIR_USR_BIN, logger_usage)
|
||||
APPLET(logger, logger_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOGNAME
|
||||
APPLET("logname", logname_main, _BB_DIR_USR_BIN, logname_usage)
|
||||
APPLET(logname, logname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LS
|
||||
APPLET("ls", ls_main, _BB_DIR_BIN, ls_usage)
|
||||
APPLET(ls, ls_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LSMOD
|
||||
APPLET("lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage)
|
||||
APPLET(lsmod, lsmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS
|
||||
APPLET("makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage)
|
||||
APPLET(makedevs, makedevs_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MD5SUM
|
||||
APPLET("md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage)
|
||||
APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKDIR
|
||||
APPLET("mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage)
|
||||
APPLET(mkdir, mkdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFIFO
|
||||
APPLET("mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage)
|
||||
APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX
|
||||
APPLET("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage)
|
||||
APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage_index, mkfs_minix)
|
||||
#endif
|
||||
#ifdef BB_MKNOD
|
||||
APPLET("mknod", mknod_main, _BB_DIR_BIN, mknod_usage)
|
||||
APPLET(mknod, mknod_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKSWAP
|
||||
APPLET("mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage)
|
||||
APPLET(mkswap, mkswap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET("mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage)
|
||||
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET("more", more_main, _BB_DIR_BIN, more_usage)
|
||||
APPLET(more, more_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET("mount", mount_main, _BB_DIR_BIN, mount_usage)
|
||||
APPLET(mount, mount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET("mt", mt_main, _BB_DIR_BIN, mt_usage)
|
||||
APPLET(mt, mt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("mv", cp_mv_main, _BB_DIR_BIN, mv_usage)
|
||||
APPLET(mv, cp_mv_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NC
|
||||
APPLET("nc", nc_main, _BB_DIR_USR_BIN, nc_usage)
|
||||
APPLET(nc, nc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET("nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage)
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET("ping", ping_main, _BB_DIR_BIN, ping_usage)
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIVOT_ROOT
|
||||
APPLET("pivot_root", pivot_root_main, _BB_DIR_SBIN, pivot_root_usage)
|
||||
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_POWEROFF
|
||||
APPLET("poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage)
|
||||
APPLET(poweroff, poweroff_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_PRINTF
|
||||
APPLET("printf", printf_main, _BB_DIR_USR_BIN, printf_usage)
|
||||
APPLET(printf, printf_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PS
|
||||
APPLET("ps", ps_main, _BB_DIR_BIN, ps_usage)
|
||||
APPLET(ps, ps_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PWD
|
||||
APPLET("pwd", pwd_main, _BB_DIR_BIN, pwd_usage)
|
||||
APPLET(pwd, pwd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RDATE
|
||||
APPLET("rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage)
|
||||
APPLET(rdate, rdate_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_READLINK
|
||||
APPLET("readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage)
|
||||
APPLET(readlink, readlink_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_REBOOT
|
||||
APPLET("reboot", reboot_main, _BB_DIR_SBIN, reboot_usage)
|
||||
APPLET(reboot, reboot_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_RENICE
|
||||
APPLET("renice", renice_main, _BB_DIR_USR_BIN, renice_usage)
|
||||
APPLET(renice, renice_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RESET
|
||||
APPLET("reset", reset_main, _BB_DIR_USR_BIN, reset_usage)
|
||||
APPLET(reset, reset_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RM
|
||||
APPLET("rm", rm_main, _BB_DIR_BIN, rm_usage)
|
||||
APPLET(rm, rm_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMDIR
|
||||
APPLET("rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage)
|
||||
APPLET(rmdir, rmdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMMOD
|
||||
APPLET("rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage)
|
||||
APPLET(rmmod, rmmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ROUTE
|
||||
APPLET("route", route_main, _BB_DIR_USR_BIN, route_usage)
|
||||
APPLET(route, route_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RPMUNPACK
|
||||
APPLET("rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage)
|
||||
APPLET(rpmunpack, rpmunpack_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SED
|
||||
APPLET("sed", sed_main, _BB_DIR_BIN, sed_usage)
|
||||
APPLET(sed, sed_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET("setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage)
|
||||
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET("sh", shell_main, _BB_DIR_BIN, shell_usage)
|
||||
APPLET(sh, shell_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET("sleep", sleep_main, _BB_DIR_BIN, sleep_usage)
|
||||
APPLET(sleep, sleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SORT
|
||||
APPLET("sort", sort_main, _BB_DIR_USR_BIN, sort_usage)
|
||||
APPLET(sort, sort_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_STTY
|
||||
APPLET("stty", stty_main, _BB_DIR_BIN, stty_usage)
|
||||
APPLET(stty, stty_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage)
|
||||
APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage)
|
||||
APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SYNC
|
||||
APPLET("sync", sync_main, _BB_DIR_BIN, sync_usage)
|
||||
APPLET(sync, sync_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD
|
||||
APPLET("syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage)
|
||||
APPLET(syslogd, syslogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_TAIL
|
||||
APPLET("tail", tail_main, _BB_DIR_USR_BIN, tail_usage)
|
||||
APPLET(tail, tail_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TAR
|
||||
APPLET("tar", tar_main, _BB_DIR_BIN, tar_usage)
|
||||
APPLET(tar, tar_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEE
|
||||
APPLET("tee", tee_main, _BB_DIR_USR_BIN, tee_usage)
|
||||
APPLET(tee, tee_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TELNET
|
||||
APPLET("telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage)
|
||||
APPLET(telnet, telnet_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEST
|
||||
APPLET("test", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
APPLET(test, test_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TOUCH
|
||||
APPLET("touch", touch_main, _BB_DIR_BIN, touch_usage)
|
||||
APPLET(touch, touch_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TR
|
||||
APPLET("tr", tr_main, _BB_DIR_USR_BIN, tr_usage)
|
||||
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("true", true_main, _BB_DIR_BIN, true_usage)
|
||||
APPLET(true, true_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TTY
|
||||
APPLET("tty", tty_main, _BB_DIR_USR_BIN, tty_usage)
|
||||
APPLET(tty, tty_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UMOUNT
|
||||
APPLET("umount", umount_main, _BB_DIR_BIN, umount_usage)
|
||||
APPLET(umount, umount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNAME
|
||||
APPLET("uname", uname_main, _BB_DIR_BIN, uname_usage)
|
||||
APPLET(uname, uname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIQ
|
||||
APPLET("uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage)
|
||||
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET("unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage)
|
||||
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET("update", update_main, _BB_DIR_SBIN, update_usage)
|
||||
APPLET(update, update_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_UPTIME
|
||||
APPLET("uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage)
|
||||
APPLET(uptime, uptime_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_USLEEP
|
||||
APPLET("usleep", usleep_main, _BB_DIR_BIN, usleep_usage)
|
||||
APPLET(usleep, usleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUDECODE
|
||||
APPLET("uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage)
|
||||
APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUENCODE
|
||||
APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
|
||||
APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WATCHDOG
|
||||
APPLET("watchdog", watchdog_main, _BB_DIR_SBIN, watchdog_usage)
|
||||
APPLET(watchdog, watchdog_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_WC
|
||||
APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
|
||||
APPLET(wc, wc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WGET
|
||||
APPLET("wget", wget_main, _BB_DIR_USR_BIN, wget_usage)
|
||||
APPLET(wget, wget_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHICH
|
||||
APPLET("which", which_main, _BB_DIR_USR_BIN, which_usage)
|
||||
APPLET(which, which_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHOAMI
|
||||
APPLET("whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage)
|
||||
APPLET(whoami, whoami_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_XARGS
|
||||
APPLET("xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage)
|
||||
APPLET(xargs, xargs_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_YES
|
||||
APPLET("yes", yes_main, _BB_DIR_USR_BIN, yes_usage)
|
||||
APPLET(yes, yes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
APPLET(zcat, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_LINKS)
|
||||
{ 0,NULL,0,NULL}
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_LINKS) && !defined(APPLET_ENUM)
|
||||
{ 0,NULL,0,-1}
|
||||
};
|
||||
|
||||
/* The -1 arises because of the {0,NULL,0,NULL} entry above. */
|
||||
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
|
||||
size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
|
||||
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ struct BB_applet {
|
||||
const char* name;
|
||||
int (*main)(int argc, char** argv);
|
||||
enum Location location;
|
||||
const char* usage;
|
||||
int usage_index;
|
||||
};
|
||||
/* From busybox.c */
|
||||
extern const struct BB_applet applets[];
|
||||
@ -87,9 +87,15 @@ extern const struct BB_applet applets[];
|
||||
#include "applets.h"
|
||||
#undef PROTOTYPES
|
||||
|
||||
#define APPLET_ENUM
|
||||
enum APPLET_INDEX_NUMBERS {
|
||||
#include "applets.h"
|
||||
};
|
||||
#undef APPLET_ENUM
|
||||
|
||||
extern const char *applet_name;
|
||||
|
||||
extern void usage(const char *usage) __attribute__ ((noreturn));
|
||||
extern void show_usage(void) __attribute__ ((noreturn));
|
||||
extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
||||
extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
@ -153,6 +159,7 @@ extern FILE *wfopen(const char *path, const char *mode);
|
||||
extern FILE *xfopen(const char *path, const char *mode);
|
||||
extern void chomp(char *s);
|
||||
extern struct BB_applet *find_applet_by_name(const char *name);
|
||||
void run_applet_by_name(const char *name, int argc, char **argv);
|
||||
|
||||
#ifndef DMALLOC
|
||||
extern void *xmalloc (size_t size);
|
||||
|
4
init.c
4
init.c
@ -937,9 +937,7 @@ extern int init_main(int argc, char **argv)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
usage("init\n\nInit is the parent of all processes.\n\n"
|
||||
"This version of init is designed to be run only "
|
||||
"by the kernel.");
|
||||
show_usage();
|
||||
}
|
||||
/* Set up sig handlers -- be sure to
|
||||
* clear all of these in run() */
|
||||
|
@ -937,9 +937,7 @@ extern int init_main(int argc, char **argv)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
usage("init\n\nInit is the parent of all processes.\n\n"
|
||||
"This version of init is designed to be run only "
|
||||
"by the kernel.");
|
||||
show_usage();
|
||||
}
|
||||
/* Set up sig handlers -- be sure to
|
||||
* clear all of these in run() */
|
||||
|
8
insmod.c
8
insmod.c
@ -81,7 +81,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
static const int MODUTILS_MODULE_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $"
|
||||
#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@ -287,7 +287,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
static const int MODUTILS_OBJ_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $"
|
||||
#ident "$Id: insmod.c,v 1.46 2001/02/14 21:23:06 andersen Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@ -2916,12 +2916,12 @@ extern int insmod_main( int argc, char **argv)
|
||||
* loading the same module 50 times concurrently. */
|
||||
break;
|
||||
default:
|
||||
usage(insmod_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argv[optind] == NULL) {
|
||||
usage(insmod_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
/* Grab the module name */
|
||||
|
7
kill.c
7
kill.c
@ -124,22 +124,19 @@ const struct signal_name signames[] = {
|
||||
extern int kill_main(int argc, char **argv)
|
||||
{
|
||||
int whichApp, sig = SIGTERM;
|
||||
const char *appUsage;
|
||||
|
||||
#ifdef BB_KILLALL
|
||||
/* Figure out what we are trying to do here */
|
||||
whichApp = (strcmp(applet_name, "killall") == 0)? KILLALL : KILL;
|
||||
appUsage = (whichApp == KILLALL)? killall_usage : kill_usage;
|
||||
#else
|
||||
whichApp = KILL;
|
||||
appUsage = kill_usage;
|
||||
#endif
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
/* Parse any options */
|
||||
if (argc < 1)
|
||||
usage(appUsage);
|
||||
show_usage();
|
||||
|
||||
while (argc > 0 && **argv == '-') {
|
||||
while (*++(*argv)) {
|
||||
@ -163,7 +160,7 @@ extern int kill_main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
usage(appUsage);
|
||||
show_usage();
|
||||
default:
|
||||
{
|
||||
if (isdigit(**argv)) {
|
||||
|
11
lash.c
11
lash.c
@ -1370,7 +1370,6 @@ static int pseudo_exec(struct child_prog *child)
|
||||
{
|
||||
struct built_in_command *x;
|
||||
#ifdef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
struct BB_applet *applet;
|
||||
char *name;
|
||||
#endif
|
||||
|
||||
@ -1415,14 +1414,12 @@ static int pseudo_exec(struct child_prog *child)
|
||||
name = get_last_path_component(name);
|
||||
#endif
|
||||
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
if ((applet = find_applet_by_name(name)) != NULL) {
|
||||
int argc_l;
|
||||
{
|
||||
char** argv=child->argv;
|
||||
int argc_l;
|
||||
for(argc_l=0;*argv!=NULL; argv++, argc_l++);
|
||||
applet_name=applet->name;
|
||||
optind = 1;
|
||||
exit((*(applet->main)) (argc_l, child->argv));
|
||||
run_applet_by_name(name, argc_l, child->argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1750,7 +1747,7 @@ int shell_main(int argc_l, char **argv_l)
|
||||
interactive = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(shell_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
/* A shell is interactive if the `-i' flag was given, or if all of
|
||||
|
2
length.c
2
length.c
@ -7,7 +7,7 @@
|
||||
extern int length_main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2 || **(argv + 1) == '-')
|
||||
usage(length_usage);
|
||||
show_usage();
|
||||
printf("%lu\n", (long)strlen(argv[1]));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user