* Operation Summary::
* Option Summary::
* Short Option Summary::
+* Position-Sensitive Options::
@GNUTAR{} Operations
* Operation Summary::
* Option Summary::
* Short Option Summary::
+* Position-Sensitive Options::
@end menu
@node Operation Summary
@end multitable
+@node Position-Sensitive Options
+@subsection Position-Sensitive Options
+
+Some @GNUTAR{} options can be used multiple times in the same
+invocation and affect all arguments that appear after them. These are
+options that control how file names are selected and what kind of
+pattern matching is used.
+
+The most obvious example is the @option{-C} option. It instructs @command{tar}
+to change to the directory given as its argument prior to processing
+the rest of command line (@pxref{directory}). Thus, in the following
+command:
+
+@example
+@kbd{tar -c -f a.tar -C /etc passwd -C /var log spool}
+@end example
+
+@noindent
+the file @file{passwd} will be searched in the directory @file{/etc},
+and files @file{log} and @file{spool} -- in @file{/var}.
+
+These options can also be used in a file list supplied with the
+@option{--files-from} (@option{-T}) option (@pxref{files}). In that
+case they affect all files (patterns) appearing in that file after
+them and remain in effect for any arguments processed after that file.
+For example, if the file @file{list.txt} contained:
+
+@example
+README
+-C src
+main.c
+@end example
+
+@noindent
+and @command{tar} were invoked as follows:
+
+@example
+@kbd{tar -c -f a.tar -T list.txt Makefile}
+@end example
+
+@noindent
+then the file @file{README} would be looked up in the current working
+directory, and files @file{main.c} and @file{Makefile} would be looked
+up in the directory @file{src}.
+
+Many options can be prefixed with @option{--no-} to cancel the effect
+of the original option.
+
+For example, the @option{--recursion} option controls whether to
+recurse in the subdirectories. It's counterpart
+@option{--no-recursion} disables this. Consider the command below. It will
+store in the archive the directory @file{/usr} with all files and
+directories that are located in it as well as any files and
+directories in @file{/var}, without recursing into them@footnote{The @option{--recursion}
+option is the default and is used here for clarity. The same example
+can be written as:
+
+@example
+tar -cf a.tar /usr --no-recursion /var/*
+@end example
+}:
+
+@example
+tar -cf a.tar --recursion /usr --no-recursion /var/*
+@end example
+
+The following table summarizes all position-sensitive options.
+
+@table @option
+@item --directory=@var{dir}
+@itemx -C @var{dir}
+@xref{directory}.
+
+@item --null
+@itemx --no-null
+@xref{nul}.
+
+@item --unquote
+@itemx --no-unquote
+@xref{input name quoting}.
+
+@item --verbatim-files-from
+@itemx --no-verbatim-files-from
+@xref{verbatim-files-from}.
+
+@item --recursion
+@itemx --no-recursion
+@xref{recurse}.
+
+@item --anchored
+@itemx --no-anchored
+@xref{anchored patterns}.
+
+@item --ignore-case
+@itemx --no-ignore-case
+@xref{case-insensitive matches}.
+
+@item --wildcards
+@itemx --no-wildcards
+@xref{controlling pattern-matching}.
+
+@item --wildcards-match-slash
+@itemx --no-wildcards-match-slash
+@xref{controlling pattern-matching}.
+
+@item --exclude
+@xref{exclude}.
+
+@item --exclude-from
+@itemx -X
+@itemx --exclude-caches
+@itemx --exclude-caches-under
+@itemx --exclude-caches-all
+@itemx --exclude-tag
+@itemx --exclude-ignore
+@itemx --exclude-ignore-recursive
+@itemx --exclude-tag-under
+@itemx --exclude-tag-all
+@itemx --exclude-vcs
+@itemx --exclude-vcs-ignores
+@itemx --exclude-backups
+@xref{exclude}.
+@end table
+
@node help
@section @GNUTAR{} documentation
@end group
@end smallexample
+Note, that any options used in the file list remain in effect for the
+rest of the command line. For example, using the same @file{list}
+file as above, the following command
+
+@smallexample
+$ @kbd{tar -c -f foo.tar --files-from list libcurses.a}
+@end smallexample
+
+@noindent
+will look for file @file{libcurses.a} in the directory @file{/lib},
+because it was used with the last @option{-C} option
+(@pxref{Position-Sensitive Options}).
+
@anchor{verbatim-files-from}
@opindex verbatim-files-from
If such option handling is undesirable, use the
To disable option handling for a single file name, use the
@option{--add-file} option, e.g.: @code{--add-file=--my-file}.
+You can use any @GNUTAR{} command line options in the file list file,
+including @option{--files-from} option itself. This allows for
+including contents of a file list into another file list file.
+Note however, that options that control file list processing, such as
+@option{--verbatim-files-from} or @option{--null} won't affect the
+file they appear in. They will affect next @option{--files-from}
+option, if there is any.
+
@menu
* nul::
@end menu
@samp{readme}.
@table @option
+@anchor{anchored patterns}
@opindex anchored
@opindex no-anchored
@item --anchored
subsequence. Default is @option{--no-anchored} for exclusion members
and @option{--anchored} inclusion members.
+@anchor{case-insensitive matches}
@opindex ignore-case
@opindex no-ignore-case
@item --ignore-case
{NULL, 0, NULL, 0,
N_("File name matching options (affect both exclude and include patterns):"),
GRID },
- {"ignore-case", IGNORE_CASE_OPTION, 0, 0,
- N_("ignore case"), GRID+1 },
{"anchored", ANCHORED_OPTION, 0, 0,
N_("patterns match file name start"), GRID+1 },
{"no-anchored", NO_ANCHORED_OPTION, 0, 0,
N_("patterns match after any '/' (default for exclusion)"), GRID+1 },
+ {"ignore-case", IGNORE_CASE_OPTION, 0, 0,
+ N_("ignore case"), GRID+1 },
{"no-ignore-case", NO_IGNORE_CASE_OPTION, 0, 0,
N_("case sensitive matching (default)"), GRID+1 },
{"wildcards", WILDCARDS_OPTION, 0, 0,
N_("use wildcards (default for exclusion)"), GRID+1 },
{"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
N_("verbatim string matching"), GRID+1 },
- {"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
- N_("wildcards do not match '/'"), GRID+1 },
{"wildcards-match-slash", WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
N_("wildcards match '/' (default for exclusion)"), GRID+1 },
+ {"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
+ N_("wildcards do not match '/'"), GRID+1 },
#undef GRID
{NULL}
static struct argp names_argp = {
names_options,
names_parse_opt,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
};
struct argp_child names_argp_children[] = {
- { &names_argp, 0, "" },
+ { &names_argp, 0, "", 0 },
{ NULL }
};
\f