aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-05-27 00:46:38 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-05-27 00:46:38 +0200
commit877dedb8251be47b3614a371434081ae9b7b358b (patch)
tree70fbac15f652ff7ce9aaada1252b4b6a0a846dad /include
parent852e8dd734662d80aa82be802b066130af85b261 (diff)
downloadbusybox-w32-877dedb8251be47b3614a371434081ae9b7b358b.tar.gz
busybox-w32-877dedb8251be47b3614a371434081ae9b7b358b.tar.bz2
busybox-w32-877dedb8251be47b3614a371434081ae9b7b358b.zip
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.h24
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;
351//TODO: supply a pointer to char[11] buffer (avoid statics)? 351//TODO: supply a pointer to char[11] buffer (avoid statics)?
352extern const char *bb_mode_string(mode_t mode) FAST_FUNC; 352extern const char *bb_mode_string(mode_t mode) FAST_FUNC;
353extern int is_directory(const char *name, int followLinks) FAST_FUNC; 353extern int is_directory(const char *name, int followLinks) FAST_FUNC;
354enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ 354enum { /* cp.c, mv.c, install.c depend on these values. CAREFUL when changing them! */
355 FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */ 355 FILEUTILS_PRESERVE_STATUS = 1 << 0, /* -p */
356 FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */ 356 FILEUTILS_DEREFERENCE = 1 << 1, /* !-d */
357 FILEUTILS_RECUR = 1 << 2, /* -R */ 357 FILEUTILS_RECUR = 1 << 2, /* -R */
@@ -361,15 +361,25 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
361 FILEUTILS_MAKE_SOFTLINK = 1 << 6, /* -s */ 361 FILEUTILS_MAKE_SOFTLINK = 1 << 6, /* -s */
362 FILEUTILS_DEREF_SOFTLINK = 1 << 7, /* -L */ 362 FILEUTILS_DEREF_SOFTLINK = 1 << 7, /* -L */
363 FILEUTILS_DEREFERENCE_L0 = 1 << 8, /* -H */ 363 FILEUTILS_DEREFERENCE_L0 = 1 << 8, /* -H */
364 /* -a = -pdR (mapped in cp.c) */
365 /* -r = -dR (mapped in cp.c) */
366 /* -P = -d (mapped in cp.c) */
367 FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE, /* -v */
368 FILEUTILS_UPDATE = 1 << 13, /* -u */
364#if ENABLE_SELINUX 369#if ENABLE_SELINUX
365 FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ 370 FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 14, /* -c */
366 FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10,
367#endif 371#endif
368 FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11, 372 FILEUTILS_RMDEST = 1 << (15 - !ENABLE_SELINUX), /* --remove-destination */
369 /* -v */ 373 /*
370 FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE, 374 * Hole. cp may have some bits set here,
375 * they should not affect remove_file()/copy_file()
376 */
377#if ENABLE_SELINUX
378 FILEUTILS_SET_SECURITY_CONTEXT = 1 << 30,
379#endif
380 FILEUTILS_IGNORE_CHMOD_ERR = 1 << 31,
371}; 381};
372#define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") 382#define FILEUTILS_CP_OPTSTR "pdRfilsLHarPvu" IF_SELINUX("c")
373extern int remove_file(const char *path, int flags) FAST_FUNC; 383extern int remove_file(const char *path, int flags) FAST_FUNC;
374/* NB: without FILEUTILS_RECUR in flags, it will basically "cat" 384/* NB: without FILEUTILS_RECUR in flags, it will basically "cat"
375 * the source, not copy (unless "source" is a directory). 385 * the source, not copy (unless "source" is a directory).