diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-05-27 00:46:38 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-05-27 00:46:38 +0200 |
commit | 877dedb8251be47b3614a371434081ae9b7b358b (patch) | |
tree | 70fbac15f652ff7ce9aaada1252b4b6a0a846dad /include | |
parent | 852e8dd734662d80aa82be802b066130af85b261 (diff) | |
download | busybox-877dedb8251be47b3614a371434081ae9b7b358b.tar.gz |
cp: add -u/--update and --remove-destination
Based on the patch by wdlkmpx@gmail.com
function old new delta
copy_file 1546 1644 +98
add_partition 1270 1362 +92
ask_and_unlink 95 133 +38
do_iproute 132 157 +25
decode_one_format 710 715 +5
cp_main 369 374 +5
ubirename_main 198 202 +4
read_package_field 232 230 -2
bb_make_directory 421 412 -9
packed_usage 30505 30476 -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 267/-40) Total: 227 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/libbb.h b/include/libbb.h index fd40ef74c..a21f4204a 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -351,7 +351,7 @@ extern char *strrstr(const char *haystack, const char *needle) FAST_FUNC; //TODO: supply a pointer to char[11] buffer (avoid statics)? extern const char *bb_mode_string(mode_t mode) FAST_FUNC; extern int is_directory(const char *name, int followLinks) FAST_FUNC; -enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ +enum { /* cp.c, mv.c, install.c depend on these values. CAREFUL when changing them! */ FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */ FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */ FILEUTILS_RECUR = 1 << 2, /* -R */ @@ -361,15 +361,25 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ FILEUTILS_MAKE_SOFTLINK = 1 << 6, /* -s */ FILEUTILS_DEREF_SOFTLINK = 1 << 7, /* -L */ FILEUTILS_DEREFERENCE_L0 = 1 << 8, /* -H */ + /* -a = -pdR (mapped in cp.c) */ + /* -r = -dR (mapped in cp.c) */ + /* -P = -d (mapped in cp.c) */ + FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE, /* -v */ + FILEUTILS_UPDATE = 1 << 13, /* -u */ #if ENABLE_SELINUX - FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ - FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10, + FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 14, /* -c */ #endif - FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11, - /* -v */ - FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE, + FILEUTILS_RMDEST = 1 << (15 - !ENABLE_SELINUX), /* --remove-destination */ + /* + * Hole. cp may have some bits set here, + * they should not affect remove_file()/copy_file() + */ +#if ENABLE_SELINUX + FILEUTILS_SET_SECURITY_CONTEXT = 1 << 30, +#endif + FILEUTILS_IGNORE_CHMOD_ERR = 1 << 31, }; -#define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") +#define FILEUTILS_CP_OPTSTR "pdRfilsLHarPvu" IF_SELINUX("c") extern int remove_file(const char *path, int flags) FAST_FUNC; /* NB: without FILEUTILS_RECUR in flags, it will basically "cat" * the source, not copy (unless "source" is a directory). |