diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 13:08:20 +1000 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 13:08:20 +1000 |
| commit | 6a6efd31038d7afe977e3059508ae863e65cbdf5 (patch) | |
| tree | 5cd69a751e893b83176751c80fcea7a7afeed1ae /include | |
| parent | a6a2325ecf402054132daae169f71edb0fb849e3 (diff) | |
| parent | 29082231d0cb1a5b327de5d515b16f332d4dbdaf (diff) | |
| download | busybox-w32-6a6efd31038d7afe977e3059508ae863e65cbdf5.tar.gz busybox-w32-6a6efd31038d7afe977e3059508ae863e65cbdf5.tar.bz2 busybox-w32-6a6efd31038d7afe977e3059508ae863e65cbdf5.zip | |
Merge branch 'origin/master' (early part)
Diffstat (limited to 'include')
| -rw-r--r-- | include/applets.src.h | 5 | ||||
| -rw-r--r-- | include/busybox.h | 13 | ||||
| -rw-r--r-- | include/libbb.h | 43 | ||||
| -rw-r--r-- | include/platform.h | 10 | ||||
| -rw-r--r-- | include/unarchive.h | 62 | ||||
| -rw-r--r-- | include/usage.src.h | 216 |
6 files changed, 135 insertions, 214 deletions
diff --git a/include/applets.src.h b/include/applets.src.h index 9162b66c7..5d84597b0 100644 --- a/include/applets.src.h +++ b/include/applets.src.h | |||
| @@ -76,7 +76,6 @@ IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP)) | |||
| 76 | IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk)) | 76 | IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk)) |
| 77 | IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename)) | 77 | IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename)) |
| 78 | IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash)) | 78 | IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash)) |
| 79 | IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, _BB_DIR_BIN, _BB_SUID_DROP, bash)) | ||
| 80 | IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP)) | 79 | IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 81 | //IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP)) | 80 | //IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 82 | IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 81 | IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
| @@ -183,7 +182,6 @@ IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_DROP, hexdu | |||
| 183 | IF_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_DROP, hostid)) | 182 | IF_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_DROP, hostid)) |
| 184 | IF_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_DROP)) | 183 | IF_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 185 | IF_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) | 184 | IF_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) |
| 186 | IF_HUSH(APPLET(hush, _BB_DIR_BIN, _BB_SUID_DROP)) | ||
| 187 | IF_HWCLOCK(APPLET(hwclock, _BB_DIR_SBIN, _BB_SUID_DROP)) | 185 | IF_HWCLOCK(APPLET(hwclock, _BB_DIR_SBIN, _BB_SUID_DROP)) |
| 188 | IF_ID(APPLET(id, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 186 | IF_ID(APPLET(id, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
| 189 | IF_IFCONFIG(APPLET(ifconfig, _BB_DIR_SBIN, _BB_SUID_DROP)) | 187 | IF_IFCONFIG(APPLET(ifconfig, _BB_DIR_SBIN, _BB_SUID_DROP)) |
| @@ -218,7 +216,6 @@ IF_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_DROP)) | |||
| 218 | IF_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_DROP, killall)) | 216 | IF_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_DROP, killall)) |
| 219 | IF_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_DROP, killall5)) | 217 | IF_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_DROP, killall5)) |
| 220 | IF_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_DROP)) | 218 | IF_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_DROP)) |
| 221 | IF_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_DROP)) | ||
| 222 | IF_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 219 | IF_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
| 223 | IF_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_DROP, length)) | 220 | IF_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_DROP, length)) |
| 224 | IF_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 221 | IF_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
| @@ -273,7 +270,6 @@ IF_MODPROBE_SMALL(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_DROP)) | |||
| 273 | IF_MORE(APPLET(more, _BB_DIR_BIN, _BB_SUID_DROP)) | 270 | IF_MORE(APPLET(more, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 274 | IF_MOUNT(APPLET(mount, _BB_DIR_BIN, IF_DESKTOP(_BB_SUID_MAYBE) IF_NOT_DESKTOP(_BB_SUID_DROP))) | 271 | IF_MOUNT(APPLET(mount, _BB_DIR_BIN, IF_DESKTOP(_BB_SUID_MAYBE) IF_NOT_DESKTOP(_BB_SUID_DROP))) |
| 275 | IF_MOUNTPOINT(APPLET(mountpoint, _BB_DIR_BIN, _BB_SUID_DROP)) | 272 | IF_MOUNTPOINT(APPLET(mountpoint, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 276 | IF_MSH(APPLET(msh, _BB_DIR_BIN, _BB_SUID_DROP)) | ||
| 277 | IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_DROP)) | 273 | IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 278 | IF_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_DROP)) | 274 | IF_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_DROP)) |
| 279 | IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_DROP)) | 275 | IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_DROP)) |
| @@ -349,7 +345,6 @@ IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) | |||
| 349 | IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 345 | IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
| 350 | IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid)) | 346 | IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid)) |
| 351 | IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh)) | 347 | IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh)) |
| 352 | IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_DROP, sh)) | ||
| 353 | IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum)) | 348 | IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum)) |
| 354 | IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum)) | 349 | IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum)) |
| 355 | IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum)) | 350 | IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum)) |
diff --git a/include/busybox.h b/include/busybox.h index 48ce856ea..48fc0b4c8 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
| @@ -35,18 +35,21 @@ extern const uint16_t applet_nameofs[]; | |||
| 35 | extern const uint8_t applet_install_loc[]; | 35 | extern const uint8_t applet_install_loc[]; |
| 36 | 36 | ||
| 37 | #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS | 37 | #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS |
| 38 | #define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff)) | 38 | # define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff)) |
| 39 | #else | 39 | #else |
| 40 | #define APPLET_NAME(i) (applet_names + applet_nameofs[i]) | 40 | # define APPLET_NAME(i) (applet_names + applet_nameofs[i]) |
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #if ENABLE_FEATURE_PREFER_APPLETS | 43 | #if ENABLE_FEATURE_PREFER_APPLETS |
| 44 | #define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12)) | 44 | # define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12)) |
| 45 | #define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13)) | 45 | # define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13)) |
| 46 | #else | ||
| 47 | # define APPLET_IS_NOFORK(i) 0 | ||
| 48 | # define APPLET_IS_NOEXEC(i) 0 | ||
| 46 | #endif | 49 | #endif |
| 47 | 50 | ||
| 48 | #if ENABLE_FEATURE_SUID | 51 | #if ENABLE_FEATURE_SUID |
| 49 | #define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3) | 52 | # define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3) |
| 50 | #endif | 53 | #endif |
| 51 | 54 | ||
| 52 | #if ENABLE_FEATURE_INSTALLER | 55 | #if ENABLE_FEATURE_INSTALLER |
diff --git a/include/libbb.h b/include/libbb.h index 0836b684e..26656de2e 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -419,6 +419,7 @@ void xchdir(const char *path) FAST_FUNC; | |||
| 419 | void xchroot(const char *path) FAST_FUNC; | 419 | void xchroot(const char *path) FAST_FUNC; |
| 420 | void xsetenv(const char *key, const char *value) FAST_FUNC; | 420 | void xsetenv(const char *key, const char *value) FAST_FUNC; |
| 421 | void bb_unsetenv(const char *key) FAST_FUNC; | 421 | void bb_unsetenv(const char *key) FAST_FUNC; |
| 422 | void bb_unsetenv_and_free(char *key) FAST_FUNC; | ||
| 422 | void xunlink(const char *pathname) FAST_FUNC; | 423 | void xunlink(const char *pathname) FAST_FUNC; |
| 423 | void xstat(const char *pathname, struct stat *buf) FAST_FUNC; | 424 | void xstat(const char *pathname, struct stat *buf) FAST_FUNC; |
| 424 | int xopen(const char *pathname, int flags) FAST_FUNC; | 425 | int xopen(const char *pathname, int flags) FAST_FUNC; |
| @@ -854,6 +855,20 @@ int bb_execvp(const char *file, char *const argv[]) FAST_FUNC; | |||
| 854 | #define BB_EXECVP(prog,cmd) execvp(prog,cmd) | 855 | #define BB_EXECVP(prog,cmd) execvp(prog,cmd) |
| 855 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) | 856 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) |
| 856 | #endif | 857 | #endif |
| 858 | int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; | ||
| 859 | |||
| 860 | /* xvfork() can't be a _function_, return after vfork mangles stack | ||
| 861 | * in the parent. It must be a macro. */ | ||
| 862 | #define xvfork() \ | ||
| 863 | ({ \ | ||
| 864 | pid_t bb__xvfork_pid = vfork(); \ | ||
| 865 | if (bb__xvfork_pid < 0) \ | ||
| 866 | bb_perror_msg_and_die("vfork"); \ | ||
| 867 | bb__xvfork_pid; \ | ||
| 868 | }) | ||
| 869 | #if BB_MMU | ||
| 870 | pid_t xfork(void) FAST_FUNC; | ||
| 871 | #endif | ||
| 857 | 872 | ||
| 858 | /* NOMMU friendy fork+exec: */ | 873 | /* NOMMU friendy fork+exec: */ |
| 859 | pid_t spawn(char **argv) FAST_FUNC; | 874 | pid_t spawn(char **argv) FAST_FUNC; |
| @@ -900,7 +915,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char ** | |||
| 900 | * Both of the above will redirect fd 0,1,2 to /dev/null and drop ctty | 915 | * Both of the above will redirect fd 0,1,2 to /dev/null and drop ctty |
| 901 | * (will do setsid()). | 916 | * (will do setsid()). |
| 902 | * | 917 | * |
| 903 | * fork_or_rexec(argv) = bare-bones "fork" on MMU, | 918 | * fork_or_rexec(argv) = bare-bones fork on MMU, |
| 904 | * "vfork + re-exec ourself" on NOMMU. No fd redirection, no setsid(). | 919 | * "vfork + re-exec ourself" on NOMMU. No fd redirection, no setsid(). |
| 905 | * On MMU ignores argv. | 920 | * On MMU ignores argv. |
| 906 | * | 921 | * |
| @@ -916,19 +931,19 @@ enum { | |||
| 916 | DAEMON_ONLY_SANITIZE = 8, /* internal use */ | 931 | DAEMON_ONLY_SANITIZE = 8, /* internal use */ |
| 917 | }; | 932 | }; |
| 918 | #if BB_MMU | 933 | #if BB_MMU |
| 919 | pid_t fork_or_rexec(void) FAST_FUNC; | ||
| 920 | enum { re_execed = 0 }; | 934 | enum { re_execed = 0 }; |
| 921 | # define fork_or_rexec(argv) fork_or_rexec() | 935 | # define fork_or_rexec(argv) xfork() |
| 922 | # define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags) | 936 | # define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags) |
| 923 | # define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus) | 937 | # define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus) |
| 924 | #else | 938 | #else |
| 939 | extern bool re_execed; | ||
| 925 | void re_exec(char **argv) NORETURN FAST_FUNC; | 940 | void re_exec(char **argv) NORETURN FAST_FUNC; |
| 926 | pid_t fork_or_rexec(char **argv) FAST_FUNC; | 941 | pid_t fork_or_rexec(char **argv) FAST_FUNC; |
| 927 | extern bool re_execed; | ||
| 928 | int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC; | 942 | int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC; |
| 929 | int BUG_daemon_is_unavailable_on_nommu(void) FAST_FUNC; | 943 | int BUG_daemon_is_unavailable_on_nommu(void) FAST_FUNC; |
| 930 | void BUG_bb_daemonize_is_unavailable_on_nommu(void) FAST_FUNC; | 944 | void BUG_bb_daemonize_is_unavailable_on_nommu(void) FAST_FUNC; |
| 931 | # define fork() BUG_fork_is_unavailable_on_nommu() | 945 | # define fork() BUG_fork_is_unavailable_on_nommu() |
| 946 | # define xfork() BUG_fork_is_unavailable_on_nommu() | ||
| 932 | # define daemon(a,b) BUG_daemon_is_unavailable_on_nommu() | 947 | # define daemon(a,b) BUG_daemon_is_unavailable_on_nommu() |
| 933 | # define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu() | 948 | # define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu() |
| 934 | #endif | 949 | #endif |
| @@ -1141,6 +1156,7 @@ typedef struct parser_t { | |||
| 1141 | } parser_t; | 1156 | } parser_t; |
| 1142 | parser_t* config_open(const char *filename) FAST_FUNC; | 1157 | parser_t* config_open(const char *filename) FAST_FUNC; |
| 1143 | parser_t* config_open2(const char *filename, FILE* FAST_FUNC (*fopen_func)(const char *path)) FAST_FUNC; | 1158 | parser_t* config_open2(const char *filename, FILE* FAST_FUNC (*fopen_func)(const char *path)) FAST_FUNC; |
| 1159 | /* delims[0] is a comment char (use '\0' to disable), the rest are token delimiters */ | ||
| 1144 | int config_read(parser_t *parser, char **tokens, unsigned flags, const char *delims) FAST_FUNC; | 1160 | int config_read(parser_t *parser, char **tokens, unsigned flags, const char *delims) FAST_FUNC; |
| 1145 | #define config_read(parser, tokens, max, min, str, flags) \ | 1161 | #define config_read(parser, tokens, max, min, str, flags) \ |
| 1146 | config_read(parser, tokens, ((flags) | (((min) & 0xFF) << 8) | ((max) & 0xFF)), str) | 1162 | config_read(parser, tokens, ((flags) | (((min) & 0xFF) << 8) | ((max) & 0xFF)), str) |
| @@ -1171,7 +1187,6 @@ char *bb_simplify_abs_path_inplace(char *path) FAST_FUNC; | |||
| 1171 | extern void bb_do_delay(int seconds) FAST_FUNC; | 1187 | extern void bb_do_delay(int seconds) FAST_FUNC; |
| 1172 | extern void change_identity(const struct passwd *pw) FAST_FUNC; | 1188 | extern void change_identity(const struct passwd *pw) FAST_FUNC; |
| 1173 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) NORETURN FAST_FUNC; | 1189 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) NORETURN FAST_FUNC; |
| 1174 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) FAST_FUNC; | ||
| 1175 | #if ENABLE_SELINUX | 1190 | #if ENABLE_SELINUX |
| 1176 | extern void renew_current_security_context(void) FAST_FUNC; | 1191 | extern void renew_current_security_context(void) FAST_FUNC; |
| 1177 | extern void set_current_security_context(security_context_t sid) FAST_FUNC; | 1192 | extern void set_current_security_context(security_context_t sid) FAST_FUNC; |
| @@ -1611,12 +1626,12 @@ extern struct globals *const ptr_to_globals; | |||
| 1611 | * use bb_default_login_shell and following defines. | 1626 | * use bb_default_login_shell and following defines. |
| 1612 | * If you change LIBBB_DEFAULT_LOGIN_SHELL, | 1627 | * If you change LIBBB_DEFAULT_LOGIN_SHELL, |
| 1613 | * don't forget to change increment constant. */ | 1628 | * don't forget to change increment constant. */ |
| 1614 | #define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh" | 1629 | #define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh" |
| 1615 | extern const char bb_default_login_shell[]; | 1630 | extern const char bb_default_login_shell[]; |
| 1616 | /* "/bin/sh" */ | 1631 | /* "/bin/sh" */ |
| 1617 | #define DEFAULT_SHELL (bb_default_login_shell+1) | 1632 | #define DEFAULT_SHELL (bb_default_login_shell+1) |
| 1618 | /* "sh" */ | 1633 | /* "sh" */ |
| 1619 | #define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6) | 1634 | #define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6) |
| 1620 | 1635 | ||
| 1621 | #if ENABLE_FEATURE_DEVFS | 1636 | #if ENABLE_FEATURE_DEVFS |
| 1622 | # define CURRENT_VC "/dev/vc/0" | 1637 | # define CURRENT_VC "/dev/vc/0" |
| @@ -1625,18 +1640,18 @@ extern const char bb_default_login_shell[]; | |||
| 1625 | # define VC_3 "/dev/vc/3" | 1640 | # define VC_3 "/dev/vc/3" |
| 1626 | # define VC_4 "/dev/vc/4" | 1641 | # define VC_4 "/dev/vc/4" |
| 1627 | # define VC_5 "/dev/vc/5" | 1642 | # define VC_5 "/dev/vc/5" |
| 1628 | #if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__) | 1643 | # if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__) |
| 1629 | /* Yes, this sucks, but both SH (including sh64) and H8 have a SCI(F) for their | 1644 | /* Yes, this sucks, but both SH (including sh64) and H8 have a SCI(F) for their |
| 1630 | respective serial ports .. as such, we can't use the common device paths for | 1645 | respective serial ports .. as such, we can't use the common device paths for |
| 1631 | these. -- PFM */ | 1646 | these. -- PFM */ |
| 1632 | # define SC_0 "/dev/ttsc/0" | 1647 | # define SC_0 "/dev/ttsc/0" |
| 1633 | # define SC_1 "/dev/ttsc/1" | 1648 | # define SC_1 "/dev/ttsc/1" |
| 1634 | # define SC_FORMAT "/dev/ttsc/%d" | 1649 | # define SC_FORMAT "/dev/ttsc/%d" |
| 1635 | #else | 1650 | # else |
| 1636 | # define SC_0 "/dev/tts/0" | 1651 | # define SC_0 "/dev/tts/0" |
| 1637 | # define SC_1 "/dev/tts/1" | 1652 | # define SC_1 "/dev/tts/1" |
| 1638 | # define SC_FORMAT "/dev/tts/%d" | 1653 | # define SC_FORMAT "/dev/tts/%d" |
| 1639 | #endif | 1654 | # endif |
| 1640 | # define VC_FORMAT "/dev/vc/%d" | 1655 | # define VC_FORMAT "/dev/vc/%d" |
| 1641 | # define LOOP_FORMAT "/dev/loop/%d" | 1656 | # define LOOP_FORMAT "/dev/loop/%d" |
| 1642 | # define LOOP_NAMESIZE (sizeof("/dev/loop/") + sizeof(int)*3 + 1) | 1657 | # define LOOP_NAMESIZE (sizeof("/dev/loop/") + sizeof(int)*3 + 1) |
| @@ -1649,15 +1664,15 @@ extern const char bb_default_login_shell[]; | |||
| 1649 | # define VC_3 "/dev/tty3" | 1664 | # define VC_3 "/dev/tty3" |
| 1650 | # define VC_4 "/dev/tty4" | 1665 | # define VC_4 "/dev/tty4" |
| 1651 | # define VC_5 "/dev/tty5" | 1666 | # define VC_5 "/dev/tty5" |
| 1652 | #if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__) | 1667 | # if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__) |
| 1653 | # define SC_0 "/dev/ttySC0" | 1668 | # define SC_0 "/dev/ttySC0" |
| 1654 | # define SC_1 "/dev/ttySC1" | 1669 | # define SC_1 "/dev/ttySC1" |
| 1655 | # define SC_FORMAT "/dev/ttySC%d" | 1670 | # define SC_FORMAT "/dev/ttySC%d" |
| 1656 | #else | 1671 | # else |
| 1657 | # define SC_0 "/dev/ttyS0" | 1672 | # define SC_0 "/dev/ttyS0" |
| 1658 | # define SC_1 "/dev/ttyS1" | 1673 | # define SC_1 "/dev/ttyS1" |
| 1659 | # define SC_FORMAT "/dev/ttyS%d" | 1674 | # define SC_FORMAT "/dev/ttyS%d" |
| 1660 | #endif | 1675 | # endif |
| 1661 | # define VC_FORMAT "/dev/tty%d" | 1676 | # define VC_FORMAT "/dev/tty%d" |
| 1662 | # define LOOP_FORMAT "/dev/loop%d" | 1677 | # define LOOP_FORMAT "/dev/loop%d" |
| 1663 | # define LOOP_NAMESIZE (sizeof("/dev/loop") + sizeof(int)*3 + 1) | 1678 | # define LOOP_NAMESIZE (sizeof("/dev/loop") + sizeof(int)*3 + 1) |
diff --git a/include/platform.h b/include/platform.h index d1ac391eb..9458e2e02 100644 --- a/include/platform.h +++ b/include/platform.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #define HAVE_SETBIT 1 | 26 | #define HAVE_SETBIT 1 |
| 27 | #define HAVE_STRCASESTR 1 | 27 | #define HAVE_STRCASESTR 1 |
| 28 | #define HAVE_STRCHRNUL 1 | 28 | #define HAVE_STRCHRNUL 1 |
| 29 | #define HAVE_STRSEP 1 | ||
| 29 | #define HAVE_STRSIGNAL 1 | 30 | #define HAVE_STRSIGNAL 1 |
| 30 | #define HAVE_VASPRINTF 1 | 31 | #define HAVE_VASPRINTF 1 |
| 31 | 32 | ||
| @@ -185,10 +186,10 @@ | |||
| 185 | #if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__ | 186 | #if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__ |
| 186 | # define BB_BIG_ENDIAN 1 | 187 | # define BB_BIG_ENDIAN 1 |
| 187 | # define BB_LITTLE_ENDIAN 0 | 188 | # define BB_LITTLE_ENDIAN 0 |
| 188 | #elif __BYTE_ORDER == __BIG_ENDIAN | 189 | #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN |
| 189 | # define BB_BIG_ENDIAN 1 | 190 | # define BB_BIG_ENDIAN 1 |
| 190 | # define BB_LITTLE_ENDIAN 0 | 191 | # define BB_LITTLE_ENDIAN 0 |
| 191 | #elif __BYTE_ORDER == __LITTLE_ENDIAN | 192 | #elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__) |
| 192 | # define BB_BIG_ENDIAN 0 | 193 | # define BB_BIG_ENDIAN 0 |
| 193 | # define BB_LITTLE_ENDIAN 1 | 194 | # define BB_LITTLE_ENDIAN 1 |
| 194 | #else | 195 | #else |
| @@ -381,6 +382,7 @@ typedef unsigned smalluint; | |||
| 381 | # undef HAVE_SETBIT | 382 | # undef HAVE_SETBIT |
| 382 | # undef HAVE_STRCASESTR | 383 | # undef HAVE_STRCASESTR |
| 383 | # undef HAVE_STRCHRNUL | 384 | # undef HAVE_STRCHRNUL |
| 385 | # undef HAVE_STRSEP | ||
| 384 | # undef HAVE_STRSIGNAL | 386 | # undef HAVE_STRSIGNAL |
| 385 | # undef HAVE_VASPRINTF | 387 | # undef HAVE_VASPRINTF |
| 386 | #endif | 388 | #endif |
| @@ -419,6 +421,10 @@ extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; | |||
| 419 | extern char *strchrnul(const char *s, int c) FAST_FUNC; | 421 | extern char *strchrnul(const char *s, int c) FAST_FUNC; |
| 420 | #endif | 422 | #endif |
| 421 | 423 | ||
| 424 | #ifndef HAVE_STRSEP | ||
| 425 | extern char *strsep(char **stringp, const char *delim) FAST_FUNC; | ||
| 426 | #endif | ||
| 427 | |||
| 422 | #ifndef HAVE_STRSIGNAL | 428 | #ifndef HAVE_STRSIGNAL |
| 423 | /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */ | 429 | /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */ |
| 424 | # define strsignal(sig) get_signame(sig) | 430 | # define strsignal(sig) get_signame(sig) |
diff --git a/include/unarchive.h b/include/unarchive.h index 8009de282..b55af6d9d 100644 --- a/include/unarchive.h +++ b/include/unarchive.h | |||
| @@ -7,16 +7,23 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | |||
| 7 | enum { | 7 | enum { |
| 8 | #if BB_BIG_ENDIAN | 8 | #if BB_BIG_ENDIAN |
| 9 | COMPRESS_MAGIC = 0x1f9d, | 9 | COMPRESS_MAGIC = 0x1f9d, |
| 10 | GZIP_MAGIC = 0x1f8b, | 10 | GZIP_MAGIC = 0x1f8b, |
| 11 | BZIP2_MAGIC = ('B'<<8) + 'Z', | 11 | BZIP2_MAGIC = 'B' * 256 + 'Z', |
| 12 | XZ_MAGIC1 = (0xfd<<8) + '7', | 12 | /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */ |
| 13 | XZ_MAGIC2 = ((((('z'<<8) + 'X')<<8) + 'Z')<<8) + 0, | 13 | /* More info at: http://tukaani.org/xz/xz-file-format.txt */ |
| 14 | XZ_MAGIC1 = 0xfd * 256 + '7', | ||
| 15 | XZ_MAGIC2 = (('z' * 256 + 'X') * 256 + 'Z') * 256 + 0, | ||
| 16 | /* Different form: 32 bits, then 16 bits: */ | ||
| 17 | XZ_MAGIC1a = ((0xfd * 256 + '7') * 256 + 'z') * 256 + 'X', | ||
| 18 | XZ_MAGIC2a = 'Z' * 256 + 0, | ||
| 14 | #else | 19 | #else |
| 15 | COMPRESS_MAGIC = 0x9d1f, | 20 | COMPRESS_MAGIC = 0x9d1f, |
| 16 | GZIP_MAGIC = 0x8b1f, | 21 | GZIP_MAGIC = 0x8b1f, |
| 17 | BZIP2_MAGIC = ('Z'<<8) + 'B', | 22 | BZIP2_MAGIC = 'Z' * 256 + 'B', |
| 18 | XZ_MAGIC1 = ('7'<<8) + 0xfd, | 23 | XZ_MAGIC1 = '7' * 256 + 0xfd, |
| 19 | XZ_MAGIC2 = (((((0<<8) + 'Z')<<8) + 'X')<<8) + 'z', | 24 | XZ_MAGIC2 = ((0 * 256 + 'Z') * 256 + 'X') * 256 + 'z', |
| 25 | XZ_MAGIC1a = (('X' * 256 + 'z') * 256 + '7') * 256 + 0xfd, | ||
| 26 | XZ_MAGIC2a = 0 * 256 + 'Z', | ||
| 20 | #endif | 27 | #endif |
| 21 | }; | 28 | }; |
| 22 | 29 | ||
| @@ -75,6 +82,9 @@ typedef struct archive_handle_t { | |||
| 75 | char* tar__longname; | 82 | char* tar__longname; |
| 76 | char* tar__linkname; | 83 | char* tar__linkname; |
| 77 | # endif | 84 | # endif |
| 85 | #if ENABLE_FEATURE_TAR_TO_COMMAND | ||
| 86 | char* tar__to_command; | ||
| 87 | #endif | ||
| 78 | # if ENABLE_FEATURE_TAR_SELINUX | 88 | # if ENABLE_FEATURE_TAR_SELINUX |
| 79 | char* tar__global_sctx; | 89 | char* tar__global_sctx; |
| 80 | char* tar__next_file_sctx; | 90 | char* tar__next_file_sctx; |
| @@ -110,6 +120,39 @@ typedef struct archive_handle_t { | |||
| 110 | #define ARCHIVE_O_TRUNC (1 << 8) | 120 | #define ARCHIVE_O_TRUNC (1 << 8) |
| 111 | 121 | ||
| 112 | 122 | ||
| 123 | /* POSIX tar Header Block, from POSIX 1003.1-1990 */ | ||
| 124 | #define TAR_BLOCK_SIZE 512 | ||
| 125 | #define NAME_SIZE 100 | ||
| 126 | #define NAME_SIZE_STR "100" | ||
| 127 | typedef struct tar_header_t { /* byte offset */ | ||
| 128 | char name[NAME_SIZE]; /* 0-99 */ | ||
| 129 | char mode[8]; /* 100-107 */ | ||
| 130 | char uid[8]; /* 108-115 */ | ||
| 131 | char gid[8]; /* 116-123 */ | ||
| 132 | char size[12]; /* 124-135 */ | ||
| 133 | char mtime[12]; /* 136-147 */ | ||
| 134 | char chksum[8]; /* 148-155 */ | ||
| 135 | char typeflag; /* 156-156 */ | ||
| 136 | char linkname[NAME_SIZE]; /* 157-256 */ | ||
| 137 | /* POSIX: "ustar" NUL "00" */ | ||
| 138 | /* GNU tar: "ustar " NUL */ | ||
| 139 | /* Normally it's defined as magic[6] followed by | ||
| 140 | * version[2], but we put them together to save code. | ||
| 141 | */ | ||
| 142 | char magic[8]; /* 257-264 */ | ||
| 143 | char uname[32]; /* 265-296 */ | ||
| 144 | char gname[32]; /* 297-328 */ | ||
| 145 | char devmajor[8]; /* 329-336 */ | ||
| 146 | char devminor[8]; /* 337-344 */ | ||
| 147 | char prefix[155]; /* 345-499 */ | ||
| 148 | char padding[12]; /* 500-512 (pad to exactly TAR_BLOCK_SIZE) */ | ||
| 149 | } tar_header_t; | ||
| 150 | struct BUG_tar_header { | ||
| 151 | char c[sizeof(tar_header_t) == TAR_BLOCK_SIZE ? 1 : -1]; | ||
| 152 | }; | ||
| 153 | |||
| 154 | |||
| 155 | |||
| 113 | /* Info struct unpackers can fill out to inform users of thing like | 156 | /* Info struct unpackers can fill out to inform users of thing like |
| 114 | * timestamps of unpacked files */ | 157 | * timestamps of unpacked files */ |
| 115 | typedef struct unpack_info_t { | 158 | typedef struct unpack_info_t { |
| @@ -128,6 +171,7 @@ extern void unpack_ar_archive(archive_handle_t *ar_archive) FAST_FUNC; | |||
| 128 | extern void data_skip(archive_handle_t *archive_handle) FAST_FUNC; | 171 | extern void data_skip(archive_handle_t *archive_handle) FAST_FUNC; |
| 129 | extern void data_extract_all(archive_handle_t *archive_handle) FAST_FUNC; | 172 | extern void data_extract_all(archive_handle_t *archive_handle) FAST_FUNC; |
| 130 | extern void data_extract_to_stdout(archive_handle_t *archive_handle) FAST_FUNC; | 173 | extern void data_extract_to_stdout(archive_handle_t *archive_handle) FAST_FUNC; |
| 174 | extern void data_extract_to_command(archive_handle_t *archive_handle) FAST_FUNC; | ||
| 131 | 175 | ||
| 132 | extern void header_skip(const file_header_t *file_header) FAST_FUNC; | 176 | extern void header_skip(const file_header_t *file_header) FAST_FUNC; |
| 133 | extern void header_list(const file_header_t *file_header) FAST_FUNC; | 177 | extern void header_list(const file_header_t *file_header) FAST_FUNC; |
| @@ -159,7 +203,7 @@ typedef struct inflate_unzip_result { | |||
| 159 | } inflate_unzip_result; | 203 | } inflate_unzip_result; |
| 160 | 204 | ||
| 161 | IF_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; | 205 | IF_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; |
| 162 | /* xz unpacker takes .xz stream from offset 0 */ | 206 | /* xz unpacker takes .xz stream from offset 6 */ |
| 163 | IF_DESKTOP(long long) int unpack_xz_stream(int src_fd, int dst_fd) FAST_FUNC; | 207 | IF_DESKTOP(long long) int unpack_xz_stream(int src_fd, int dst_fd) FAST_FUNC; |
| 164 | /* lzma unpacker takes .lzma stream from offset 0 */ | 208 | /* lzma unpacker takes .lzma stream from offset 0 */ |
| 165 | IF_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC; | 209 | IF_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC; |
diff --git a/include/usage.src.h b/include/usage.src.h index f30edbc54..b3396006f 100644 --- a/include/usage.src.h +++ b/include/usage.src.h | |||
| @@ -119,12 +119,6 @@ INSERT | |||
| 119 | #define sh_full_usage "" | 119 | #define sh_full_usage "" |
| 120 | #define ash_trivial_usage NOUSAGE_STR | 120 | #define ash_trivial_usage NOUSAGE_STR |
| 121 | #define ash_full_usage "" | 121 | #define ash_full_usage "" |
| 122 | #define hush_trivial_usage NOUSAGE_STR | ||
| 123 | #define hush_full_usage "" | ||
| 124 | #define lash_trivial_usage NOUSAGE_STR | ||
| 125 | #define lash_full_usage "" | ||
| 126 | #define msh_trivial_usage NOUSAGE_STR | ||
| 127 | #define msh_full_usage "" | ||
| 128 | #define bash_trivial_usage NOUSAGE_STR | 122 | #define bash_trivial_usage NOUSAGE_STR |
| 129 | #define bash_full_usage "" | 123 | #define bash_full_usage "" |
| 130 | 124 | ||
| @@ -163,16 +157,6 @@ INSERT | |||
| 163 | #define blkid_full_usage "\n\n" \ | 157 | #define blkid_full_usage "\n\n" \ |
| 164 | "Print UUIDs of all filesystems" | 158 | "Print UUIDs of all filesystems" |
| 165 | 159 | ||
| 166 | #define bootchartd_trivial_usage \ | ||
| 167 | "start [PROG ARGS]|stop|init" | ||
| 168 | #define bootchartd_full_usage "\n\n" \ | ||
| 169 | "Create /var/log/bootchart.tgz with boot chart data\n" \ | ||
| 170 | "\nOptions:" \ | ||
| 171 | "\nstart: start background logging; with PROG, run PROG, then kill logging with USR1" \ | ||
| 172 | "\nstop: send USR1 to all bootchartd processes" \ | ||
| 173 | "\ninit: start background logging; stop when getty/xdm is seen (for init scripts)" \ | ||
| 174 | "\nUnder PID 1: as init, then exec $bootchart_init, /init, /sbin/init" \ | ||
| 175 | |||
| 176 | #define brctl_trivial_usage \ | 160 | #define brctl_trivial_usage \ |
| 177 | "COMMAND [BRIDGE [INTERFACE]]" | 161 | "COMMAND [BRIDGE [INTERFACE]]" |
| 178 | #define brctl_full_usage "\n\n" \ | 162 | #define brctl_full_usage "\n\n" \ |
| @@ -444,7 +428,7 @@ INSERT | |||
| 444 | " [-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N]\n" \ | 428 | " [-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N]\n" \ |
| 445 | " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" | 429 | " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" |
| 446 | #define chpst_full_usage "\n\n" \ | 430 | #define chpst_full_usage "\n\n" \ |
| 447 | "Change the process state and run PROG\n" \ | 431 | "Change the process state, run PROG\n" \ |
| 448 | "\nOptions:" \ | 432 | "\nOptions:" \ |
| 449 | "\n -u USER[:GRP] Set uid and gid" \ | 433 | "\n -u USER[:GRP] Set uid and gid" \ |
| 450 | "\n -U USER[:GRP] Set $UID and $GID in environment" \ | 434 | "\n -U USER[:GRP] Set $UID and $GID in environment" \ |
| @@ -467,17 +451,17 @@ INSERT | |||
| 467 | #define setuidgid_trivial_usage \ | 451 | #define setuidgid_trivial_usage \ |
| 468 | "USER PROG ARGS" | 452 | "USER PROG ARGS" |
| 469 | #define setuidgid_full_usage "\n\n" \ | 453 | #define setuidgid_full_usage "\n\n" \ |
| 470 | "Set uid and gid to USER's uid and gid, removing all supplementary\n" \ | 454 | "Set uid and gid to USER's uid and gid, drop supplementary group ids,\n" \ |
| 471 | "groups and run PROG" | 455 | "run PROG" |
| 472 | #define envuidgid_trivial_usage \ | 456 | #define envuidgid_trivial_usage \ |
| 473 | "USER PROG ARGS" | 457 | "USER PROG ARGS" |
| 474 | #define envuidgid_full_usage "\n\n" \ | 458 | #define envuidgid_full_usage "\n\n" \ |
| 475 | "Set $UID to USER's uid and $GID to USER's gid and run PROG" | 459 | "Set $UID to USER's uid and $GID to USER's gid, run PROG" |
| 476 | #define envdir_trivial_usage \ | 460 | #define envdir_trivial_usage \ |
| 477 | "DIR PROG ARGS" | 461 | "DIR PROG ARGS" |
| 478 | #define envdir_full_usage "\n\n" \ | 462 | #define envdir_full_usage "\n\n" \ |
| 479 | "Set various environment variables as specified by files\n" \ | 463 | "Set various environment variables as specified by files\n" \ |
| 480 | "in the directory dir and run PROG" | 464 | "in the directory DIR, run PROG" |
| 481 | #define softlimit_trivial_usage \ | 465 | #define softlimit_trivial_usage \ |
| 482 | "[-a BYTES] [-m BYTES] [-d BYTES] [-s BYTES] [-l BYTES]\n" \ | 466 | "[-a BYTES] [-m BYTES] [-d BYTES] [-s BYTES] [-l BYTES]\n" \ |
| 483 | " [-f BYTES] [-c BYTES] [-r BYTES] [-o N] [-p N] [-t N]\n" \ | 467 | " [-f BYTES] [-c BYTES] [-r BYTES] [-o N] [-p N] [-t N]\n" \ |
| @@ -548,24 +532,49 @@ INSERT | |||
| 548 | #define bbconfig_trivial_usage \ | 532 | #define bbconfig_trivial_usage \ |
| 549 | "" | 533 | "" |
| 550 | #define bbconfig_full_usage "\n\n" \ | 534 | #define bbconfig_full_usage "\n\n" \ |
| 551 | "Print the config file which built busybox" | 535 | "Print the config file used by busybox build" |
| 552 | 536 | ||
| 553 | #define chrt_trivial_usage \ | 537 | #define chrt_trivial_usage \ |
| 554 | "[OPTIONS] [PRIO] [PID | PROG ARGS]" | 538 | "[OPTIONS] [PRIO] [PID | PROG ARGS]" |
| 555 | #define chrt_full_usage "\n\n" \ | 539 | #define chrt_full_usage "\n\n" \ |
| 556 | "Manipulate real-time attributes of a process\n" \ | 540 | "Change scheduling priority and class for a process\n" \ |
| 557 | "\nOptions:" \ | 541 | "\nOptions:" \ |
| 558 | "\n -p Operate on PID" \ | 542 | "\n -p Operate on PID" \ |
| 559 | "\n -r Set SCHED_RR scheduling" \ | 543 | "\n -r Set SCHED_RR class" \ |
| 560 | "\n -f Set SCHED_FIFO scheduling" \ | 544 | "\n -f Set SCHED_FIFO class" \ |
| 561 | "\n -o Set SCHED_OTHER scheduling" \ | 545 | "\n -o Set SCHED_OTHER class" \ |
| 562 | "\n -m Show min and max priorities" \ | 546 | "\n -m Show min/max priorities" \ |
| 563 | 547 | ||
| 564 | #define chrt_example_usage \ | 548 | #define chrt_example_usage \ |
| 565 | "$ chrt -r 4 sleep 900; x=$!\n" \ | 549 | "$ chrt -r 4 sleep 900; x=$!\n" \ |
| 566 | "$ chrt -f -p 3 $x\n" \ | 550 | "$ chrt -f -p 3 $x\n" \ |
| 567 | "You need CAP_SYS_NICE privileges to set scheduling attributes of a process" | 551 | "You need CAP_SYS_NICE privileges to set scheduling attributes of a process" |
| 568 | 552 | ||
| 553 | #define nice_trivial_usage \ | ||
| 554 | "[-n ADJUST] [PROG ARGS]" | ||
| 555 | #define nice_full_usage "\n\n" \ | ||
| 556 | "Change scheduling priority, run PROG\n" \ | ||
| 557 | "\nOptions:" \ | ||
| 558 | "\n -n ADJUST Adjust priority by ADJUST" \ | ||
| 559 | |||
| 560 | #define renice_trivial_usage \ | ||
| 561 | "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" | ||
| 562 | #define renice_full_usage "\n\n" \ | ||
| 563 | "Change scheduling priority for a running process\n" \ | ||
| 564 | "\nOptions:" \ | ||
| 565 | "\n -n Adjust current nice value (smaller is faster)" \ | ||
| 566 | "\n -p Process id(s) (default)" \ | ||
| 567 | "\n -g Process group id(s)" \ | ||
| 568 | "\n -u Process user name(s) and/or id(s)" \ | ||
| 569 | |||
| 570 | #define ionice_trivial_usage \ | ||
| 571 | "[-c 1-3] [-n 0-7] [-p PID] [PROG]" | ||
| 572 | #define ionice_full_usage "\n\n" \ | ||
| 573 | "Change I/O priority and class\n" \ | ||
| 574 | "\nOptions:" \ | ||
| 575 | "\n -c Class. 1:realtime 2:best-effort 3:idle" \ | ||
| 576 | "\n -n Priority" \ | ||
| 577 | |||
| 569 | #define cp_trivial_usage \ | 578 | #define cp_trivial_usage \ |
| 570 | "[OPTIONS] SOURCE DEST" | 579 | "[OPTIONS] SOURCE DEST" |
| 571 | #define cp_full_usage "\n\n" \ | 580 | #define cp_full_usage "\n\n" \ |
| @@ -1309,7 +1318,7 @@ INSERT | |||
| 1309 | #define flock_trivial_usage \ | 1318 | #define flock_trivial_usage \ |
| 1310 | "[-sxun] FD|{FILE [-c] PROG ARGS}" | 1319 | "[-sxun] FD|{FILE [-c] PROG ARGS}" |
| 1311 | #define flock_full_usage "\n\n" \ | 1320 | #define flock_full_usage "\n\n" \ |
| 1312 | "[Un]lock file descriptor, or lock FILE and run PROG\n" \ | 1321 | "[Un]lock file descriptor, or lock FILE, run PROG\n" \ |
| 1313 | "\nOptions:" \ | 1322 | "\nOptions:" \ |
| 1314 | "\n -s Shared lock" \ | 1323 | "\n -s Shared lock" \ |
| 1315 | "\n -x Exclusive lock (default)" \ | 1324 | "\n -x Exclusive lock (default)" \ |
| @@ -2048,14 +2057,6 @@ INSERT | |||
| 2048 | "\n -Z Set security context" \ | 2057 | "\n -Z Set security context" \ |
| 2049 | ) | 2058 | ) |
| 2050 | 2059 | ||
| 2051 | #define ionice_trivial_usage \ | ||
| 2052 | "[-c 1-3] [-n 0-7] [-p PID] [PROG]" | ||
| 2053 | #define ionice_full_usage "\n\n" \ | ||
| 2054 | "Change I/O scheduling class and priority\n" \ | ||
| 2055 | "\nOptions:" \ | ||
| 2056 | "\n -c Class. 1:realtime 2:best-effort 3:idle" \ | ||
| 2057 | "\n -n Priority" \ | ||
| 2058 | |||
| 2059 | /* would need to make the " | " optional depending on more than one selected: */ | 2060 | /* would need to make the " | " optional depending on more than one selected: */ |
| 2060 | #define ip_trivial_usage \ | 2061 | #define ip_trivial_usage \ |
| 2061 | "[OPTIONS] {" \ | 2062 | "[OPTIONS] {" \ |
| @@ -2954,84 +2955,6 @@ INSERT | |||
| 2954 | " or\n" \ | 2955 | " or\n" \ |
| 2955 | "$ nameif -c /etc/my_mactab_file\n" \ | 2956 | "$ nameif -c /etc/my_mactab_file\n" \ |
| 2956 | 2957 | ||
| 2957 | #if !ENABLE_DESKTOP | ||
| 2958 | |||
| 2959 | #if ENABLE_NC_SERVER || ENABLE_NC_EXTRA | ||
| 2960 | #define NC_OPTIONS_STR "\n\nOptions:" | ||
| 2961 | #else | ||
| 2962 | #define NC_OPTIONS_STR | ||
| 2963 | #endif | ||
| 2964 | |||
| 2965 | #define nc_trivial_usage \ | ||
| 2966 | IF_NC_EXTRA("[-iN] [-wN] ")IF_NC_SERVER("[-l] [-p PORT] ") \ | ||
| 2967 | "["IF_NC_EXTRA("-f FILENAME|")"IPADDR PORT]"IF_NC_EXTRA(" [-e PROG]") | ||
| 2968 | #define nc_full_usage "\n\n" \ | ||
| 2969 | "Open a pipe to IP:port" IF_NC_EXTRA(" or file") \ | ||
| 2970 | NC_OPTIONS_STR \ | ||
| 2971 | IF_NC_EXTRA( \ | ||
| 2972 | "\n -e PROG Run PROG after connect" \ | ||
| 2973 | "\n -i SEC Delay interval for lines sent" \ | ||
| 2974 | "\n -w SEC Timeout for connect" \ | ||
| 2975 | "\n -f FILE Use file (ala /dev/ttyS0) instead of network" \ | ||
| 2976 | ) \ | ||
| 2977 | IF_NC_SERVER( \ | ||
| 2978 | "\n -l Listen mode, for inbound connects" \ | ||
| 2979 | IF_NC_EXTRA( \ | ||
| 2980 | "\n (use -l twice with -e for persistent server)") \ | ||
| 2981 | "\n -p PORT Local port" \ | ||
| 2982 | ) | ||
| 2983 | |||
| 2984 | #define nc_notes_usage "" \ | ||
| 2985 | IF_NC_EXTRA( \ | ||
| 2986 | "To use netcat as a terminal emulator on a serial port:\n\n" \ | ||
| 2987 | "$ stty 115200 -F /dev/ttyS0\n" \ | ||
| 2988 | "$ stty raw -echo -ctlecho && nc -f /dev/ttyS0\n" \ | ||
| 2989 | ) | ||
| 2990 | |||
| 2991 | #define nc_example_usage \ | ||
| 2992 | "$ nc foobar.somedomain.com 25\n" \ | ||
| 2993 | "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \ | ||
| 2994 | "help\n" \ | ||
| 2995 | "214-Commands supported:\n" \ | ||
| 2996 | "214- HELO EHLO MAIL RCPT DATA AUTH\n" \ | ||
| 2997 | "214 NOOP QUIT RSET HELP\n" \ | ||
| 2998 | "quit\n" \ | ||
| 2999 | "221 foobar closing connection\n" | ||
| 3000 | |||
| 3001 | #else /* DESKTOP nc - much more compatible with nc 1.10 */ | ||
| 3002 | |||
| 3003 | #define nc_trivial_usage \ | ||
| 3004 | "[OPTIONS] HOST PORT - connect" \ | ||
| 3005 | IF_NC_SERVER("\n" \ | ||
| 3006 | "nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen") | ||
| 3007 | #define nc_full_usage "\n\n" \ | ||
| 3008 | "Options:" \ | ||
| 3009 | "\n -e PROG Run PROG after connect (must be last)" \ | ||
| 3010 | IF_NC_SERVER( \ | ||
| 3011 | "\n -l Listen mode, for inbound connects" \ | ||
| 3012 | ) \ | ||
| 3013 | "\n -n Don't do DNS resolution" \ | ||
| 3014 | "\n -s ADDR Local address" \ | ||
| 3015 | "\n -p PORT Local port" \ | ||
| 3016 | "\n -u UDP mode" \ | ||
| 3017 | "\n -v Verbose" \ | ||
| 3018 | "\n -w SEC Timeout for connects and final net reads" \ | ||
| 3019 | IF_NC_EXTRA( \ | ||
| 3020 | "\n -i SEC Delay interval for lines sent" /* ", ports scanned" */ \ | ||
| 3021 | "\n -o FILE Hex dump traffic" \ | ||
| 3022 | "\n -z Zero-I/O mode (scanning)" \ | ||
| 3023 | ) \ | ||
| 3024 | /* "\n -r Randomize local and remote ports" */ | ||
| 3025 | /* "\n -g gateway Source-routing hop point[s], up to 8" */ | ||
| 3026 | /* "\n -G num Source-routing pointer: 4, 8, 12, ..." */ | ||
| 3027 | /* "\nport numbers can be individual or ranges: lo-hi [inclusive]" */ | ||
| 3028 | |||
| 3029 | /* -e PROG can take ARGS too: "nc ... -e ls -l", but we don't document it | ||
| 3030 | * in help text: nc 1.10 does not allow that. We don't want to entice | ||
| 3031 | * users to use this incompatibility */ | ||
| 3032 | |||
| 3033 | #endif | ||
| 3034 | |||
| 3035 | #define netstat_trivial_usage \ | 2958 | #define netstat_trivial_usage \ |
| 3036 | "[-laentuwxr"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]" | 2959 | "[-laentuwxr"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]" |
| 3037 | #define netstat_full_usage "\n\n" \ | 2960 | #define netstat_full_usage "\n\n" \ |
| @@ -3053,13 +2976,6 @@ INSERT | |||
| 3053 | "\n -p Display PID/Program name for sockets" \ | 2976 | "\n -p Display PID/Program name for sockets" \ |
| 3054 | ) | 2977 | ) |
| 3055 | 2978 | ||
| 3056 | #define nice_trivial_usage \ | ||
| 3057 | "[-n ADJUST] [PROG ARGS]" | ||
| 3058 | #define nice_full_usage "\n\n" \ | ||
| 3059 | "Run PROG with modified scheduling priority\n" \ | ||
| 3060 | "\nOptions:" \ | ||
| 3061 | "\n -n ADJUST Adjust priority by ADJUST" \ | ||
| 3062 | |||
| 3063 | #define nmeter_trivial_usage \ | 2979 | #define nmeter_trivial_usage \ |
| 3064 | "format_string" | 2980 | "format_string" |
| 3065 | #define nmeter_full_usage "\n\n" \ | 2981 | #define nmeter_full_usage "\n\n" \ |
| @@ -3513,16 +3429,6 @@ INSERT | |||
| 3513 | "\n" \ | 3429 | "\n" \ |
| 3514 | "\nOther options are silently ignored" \ | 3430 | "\nOther options are silently ignored" \ |
| 3515 | 3431 | ||
| 3516 | #define renice_trivial_usage \ | ||
| 3517 | "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" | ||
| 3518 | #define renice_full_usage "\n\n" \ | ||
| 3519 | "Change priority of running processes\n" \ | ||
| 3520 | "\nOptions:" \ | ||
| 3521 | "\n -n Adjust current nice value (smaller is faster)" \ | ||
| 3522 | "\n -p Process id(s) (default)" \ | ||
| 3523 | "\n -g Process group id(s)" \ | ||
| 3524 | "\n -u Process user name(s) and/or id(s)" \ | ||
| 3525 | |||
| 3526 | #define scriptreplay_trivial_usage \ | 3432 | #define scriptreplay_trivial_usage \ |
| 3527 | "timingfile [typescript [divisor]]" | 3433 | "timingfile [typescript [divisor]]" |
| 3528 | #define scriptreplay_full_usage "\n\n" \ | 3434 | #define scriptreplay_full_usage "\n\n" \ |
| @@ -4273,54 +4179,6 @@ INSERT | |||
| 4273 | #define tac_full_usage "\n\n" \ | 4179 | #define tac_full_usage "\n\n" \ |
| 4274 | "Concatenate FILEs and print them in reverse" | 4180 | "Concatenate FILEs and print them in reverse" |
| 4275 | 4181 | ||
| 4276 | #define tar_trivial_usage \ | ||
| 4277 | "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \ | ||
| 4278 | IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \ | ||
| 4279 | IF_FEATURE_SEAMLESS_Z("Z") IF_FEATURE_TAR_NOPRESERVE_TIME("m") "vO] " \ | ||
| 4280 | IF_FEATURE_TAR_FROM("[-X FILE] ") \ | ||
| 4281 | "[-f TARFILE] [-C DIR] [FILE]..." | ||
| 4282 | #define tar_full_usage "\n\n" \ | ||
| 4283 | IF_FEATURE_TAR_CREATE("Create, extract, ") \ | ||
| 4284 | IF_NOT_FEATURE_TAR_CREATE("Extract ") \ | ||
| 4285 | "or list files from a tar file\n" \ | ||
| 4286 | "\nOptions:" \ | ||
| 4287 | IF_FEATURE_TAR_CREATE( \ | ||
| 4288 | "\n c Create" \ | ||
| 4289 | ) \ | ||
| 4290 | "\n x Extract" \ | ||
| 4291 | "\n t List" \ | ||
| 4292 | "\nArchive format selection:" \ | ||
| 4293 | IF_FEATURE_SEAMLESS_GZ( \ | ||
| 4294 | "\n z Filter the archive through gzip" \ | ||
| 4295 | ) \ | ||
| 4296 | IF_FEATURE_SEAMLESS_BZ2( \ | ||
| 4297 | "\n j Filter the archive through bzip2" \ | ||
| 4298 | ) \ | ||
| 4299 | IF_FEATURE_SEAMLESS_LZMA( \ | ||
| 4300 | "\n a Filter the archive through lzma" \ | ||
| 4301 | ) \ | ||
| 4302 | IF_FEATURE_SEAMLESS_Z( \ | ||
| 4303 | "\n Z Filter the archive through compress" \ | ||
| 4304 | ) \ | ||
| 4305 | IF_FEATURE_TAR_NOPRESERVE_TIME( \ | ||
| 4306 | "\n m Do not restore mtime" \ | ||
| 4307 | ) \ | ||
| 4308 | "\nFile selection:" \ | ||
| 4309 | "\n f Name of TARFILE or \"-\" for stdin" \ | ||
| 4310 | "\n O Extract to stdout" \ | ||
| 4311 | IF_FEATURE_TAR_FROM( \ | ||
| 4312 | IF_FEATURE_TAR_LONG_OPTIONS( \ | ||
| 4313 | "\n exclude File to exclude" \ | ||
| 4314 | ) \ | ||
| 4315 | "\n X File with names to exclude" \ | ||
| 4316 | ) \ | ||
| 4317 | "\n C Change to DIR before operation" \ | ||
| 4318 | "\n v Verbose" \ | ||
| 4319 | |||
| 4320 | #define tar_example_usage \ | ||
| 4321 | "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \ | ||
| 4322 | "$ tar -cf /tmp/tarball.tar /usr/local\n" | ||
| 4323 | |||
| 4324 | #define taskset_trivial_usage \ | 4182 | #define taskset_trivial_usage \ |
| 4325 | "[-p] [MASK] [PID | PROG ARGS]" | 4183 | "[-p] [MASK] [PID | PROG ARGS]" |
| 4326 | #define taskset_full_usage "\n\n" \ | 4184 | #define taskset_full_usage "\n\n" \ |
