]> git.gag.com Git - debian/tar/commit
Improve option sanity checking
authorSergey Poznyakoff <gray@gnu.org>
Mon, 31 Aug 2015 05:37:46 +0000 (08:37 +0300)
committerSergey Poznyakoff <gray@gnu.org>
Mon, 31 Aug 2015 05:37:46 +0000 (08:37 +0300)
commitae23a57d7003eee5cf323a29bf956c19aea3b63f
treed9e521762c9aadb603cba79d01b4c5d6aba9f14c
parentc440a92627b3ec5fb00c7cd2753abbf23be753f9
Improve option sanity checking

Any two conflicting options are reported only if they both occur in
the command line.  Otherwise, options defined in the command line
silently override those set in the TAR_OPTIONS environment variable.

* src/common.h (option_source): New enum.
(option_locus): New struct.
* src/names.c (name_elt): New member: line.
(name_add_file): Initialize line.
(read_name_from_file): Keep track of input line number for diagnostic
purposes.
(handle_option): Take a pointer to struct name_elt as 2nd parameter;
pass locus info to more_options().
* src/tar.c (tar_args): New member: loc.
(option_class): New enum.
(optloc_save,optloc_lookup)
(option_set_in_cl,optloc_eq): New functions.
(set_use_compress_program_option): Take into account option location.
(set_old_files_option): New function.
(parse_opt): Keep track of option locations.
(more_options): Improve error reporting.
(parse_default_options): New function.
(decode_options): Parse TAR_OPTION and command line separately.
Options from the latter silently override those from the former.

* lib/prepargs.c: Remove.
* lib/prepargs.h: Remove.
* lib/Makefile.am: Update.
lib/Makefile.am
lib/prepargs.c [deleted file]
lib/prepargs.h [deleted file]
src/common.h
src/names.c
src/tar.c