diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.src.h | 51 | ||||
-rw-r--r-- | include/libbb.h | 7 | ||||
-rw-r--r-- | include/platform.h | 16 |
3 files changed, 43 insertions, 31 deletions
diff --git a/include/applets.src.h b/include/applets.src.h index 7dbd4c7f3..cb36628b5 100644 --- a/include/applets.src.h +++ b/include/applets.src.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | /* | 9 | /* |
10 | name - applet name as it is typed on command line | 10 | name - applet name as it is typed on command line |
11 | name2 - applet name, converted to C (ether-wake: name2 = ether_wake) | 11 | help - applet name, converted to C (ether-wake: help = ether_wake) |
12 | main - corresponding <applet>_main to call (bzcat: main = bunzip2) | 12 | main - corresponding <applet>_main to call (bzcat: main = bunzip2) |
13 | l - location to install link to: [/usr]/[s]bin | 13 | l - location to install link to: [/usr]/[s]bin |
14 | s - suid type: | 14 | s - suid type: |
@@ -24,46 +24,46 @@ s - suid type: | |||
24 | 24 | ||
25 | #if defined(PROTOTYPES) | 25 | #if defined(PROTOTYPES) |
26 | # define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 26 | # define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
27 | # define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 27 | # define APPLET_ODDNAME(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
28 | # define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 28 | # define APPLET_NOEXEC(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
29 | # define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 29 | # define APPLET_NOFORK(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
30 | 30 | ||
31 | #elif defined(NAME_MAIN_CNAME) | 31 | #elif defined(NAME_MAIN) |
32 | # define APPLET(name,l,s) name name##_main name | 32 | # define APPLET(name,l,s) name name##_main |
33 | # define APPLET_ODDNAME(name,main,l,s,name2) name main##_main name2 | 33 | # define APPLET_ODDNAME(name,main,l,s,help) name main##_main |
34 | # define APPLET_NOEXEC(name,main,l,s,name2) name main##_main name2 | 34 | # define APPLET_NOEXEC(name,main,l,s,help) name main##_main |
35 | # define APPLET_NOFORK(name,main,l,s,name2) name main##_main name2 | 35 | # define APPLET_NOFORK(name,main,l,s,help) name main##_main |
36 | 36 | ||
37 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE | 37 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE |
38 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage) | 38 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage) |
39 | # define APPLET_ODDNAME(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage) | 39 | # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage) |
40 | # define APPLET_NOEXEC(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage) | 40 | # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage) |
41 | # define APPLET_NOFORK(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage) | 41 | # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage) |
42 | 42 | ||
43 | #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE | 43 | #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE |
44 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage) | 44 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage) |
45 | # define APPLET_ODDNAME(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage) | 45 | # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage) |
46 | # define APPLET_NOEXEC(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage) | 46 | # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage) |
47 | # define APPLET_NOFORK(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage) | 47 | # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage) |
48 | 48 | ||
49 | #elif defined(MAKE_LINKS) | 49 | #elif defined(MAKE_LINKS) |
50 | # define APPLET(name,l,c) LINK l name | 50 | # define APPLET(name,l,c) LINK l name |
51 | # define APPLET_ODDNAME(name,main,l,s,name2) LINK l name | 51 | # define APPLET_ODDNAME(name,main,l,s,help) LINK l name |
52 | # define APPLET_NOEXEC(name,main,l,s,name2) LINK l name | 52 | # define APPLET_NOEXEC(name,main,l,s,help) LINK l name |
53 | # define APPLET_NOFORK(name,main,l,s,name2) LINK l name | 53 | # define APPLET_NOFORK(name,main,l,s,help) LINK l name |
54 | 54 | ||
55 | #elif defined(MAKE_SUID) | 55 | #elif defined(MAKE_SUID) |
56 | # define APPLET(name,l,s) SUID s l name | 56 | # define APPLET(name,l,s) SUID s l name |
57 | # define APPLET_ODDNAME(name,main,l,s,name2) SUID s l name | 57 | # define APPLET_ODDNAME(name,main,l,s,help) SUID s l name |
58 | # define APPLET_NOEXEC(name,main,l,s,name2) SUID s l name | 58 | # define APPLET_NOEXEC(name,main,l,s,help) SUID s l name |
59 | # define APPLET_NOFORK(name,main,l,s,name2) SUID s l name | 59 | # define APPLET_NOFORK(name,main,l,s,help) SUID s l name |
60 | 60 | ||
61 | #else | 61 | #else |
62 | static struct bb_applet applets[] = { /* name, main, location, need_suid */ | 62 | static struct bb_applet applets[] = { /* name, main, location, need_suid */ |
63 | # define APPLET(name,l,s) { #name, #name, l, s }, | 63 | # define APPLET(name,l,s) { #name, #name, l, s }, |
64 | # define APPLET_ODDNAME(name,main,l,s,name2) { #name, #main, l, s }, | 64 | # define APPLET_ODDNAME(name,main,l,s,help) { #name, #main, l, s }, |
65 | # define APPLET_NOEXEC(name,main,l,s,name2) { #name, #main, l, s, 1 }, | 65 | # define APPLET_NOEXEC(name,main,l,s,help) { #name, #main, l, s, 1 }, |
66 | # define APPLET_NOFORK(name,main,l,s,name2) { #name, #main, l, s, 1, 1 }, | 66 | # define APPLET_NOFORK(name,main,l,s,help) { #name, #main, l, s, 1, 1 }, |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | #if ENABLE_INSTALL_NO_USR | 69 | #if ENABLE_INSTALL_NO_USR |
@@ -104,7 +104,6 @@ IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum)) | |||
104 | IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP)) | 104 | IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP)) |
105 | IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP)) | 105 | IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP)) |
106 | IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp)) | 106 | IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp)) |
107 | IF_CROND(APPLET(crond, BB_DIR_USR_SBIN, BB_SUID_DROP)) | ||
108 | /* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */ | 107 | /* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */ |
109 | IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) | 108 | IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) |
110 | IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP)) | 109 | IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP)) |
@@ -391,7 +390,7 @@ IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami)) | |||
391 | IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes)) | 390 | IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes)) |
392 | IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP)) | 391 | IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP)) |
393 | 392 | ||
394 | #if !defined(PROTOTYPES) && !defined(NAME_MAIN_CNAME) && !defined(MAKE_USAGE) \ | 393 | #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ |
395 | && !defined(MAKE_LINKS) && !defined(MAKE_SUID) | 394 | && !defined(MAKE_LINKS) && !defined(MAKE_SUID) |
396 | }; | 395 | }; |
397 | #endif | 396 | #endif |
diff --git a/include/libbb.h b/include/libbb.h index 3b2bf0a0a..c80cd80d7 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -928,9 +928,9 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const | |||
928 | #endif | 928 | #endif |
929 | 929 | ||
930 | 930 | ||
931 | int execable_file(const char *name) FAST_FUNC; | 931 | int file_is_executable(const char *name) FAST_FUNC; |
932 | char *find_execable(const char *filename, char **PATHp) FAST_FUNC; | 932 | char *find_executable(const char *filename, char **PATHp) FAST_FUNC; |
933 | int exists_execable(const char *filename) FAST_FUNC; | 933 | int executable_exists(const char *filename) FAST_FUNC; |
934 | 934 | ||
935 | /* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff), | 935 | /* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff), |
936 | * but it may exec busybox and call applet instead of searching PATH. | 936 | * but it may exec busybox and call applet instead of searching PATH. |
@@ -1090,6 +1090,7 @@ enum { | |||
1090 | LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, | 1090 | LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, |
1091 | }; | 1091 | }; |
1092 | extern const char *msg_eol; | 1092 | extern const char *msg_eol; |
1093 | extern smallint syslog_level; | ||
1093 | extern smallint logmode; | 1094 | extern smallint logmode; |
1094 | extern int die_sleep; | 1095 | extern int die_sleep; |
1095 | extern uint8_t xfunc_error_retval; | 1096 | extern uint8_t xfunc_error_retval; |
diff --git a/include/platform.h b/include/platform.h index 515ef031f..884c6e95f 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -390,6 +390,7 @@ typedef unsigned smalluint; | |||
390 | #define HAVE_STRSIGNAL 1 | 390 | #define HAVE_STRSIGNAL 1 |
391 | #define HAVE_STRVERSCMP 1 | 391 | #define HAVE_STRVERSCMP 1 |
392 | #define HAVE_VASPRINTF 1 | 392 | #define HAVE_VASPRINTF 1 |
393 | #define HAVE_USLEEP 1 | ||
393 | #define HAVE_UNLOCKED_STDIO 1 | 394 | #define HAVE_UNLOCKED_STDIO 1 |
394 | #define HAVE_UNLOCKED_LINE_OPS 1 | 395 | #define HAVE_UNLOCKED_LINE_OPS 1 |
395 | #define HAVE_GETLINE 1 | 396 | #define HAVE_GETLINE 1 |
@@ -398,8 +399,15 @@ typedef unsigned smalluint; | |||
398 | #define HAVE_NET_ETHERNET_H 1 | 399 | #define HAVE_NET_ETHERNET_H 1 |
399 | #define HAVE_SYS_STATFS_H 1 | 400 | #define HAVE_SYS_STATFS_H 1 |
400 | 401 | ||
401 | #if defined(__UCLIBC__) && UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32) | 402 | #if defined(__UCLIBC__) |
402 | # undef HAVE_STRVERSCMP | 403 | # if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32) |
404 | # undef HAVE_STRVERSCMP | ||
405 | # endif | ||
406 | # if UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30) | ||
407 | # ifndef __UCLIBC_SUSV3_LEGACY__ | ||
408 | # undef HAVE_USLEEP | ||
409 | # endif | ||
410 | # endif | ||
403 | #endif | 411 | #endif |
404 | 412 | ||
405 | #if ENABLE_PLATFORM_MINGW32 | 413 | #if ENABLE_PLATFORM_MINGW32 |
@@ -554,6 +562,10 @@ extern char *strsep(char **stringp, const char *delim) FAST_FUNC; | |||
554 | # define strsignal(sig) get_signame(sig) | 562 | # define strsignal(sig) get_signame(sig) |
555 | #endif | 563 | #endif |
556 | 564 | ||
565 | #ifndef HAVE_USLEEP | ||
566 | extern int usleep(unsigned) FAST_FUNC; | ||
567 | #endif | ||
568 | |||
557 | #ifndef HAVE_VASPRINTF | 569 | #ifndef HAVE_VASPRINTF |
558 | # include <stdarg.h> | 570 | # include <stdarg.h> |
559 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 571 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |