Various formatting fixes
This commit is contained in:
@@ -191,6 +191,7 @@ enum old_files
|
||||
SKIP_OLD_FILES, /* --skip-old-files */
|
||||
KEEP_NEWER_FILES /* --keep-newer-files */
|
||||
};
|
||||
#define MAX_OLD_FILES (KEEP_NEWER_FILES+1)
|
||||
GLOBAL enum old_files old_files_option;
|
||||
|
||||
GLOBAL bool keep_directory_symlink_option;
|
||||
|
||||
16
src/tar.c
16
src/tar.c
@@ -1351,6 +1351,19 @@ static void
|
||||
set_old_files_option (int code, struct option_locus *loc)
|
||||
{
|
||||
struct option_locus *prev;
|
||||
/* Option compatibility map. 0 means two options are incompatible. */
|
||||
static bool compat_map[MAX_OLD_FILES][MAX_OLD_FILES] = {
|
||||
[NO_OVERWRITE_DIR_OLD_FILES] = {
|
||||
[KEEP_OLD_FILES] = 1,
|
||||
[SKIP_OLD_FILES] = 1
|
||||
},
|
||||
[KEEP_OLD_FILES] = {
|
||||
[NO_OVERWRITE_DIR_OLD_FILES] = 1
|
||||
},
|
||||
[SKIP_OLD_FILES] = {
|
||||
[NO_OVERWRITE_DIR_OLD_FILES] = 1
|
||||
}
|
||||
};
|
||||
static char const *const code_to_opt[] = {
|
||||
"--overwrite-dir",
|
||||
"--no-overwrite-dir",
|
||||
@@ -1362,7 +1375,8 @@ set_old_files_option (int code, struct option_locus *loc)
|
||||
};
|
||||
|
||||
prev = optloc_save (OC_OLD_FILES, loc);
|
||||
if (prev && optloc_eq (loc, prev) && code != old_files_option)
|
||||
if (prev && optloc_eq (loc, prev) && code != old_files_option &&
|
||||
compat_map[code][old_files_option] == 0)
|
||||
option_conflict_error (code_to_opt[code], code_to_opt[old_files_option]);
|
||||
|
||||
old_files_option = code;
|
||||
|
||||
Reference in New Issue
Block a user