Add two checks for inappropriate options: -U only makes sense in "x"

mode, and --strip-components only makes sense in "x" and "t" modes.

MFC after:	3 days
This commit is contained in:
Colin Percival 2006-12-23 07:06:37 +00:00
parent fe7f4a3aad
commit 5e522bbc27

View File

@ -532,6 +532,8 @@ main(int argc, char **argv)
only_mode(bsdtar, "-n", "cru");
if (bsdtar->option_stdout)
only_mode(bsdtar, "-O", "xt");
if (bsdtar->option_unlink_first)
only_mode(bsdtar, "-U" "x");
if (bsdtar->option_warn_links)
only_mode(bsdtar, "--check-links", "cr");
@ -552,6 +554,8 @@ main(int argc, char **argv)
buff[1] = bsdtar->symlink_mode;
only_mode(bsdtar, buff, "cru");
}
if (bsdtar->strip_components != 0)
only_mode(bsdtar, "--strip-components", "xt");
bsdtar->argc -= optind;
bsdtar->argv += optind;