bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] feature request, to pass archive file name to "--to-comman


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] feature request, to pass archive file name to "--to-command"
Date: Thu, 25 Feb 2010 10:18:04 +0200

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

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);

reply via email to

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