aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 13:15:08 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 13:15:08 +0000
commitc0d4367d6b581eb5989c02815880cf0fa2851ae8 (patch)
tree868c266e627e2d7f65ba5a4d5f98a1c421453181 /include
parentf6bad5ef766b0447158e3de2f55c35f1f6cecb58 (diff)
parentda4441c44f6efccb6f7b7588404d9c6bfb7b6af8 (diff)
downloadbusybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.gz
busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.bz2
busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.zip
Merge commit 'da4441c44f6efccb6f7b7588404d9c6bfb7b6af8' into merge
Conflicts: libbb/vfork_daemon_rexec.c networking/wget.c procps/ps.c
Diffstat (limited to 'include')
-rw-r--r--include/applets.src.h2
-rw-r--r--include/archive.h20
-rw-r--r--include/libbb.h57
-rw-r--r--include/platform.h12
-rw-r--r--include/usage.src.h20
5 files changed, 52 insertions, 59 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index fa7d0cc55..133f376a3 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -211,7 +211,7 @@ IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
211IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall5)) 211IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall5))
212IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP)) 212IF_KLOGD(APPLET(klogd, BB_DIR_SBIN, BB_SUID_DROP))
213IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP)) 213IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP))
214IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length)) 214//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
215IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP)) 215IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP))
216IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) 216IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32))
217IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) 217IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64))
diff --git a/include/archive.h b/include/archive.h
index ba6d323e0..49c478728 100644
--- a/include/archive.h
+++ b/include/archive.h
@@ -8,22 +8,22 @@ 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' * 256 + 'Z', 11 BZIP2_MAGIC = 256 * 'B' + 'Z',
12 /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */ 12 /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
13 /* More info at: http://tukaani.org/xz/xz-file-format.txt */ 13 /* More info at: http://tukaani.org/xz/xz-file-format.txt */
14 XZ_MAGIC1 = 0xfd * 256 + '7', 14 XZ_MAGIC1 = 256 * 0xfd + '7',
15 XZ_MAGIC2 = (('z' * 256 + 'X') * 256 + 'Z') * 256 + 0, 15 XZ_MAGIC2 = 256 * (256 * (256 * 'z' + 'X') + 'Z') + 0,
16 /* Different form: 32 bits, then 16 bits: */ 16 /* Different form: 32 bits, then 16 bits: */
17 XZ_MAGIC1a = ((0xfd * 256 + '7') * 256 + 'z') * 256 + 'X', 17 XZ_MAGIC1a = 256 * (256 * (256 * 0xfd + '7') + 'z') + 'X',
18 XZ_MAGIC2a = 'Z' * 256 + 0, 18 XZ_MAGIC2a = 256 * 'Z' + 0,
19#else 19#else
20 COMPRESS_MAGIC = 0x9d1f, 20 COMPRESS_MAGIC = 0x9d1f,
21 GZIP_MAGIC = 0x8b1f, 21 GZIP_MAGIC = 0x8b1f,
22 BZIP2_MAGIC = 'Z' * 256 + 'B', 22 BZIP2_MAGIC = 'B' + 'Z' * 256,
23 XZ_MAGIC1 = '7' * 256 + 0xfd, 23 XZ_MAGIC1 = 0xfd + '7' * 256,
24 XZ_MAGIC2 = ((0 * 256 + 'Z') * 256 + 'X') * 256 + 'z', 24 XZ_MAGIC2 = 'z' + ('X' + ('Z' + 0 * 256) * 256) * 256,
25 XZ_MAGIC1a = (('X' * 256 + 'z') * 256 + '7') * 256 + 0xfd, 25 XZ_MAGIC1a = 0xfd + ('7' + ('z' + 'X' * 256) * 256) * 256,
26 XZ_MAGIC2a = 0 * 256 + 'Z', 26 XZ_MAGIC2a = 'Z' + 0 * 256,
27#endif 27#endif
28}; 28};
29 29
diff --git a/include/libbb.h b/include/libbb.h
index 7efa32349..6564038e9 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -33,10 +33,12 @@
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <sys/time.h> 34#include <sys/time.h>
35#include <sys/types.h> 35#include <sys/types.h>
36#ifndef major
37# include <sys/sysmacros.h>
38#endif
36#include <sys/wait.h> 39#include <sys/wait.h>
37#include <termios.h> 40#include <termios.h>
38#include <time.h> 41#include <time.h>
39#include <unistd.h>
40#include <sys/param.h> 42#include <sys/param.h>
41#ifdef HAVE_MNTENT_H 43#ifdef HAVE_MNTENT_H
42# include <mntent.h> 44# include <mntent.h>
@@ -875,6 +877,7 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const
875# define update_utmp(pid, new_type, tty_name, username, hostname) ((void)0) 877# define update_utmp(pid, new_type, tty_name, username, hostname) ((void)0)
876#endif 878#endif
877 879
880
878int execable_file(const char *name) FAST_FUNC; 881int execable_file(const char *name) FAST_FUNC;
879char *find_execable(const char *filename, char **PATHp) FAST_FUNC; 882char *find_execable(const char *filename, char **PATHp) FAST_FUNC;
880int exists_execable(const char *filename) FAST_FUNC; 883int exists_execable(const char *filename) FAST_FUNC;
@@ -883,14 +886,16 @@ int exists_execable(const char *filename) FAST_FUNC;
883 * but it may exec busybox and call applet instead of searching PATH. 886 * but it may exec busybox and call applet instead of searching PATH.
884 */ 887 */
885#if ENABLE_FEATURE_PREFER_APPLETS 888#if ENABLE_FEATURE_PREFER_APPLETS
886int bb_execvp(const char *file, char *const argv[]) FAST_FUNC; 889int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
887#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
888#define BB_EXECLP(prog,cmd,...) \ 890#define BB_EXECLP(prog,cmd,...) \
889 execlp((find_applet_by_name(prog) >= 0) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \ 891 do { \
890 cmd, __VA_ARGS__) 892 if (find_applet_by_name(prog) >= 0) \
893 execlp(bb_busybox_exec_path, cmd, __VA_ARGS__); \
894 execlp(prog, cmd, __VA_ARGS__); \
895 } while (0)
891#else 896#else
892#define BB_EXECVP(prog,cmd) execvp(prog,cmd) 897#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
893#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) 898#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
894#endif 899#endif
895int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; 900int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
896 901
@@ -924,19 +929,8 @@ pid_t wait_any_nohang(int *wstat) FAST_FUNC;
924int wait4pid(pid_t pid) FAST_FUNC; 929int wait4pid(pid_t pid) FAST_FUNC;
925/* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */ 930/* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */
926int spawn_and_wait(char **argv) FAST_FUNC; 931int spawn_and_wait(char **argv) FAST_FUNC;
927struct nofork_save_area {
928 jmp_buf die_jmp;
929 const char *applet_name;
930 uint32_t option_mask32;
931 int die_sleep;
932 uint8_t xfunc_error_retval;
933 smallint saved;
934};
935void save_nofork_data(struct nofork_save_area *save) FAST_FUNC;
936void restore_nofork_data(struct nofork_save_area *save) FAST_FUNC;
937/* Does NOT check that applet is NOFORK, just blindly runs it */ 932/* Does NOT check that applet is NOFORK, just blindly runs it */
938int run_nofork_applet(int applet_no, char **argv) FAST_FUNC; 933int run_nofork_applet(int applet_no, char **argv) FAST_FUNC;
939int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv) FAST_FUNC;
940 934
941/* Helpers for daemonization. 935/* Helpers for daemonization.
942 * 936 *
@@ -1417,17 +1411,18 @@ enum {
1417}; 1411};
1418line_input_t *new_line_input_t(int flags) FAST_FUNC; 1412line_input_t *new_line_input_t(int flags) FAST_FUNC;
1419/* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ 1413/* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
1420/* maxsize must be >= 2. 1414/*
1415 * maxsize must be >= 2.
1421 * Returns: 1416 * Returns:
1422 * -1 on read errors or EOF, or on bare Ctrl-D, 1417 * -1 on read errors or EOF, or on bare Ctrl-D,
1423 * 0 on ctrl-C (the line entered is still returned in 'command'), 1418 * 0 on ctrl-C (the line entered is still returned in 'command'),
1424 * >0 length of input string, including terminating '\n' 1419 * >0 length of input string, including terminating '\n'
1425 */ 1420 */
1426int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state) FAST_FUNC; 1421int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) FAST_FUNC;
1427#else 1422#else
1428#define MAX_HISTORY 0 1423#define MAX_HISTORY 0
1429int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; 1424int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC;
1430#define read_line_input(prompt, command, maxsize, state) \ 1425#define read_line_input(state, prompt, command, maxsize, timeout) \
1431 read_line_input(prompt, command, maxsize) 1426 read_line_input(prompt, command, maxsize)
1432#endif 1427#endif
1433 1428
@@ -1608,16 +1603,24 @@ int print_flags_separated(const int *masks, const char *labels,
1608int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC; 1603int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC;
1609 1604
1610typedef struct bb_progress_t { 1605typedef struct bb_progress_t {
1611 off_t lastsize; 1606 unsigned last_size;
1612 unsigned lastupdate_sec; 1607 unsigned last_update_sec;
1608 unsigned last_change_sec;
1613 unsigned start_sec; 1609 unsigned start_sec;
1614 smallint inited; 1610 const char *curfile;
1615} bb_progress_t; 1611} bb_progress_t;
1616 1612
1617void bb_progress_init(bb_progress_t *p) FAST_FUNC; 1613#define is_bb_progress_inited(p) ((p)->curfile != NULL)
1618void bb_progress_update(bb_progress_t *p, const char *curfile, 1614#define bb_progress_free(p) do { \
1619 off_t beg_range, off_t transferred, 1615 if (ENABLE_UNICODE_SUPPORT) free((char*)((p)->curfile)); \
1620 off_t totalsize) FAST_FUNC; 1616 (p)->curfile = NULL; \
1617} while (0)
1618void bb_progress_init(bb_progress_t *p, const char *curfile) FAST_FUNC;
1619void bb_progress_update(bb_progress_t *p,
1620 uoff_t beg_range,
1621 uoff_t transferred,
1622 uoff_t totalsize) FAST_FUNC;
1623
1621 1624
1622extern const char *applet_name; 1625extern const char *applet_name;
1623 1626
diff --git a/include/platform.h b/include/platform.h
index c272fbb05..395ec5d45 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -28,6 +28,7 @@
28#define HAVE_PTSNAME_R 1 28#define HAVE_PTSNAME_R 1
29#define HAVE_SETBIT 1 29#define HAVE_SETBIT 1
30#define HAVE_SIGHANDLER_T 1 30#define HAVE_SIGHANDLER_T 1
31#define HAVE_STPCPY 1
31#define HAVE_STRCASESTR 1 32#define HAVE_STRCASESTR 1
32#define HAVE_STRCHRNUL 1 33#define HAVE_STRCHRNUL 1
33#define HAVE_STRSEP 1 34#define HAVE_STRSEP 1
@@ -374,13 +375,16 @@ typedef unsigned smalluint;
374# define ADJ_TICK MOD_CLKB 375# define ADJ_TICK MOD_CLKB
375# endif 376# endif
376 377
378# undef HAVE_STPCPY
379
377#else 380#else
378 381
379# define bb_setpgrp() setpgrp() 382# define bb_setpgrp() setpgrp()
380 383
381#endif 384#endif
382 385
383#if defined(__GLIBC__) 386#include <unistd.h>
387#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || defined(__GLIBC__)
384# define fdprintf dprintf 388# define fdprintf dprintf
385#endif 389#endif
386 390
@@ -393,6 +397,7 @@ typedef unsigned smalluint;
393# undef HAVE_MEMRCHR 397# undef HAVE_MEMRCHR
394# undef HAVE_MKDTEMP 398# undef HAVE_MKDTEMP
395# undef HAVE_SETBIT 399# undef HAVE_SETBIT
400# undef HAVE_STPCPY
396# undef HAVE_STRCASESTR 401# undef HAVE_STRCASESTR
397# undef HAVE_STRCHRNUL 402# undef HAVE_STRCHRNUL
398# undef HAVE_STRSIGNAL 403# undef HAVE_STRSIGNAL
@@ -406,6 +411,7 @@ typedef unsigned smalluint;
406# undef HAVE_MEMRCHR 411# undef HAVE_MEMRCHR
407# undef HAVE_MKDTEMP 412# undef HAVE_MKDTEMP
408# undef HAVE_SETBIT 413# undef HAVE_SETBIT
414# undef HAVE_STPCPY
409# undef HAVE_STRCASESTR 415# undef HAVE_STRCASESTR
410# undef HAVE_STRCHRNUL 416# undef HAVE_STRCHRNUL
411# undef HAVE_STRSEP 417# undef HAVE_STRSEP
@@ -444,6 +450,10 @@ extern char *mkdtemp(char *template) FAST_FUNC;
444typedef void (*sighandler_t)(int); 450typedef void (*sighandler_t)(int);
445#endif 451#endif
446 452
453#ifndef HAVE_STPCPY
454extern char *stpcpy(char *p, const char *to_add) FAST_FUNC;
455#endif
456
447#ifndef HAVE_STRCASESTR 457#ifndef HAVE_STRCASESTR
448extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; 458extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
449#endif 459#endif
diff --git a/include/usage.src.h b/include/usage.src.h
index ebe80f8e1..c2575b561 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -2451,26 +2451,6 @@ INSERT
2451 "\nOptions:" \ 2451 "\nOptions:" \
2452 "\n -L LBL Label" \ 2452 "\n -L LBL Label" \
2453 2453
2454#define mktemp_trivial_usage \
2455 "[-dt] [-p DIR] [TEMPLATE]"
2456#define mktemp_full_usage "\n\n" \
2457 "Create a temporary file with name based on TEMPLATE and print its name.\n" \
2458 "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n" \
2459 "\nOptions:" \
2460 "\n -d Make a directory instead of a file" \
2461/* "\n -q Fail silently if an error occurs" - we ignore it */ \
2462 "\n -t Generate a path rooted in temporary directory" \
2463 "\n -p DIR Use DIR as a temporary directory (implies -t)" \
2464 "\n" \
2465 "\nFor -t or -p, directory is chosen as follows:" \
2466 "\n$TMPDIR if set, else -p DIR, else /tmp" \
2467
2468#define mktemp_example_usage \
2469 "$ mktemp /tmp/temp.XXXXXX\n" \
2470 "/tmp/temp.mWiLjM\n" \
2471 "$ ls -la /tmp/temp.mWiLjM\n" \
2472 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
2473
2474#define more_trivial_usage \ 2454#define more_trivial_usage \
2475 "[FILE]..." 2455 "[FILE]..."
2476#define more_full_usage "\n\n" \ 2456#define more_full_usage "\n\n" \