bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--strip option


From: Ville Herva
Subject: --strip option
Date: Thu, 4 Jul 2002 22:05:53 +0300
User-agent: Mutt/1.3.25i

Here's a patch that implements --strip=N a la patch(1). It strips N path
components from the file name when --extracting or --listing. If N is
omitted (or is -1), all the path components but the base name are stripped.

Example: for filename
   m/nfs1.niksula/home2/u8/program/duf/src/main.c
--strip=0  -> m/nfs1.niksula/home2/u8/program/duf/src/main.c
--strip=1  -> nfs1.niksula/home2/u8/program/duf/src/main.c
--strip=2  -> home2/u8/program/duf/src/main.c
(...)
--strip=7  -> main.c
--strip=8  -> warning, no file written
--strip=-1 -> main.c
--strip    -> main.c

I imagine --strip=-1 would be a common usage (it is for me, at least), in
particular when extracting single file(s). Hence the argumentless shorthand.

Some points about the patch:

 o If the filename contains multiple adjacent slashes like in
   "foo//bar/fjj///duf", treat them as one slash.
 o Use ISSLASH() so windows port should work.
 o With --strip=-1 all directories are omitted.
 o -x --strip=too_many gives a warning for each file, writes nothing.
 o -t --strip=too_many is silent.
 o tar.texi updated
 o Applies against 1.3.25.


-- v --

address@hidden

Attachment: tar-strip-0.2.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]