Support -q (from NetBSD) as a synonym for --fast-read (the old FreeBSD

extension to GNU tar).

Thanks to: Joerg Sonnenberger
This commit is contained in:
Tim Kientzle 2008-03-15 03:18:24 +00:00
parent acf18d7a97
commit 8fc7d6f52c
2 changed files with 13 additions and 14 deletions

View File

@ -174,15 +174,6 @@ If not specified, the default tape device will be used.
.Fx ,
the default tape device is
.Pa /dev/sa0 . )
.It Fl -fast-read ( Fl W Cm fast-read )
(x and t mode only)
Extract or list only the first archive entry that matches each pattern
or filename operand.
Exit as soon as each specified pattern or filename has been matched.
By default, the archive is always read to the very end, since
there can be multiple entries with the same name and, by convention,
later entries overwrite earlier entries.
This option is provided as a performance optimization.
.It Fl H
(c and r mode only)
Symbolic links named on the command line will be followed; the
@ -319,6 +310,15 @@ If
is being run by root, the default is to restore the owner unless the
.Fl o
option is also specified.
.It Fl q ( Fl -fast-read )
(x and t mode only)
Extract or list only the first archive entry that matches each pattern
or filename operand.
Exit as soon as each specified pattern or filename has been matched.
By default, the archive is always read to the very end, since
there can be multiple entries with the same name and, by convention,
later entries overwrite earlier entries.
This option is provided as a performance optimization.
.It Fl -strip-components Ar count ( Fl W Cm strip-components Ns = Ns Ar count )
(x and t mode only)
Remove the specified number of leading path elements.

View File

@ -139,7 +139,6 @@ enum {
OPTION_CHECK_LINKS=1,
OPTION_CHROOT,
OPTION_EXCLUDE,
OPTION_FAST_READ,
OPTION_FORMAT,
OPTION_HELP,
OPTION_INCLUDE,
@ -181,7 +180,7 @@ static const struct option tar_longopts[] = {
{ "exclude", required_argument, NULL, OPTION_EXCLUDE },
{ "exclude-from", required_argument, NULL, 'X' },
{ "extract", no_argument, NULL, 'x' },
{ "fast-read", no_argument, NULL, OPTION_FAST_READ },
{ "fast-read", no_argument, NULL, 'q' },
{ "file", required_argument, NULL, 'f' },
{ "files-from", required_argument, NULL, 'T' },
{ "format", required_argument, NULL, OPTION_FORMAT },
@ -341,9 +340,6 @@ main(int argc, char **argv)
if (strcmp(bsdtar->filename, "-") == 0)
bsdtar->filename = NULL;
break;
case OPTION_FAST_READ: /* GNU tar */
bsdtar->option_fast_read = 1;
break;
case 'H': /* BSD convention */
bsdtar->symlink_mode = 'H';
break;
@ -491,6 +487,9 @@ main(int argc, char **argv)
case OPTION_POSIX: /* GNU tar */
bsdtar->create_format = "pax";
break;
case 'q': /* FreeBSD GNU tar --fast-read, NetBSD -q */
bsdtar->option_fast_read = 1;
break;
case 'r': /* SUSv2 */
set_mode(bsdtar, opt);
break;