[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tar-bug
Subject:    Re: [Bug-tar] feature request, to pass archive file name to
From:       Sergey Poznyakoff <gray () gnu ! org ! ua>
Date:       2010-02-25 8:18:04
Message-ID: 20100225101804.11373 () Pirx ! gnu ! org ! ua
[Download RAW message or body]

--1804289383-1267085826=:11369
Content-ID: <20100225101706.11369.1@Pirx.gnu.org.ua>
Content-Type: text/plain

Hi,

> I would like to request one feature for "gnu tar" command.
> That is, passing the `extracted file name' as the first argument
> for the command of "--to-command" option.

Good idea. However, passing it as an argument would be inconsistent.
Since the --to-command script gets all information it needs from
the environment, it is reasonable to store the archive name there as
well.

To do so, apply the attached patch. Then, your --to-command script will
get the archive name in the environment variable $TAR_ARCHIVE.

Regards,
Sergey


--1804289383-1267085826=:11369
Content-transfer-encoding: quoted-printable
Content-Description: 
Content-ID: <20100225101706.11369.1@Pirx.gnu.org.ua>
Content-Type: text/x-c; name="to-command_archive_name.diff"

diff --git a/src/system.c b/src/system.c
index ea88496..8c65d47 100644
--- a/src/system.c
+++ b/src/system.c
@@ -629,6 +629,7 @@ static void
 stat_to_env (char *name, char type, struct tar_stat_info *st)
 {
   str_to_env ("TAR_VERSION", PACKAGE_VERSION);
+  str_to_env ("TAR_ARCHIVE", *archive_name_cursor);
   chr_to_env ("TAR_FILETYPE", type);
   oct_to_env ("TAR_MODE", st->stat.st_mode);
   str_to_env ("TAR_FILENAME", name);

--1804289383-1267085826=:11369--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic