mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Make unlink old files default behaviour and add a new option -k to
prevent overwritting existing files
This commit is contained in:
parent
de3ea9f049
commit
3b9fc8fe2a
@ -595,7 +595,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const char tar_options[]="ctxjT:X:C:f:Opvz";
|
static const char tar_options[]="ctxjT:X:C:f:Opvzk";
|
||||||
|
|
||||||
#define CTX_CREATE 1
|
#define CTX_CREATE 1
|
||||||
#define CTX_TEST 2
|
#define CTX_TEST 2
|
||||||
@ -609,6 +609,7 @@ static const char tar_options[]="ctxjT:X:C:f:Opvz";
|
|||||||
#define TAR_OPT_P 512
|
#define TAR_OPT_P 512
|
||||||
#define TAR_OPT_VERBOSE 1024
|
#define TAR_OPT_VERBOSE 1024
|
||||||
#define TAR_OPT_GZIP 2048
|
#define TAR_OPT_GZIP 2048
|
||||||
|
#define TAR_OPT_KEEP_OLD 4096
|
||||||
|
|
||||||
int tar_main(int argc, char **argv)
|
int tar_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -633,7 +634,7 @@ int tar_main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Initialise default values */
|
/* Initialise default values */
|
||||||
tar_handle = init_handle();
|
tar_handle = init_handle();
|
||||||
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE;
|
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||||
|
|
||||||
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*";
|
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*";
|
||||||
opt = bb_getopt_ulflags(argc, argv, tar_options,
|
opt = bb_getopt_ulflags(argc, argv, tar_options,
|
||||||
@ -671,6 +672,9 @@ int tar_main(int argc, char **argv)
|
|||||||
tar_handle->action_header = header_list;
|
tar_handle->action_header = header_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (opt & TAR_OPT_KEEP_OLD) {
|
||||||
|
tar_handle->flags &= ~ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||||
|
}
|
||||||
|
|
||||||
if(opt & TAR_OPT_GZIP) {
|
if(opt & TAR_OPT_GZIP) {
|
||||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||||
|
Loading…
Reference in New Issue
Block a user