Sync with NetBSD:
- Mention xz(1) in gzip(1). - Strip away path from header name when decompressing. MFC after: 2 weeks
This commit is contained in:
parent
9b0e3c5a47
commit
0eeac58930
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281500
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: gzip.1,v 1.23 2014/03/18 18:20:45 riastradh Exp $
|
.\" $NetBSD: gzip.1,v 1.25 2015/04/06 21:41:17 wiz Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
|
.\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -25,7 +25,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.Dd October 9, 2011
|
.Dd April 6, 2015
|
||||||
.Dt GZIP 1
|
.Dt GZIP 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -105,9 +105,10 @@ options are enabled.
|
|||||||
This version of
|
This version of
|
||||||
.Nm
|
.Nm
|
||||||
is also capable of decompressing files compressed using
|
is also capable of decompressing files compressed using
|
||||||
.Xr compress 1
|
.Xr compress 1 ,
|
||||||
|
.Xr bzip2 1 ,
|
||||||
or
|
or
|
||||||
.Xr bzip2 1 .
|
.Xr xz 1 .
|
||||||
.Sh OPTIONS
|
.Sh OPTIONS
|
||||||
The following options are available:
|
The following options are available:
|
||||||
.Bl -tag -width XXrXXXrecursiveX
|
.Bl -tag -width XXrXXXrecursiveX
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: gzip.c,v 1.106 2014/10/18 08:33:30 snj Exp $ */
|
/* $NetBSD: gzip.c,v 1.107 2015/01/13 02:37:20 mrg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
|
* Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
|
||||||
@ -158,7 +158,7 @@ static suffixes_t suffixes[] = {
|
|||||||
#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
|
#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
|
||||||
#define SUFFIX_MAXLEN 30
|
#define SUFFIX_MAXLEN 30
|
||||||
|
|
||||||
static const char gzip_version[] = "FreeBSD gzip 20141022";
|
static const char gzip_version[] = "FreeBSD gzip 20150413";
|
||||||
|
|
||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
static const char gzip_copyright[] = \
|
static const char gzip_copyright[] = \
|
||||||
@ -1354,7 +1354,7 @@ file_uncompress(char *file, char *outfile, size_t outsize)
|
|||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
ssize_t rv;
|
ssize_t rv;
|
||||||
time_t timestamp = 0;
|
time_t timestamp = 0;
|
||||||
unsigned char name[PATH_MAX + 1];
|
char name[PATH_MAX + 1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* gather the old name info */
|
/* gather the old name info */
|
||||||
@ -1415,15 +1415,24 @@ file_uncompress(char *file, char *outfile, size_t outsize)
|
|||||||
goto lose;
|
goto lose;
|
||||||
}
|
}
|
||||||
if (name[0] != 0) {
|
if (name[0] != 0) {
|
||||||
|
char *dp, *nf;
|
||||||
|
|
||||||
|
/* strip saved directory name */
|
||||||
|
nf = strrchr(name, '/');
|
||||||
|
if (nf == NULL)
|
||||||
|
nf = name;
|
||||||
|
else
|
||||||
|
nf++;
|
||||||
|
|
||||||
/* preserve original directory name */
|
/* preserve original directory name */
|
||||||
char *dp = strrchr(file, '/');
|
dp = strrchr(file, '/');
|
||||||
if (dp == NULL)
|
if (dp == NULL)
|
||||||
dp = file;
|
dp = file;
|
||||||
else
|
else
|
||||||
dp++;
|
dp++;
|
||||||
snprintf(outfile, outsize, "%.*s%.*s",
|
snprintf(outfile, outsize, "%.*s%.*s",
|
||||||
(int) (dp - file),
|
(int) (dp - file),
|
||||||
file, (int) rbytes, name);
|
file, (int) rbytes, nf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2110,7 +2119,7 @@ static void
|
|||||||
display_license(void)
|
display_license(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "%s (based on NetBSD gzip 20141018)\n", gzip_version);
|
fprintf(stderr, "%s (based on NetBSD gzip 20150113)\n", gzip_version);
|
||||||
fprintf(stderr, "%s\n", gzip_copyright);
|
fprintf(stderr, "%s\n", gzip_copyright);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user