From owner-svn-src-head@FreeBSD.ORG Mon Apr 13 19:46:32 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17ED3329; Mon, 13 Apr 2015 19:46:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED5E2D55; Mon, 13 Apr 2015 19:46:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3DJkVAX078286; Mon, 13 Apr 2015 19:46:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3DJkVDN078284; Mon, 13 Apr 2015 19:46:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201504131946.t3DJkVDN078284@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 13 Apr 2015 19:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281500 - head/usr.bin/gzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 19:46:32 -0000 Author: delphij Date: Mon Apr 13 19:46:30 2015 New Revision: 281500 URL: https://svnweb.freebsd.org/changeset/base/281500 Log: Sync with NetBSD: - Mention xz(1) in gzip(1). - Strip away path from header name when decompressing. MFC after: 2 weeks Modified: head/usr.bin/gzip/gzip.1 head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.1 ============================================================================== --- head/usr.bin/gzip/gzip.1 Mon Apr 13 19:13:51 2015 (r281499) +++ head/usr.bin/gzip/gzip.1 Mon Apr 13 19:46:30 2015 (r281500) @@ -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 .\" All rights reserved. @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd October 9, 2011 +.Dd April 6, 2015 .Dt GZIP 1 .Os .Sh NAME @@ -105,9 +105,10 @@ options are enabled. This version of .Nm is also capable of decompressing files compressed using -.Xr compress 1 +.Xr compress 1 , +.Xr bzip2 1 , or -.Xr bzip2 1 . +.Xr xz 1 . .Sh OPTIONS The following options are available: .Bl -tag -width XXrXXXrecursiveX Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Mon Apr 13 19:13:51 2015 (r281499) +++ head/usr.bin/gzip/gzip.c Mon Apr 13 19:46:30 2015 (r281500) @@ -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 @@ -158,7 +158,7 @@ static suffixes_t suffixes[] = { #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) #define SUFFIX_MAXLEN 30 -static const char gzip_version[] = "FreeBSD gzip 20141022"; +static const char gzip_version[] = "FreeBSD gzip 20150413"; #ifndef SMALL static const char gzip_copyright[] = \ @@ -1354,7 +1354,7 @@ file_uncompress(char *file, char *outfil #ifndef SMALL ssize_t rv; time_t timestamp = 0; - unsigned char name[PATH_MAX + 1]; + char name[PATH_MAX + 1]; #endif /* gather the old name info */ @@ -1415,15 +1415,24 @@ file_uncompress(char *file, char *outfil goto lose; } 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 */ - char *dp = strrchr(file, '/'); + dp = strrchr(file, '/'); if (dp == NULL) dp = file; else dp++; snprintf(outfile, outsize, "%.*s%.*s", (int) (dp - file), - file, (int) rbytes, name); + file, (int) rbytes, nf); } } } @@ -2110,7 +2119,7 @@ static 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); exit(0); }