extern bool one_file_system_option;
/* Create a top-level directory for extracting based on the archive name. */
-extern bool one_top_level_option;
extern char *one_top_level_dir;
/* Specified value to be put into tar file in place of stat () results, or
int recursion_option;
bool numeric_owner_option;
bool one_file_system_option;
-bool one_top_level_option;
char *one_top_level_dir;
char const *owner_name_option;
uid_t owner_option;
case ONE_TOP_LEVEL_OPTION:
optloc_save (OC_ONE_TOP_LEVEL, args->loc);
- one_top_level_option = true;
one_top_level_dir = arg;
break;
same_order_option = false;
}
- if (one_top_level_option)
+ if (optloc_lookup (OC_ONE_TOP_LEVEL))
{
- char *base;
-
if (absolute_names_option)
{
struct option_locus *one_top_level_loc =
if (optloc_eq (one_top_level_loc, absolute_names_loc))
option_conflict_error ("--one-top-level", "--absolute-names");
- else if (one_top_level_loc->source == OPTS_COMMAND_LINE)
+ if (one_top_level_loc->source == OPTS_COMMAND_LINE)
absolute_names_option = false;
else
- one_top_level_option = false;
+ one_top_level_dir = NULL;
}
- if (!one_top_level_dir && one_top_level_option)
+ if (!absolute_names_option && !one_top_level_dir)
{
- /* If the user wants to guarantee that everything is under one
- directory, determine its name now and let it be created later. */
- base = base_name (archive_name_array[0]);
+ /* Determine name now; the directory is created later if needed. */
+ char *base = base_name (archive_name_array[0]);
one_top_level_dir = strip_compression_suffix (base);
free (base);