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

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

Tar 1.13 patch


From: Richard Rognlie
Subject: Tar 1.13 patch
Date: Sun, 17 Dec 2000 15:01:38 -0500
User-agent: Mutt/1.2i

While not a bug...

One of the features I really like about cpio is the -newer option which
allows me to specify a filename whose "stat" information contains the
timestamp information that with GNU tar you have to specify via the Date
format string.  I find this to be a pain in the nether regions...  8^)

Here is a patch for GNU tar 1.13 which allows you to specify a filename
that when stat()ed returns the timestamp.  The patch essentially checks
to see if optarg (the date) is a file first, if that fails, it defaults
to it's normal behaviour.  If the stat() succeeds, it uses the st.st_mtime
as the timestamp.

% diff -rwc tar-1.13.orig/src/tar.c tar-1.13/src/tar.c
*** tar-1.13.orig/src/tar.c     Wed Jul  7 01:49:50 1999
--- tar-1.13/src/tar.c  Sun Dec 17 14:54:23 2000
***************
*** 687,695 ****
--- 687,703 ----
        if (newer_mtime_option)
          USAGE_ERROR ((0, 0, _("More than one threshold date")));
  
+     {
+         struct stat st;
+         if (stat(optarg,&st) == 0) {
+             newer_mtime_option = st.st_mtime;
+         }
+         else {
              newer_mtime_option = get_date (optarg, (voidstar) 0);
              if (newer_mtime_option == (time_t) -1)
                USAGE_ERROR ((0, 0, _("Invalid date format `%s'"), optarg));
+         }
+     }
  
        break;
  #endif /* not MSDOS */

Regards,

Richard

-- 
 /  \__  | Richard Rognlie / Sendmail Samurai / Gamerz.NET Lackey
 \__/  \ | http://www.gamerz.net/rrognlie/    <address@hidden>
 /  \__/ |    "Those who cast the votes decide nothing. Those who count
 \__/    |     the votes decide everything." - Josef V. Stalin



reply via email to

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