[hackers] [sbase] tar: add verbose flag (-v) || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 8 May 2015 16:56:25 +0200 (CEST)

commit 7dff7d4c83ccb621d2826bc9b13788078df5931a
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri May 8 12:28:51 2015 +0200

    tar: add verbose flag (-v)

diff --git a/tar.c b/tar.c
index b1f3b27..307e177 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -65,7 +65,7 @@ static int tarfd;
 static ino_t tarinode;
 static dev_t tardev;
 
-static int mflag;
+static int mflag, vflag;
 static int filtermode;
 
 static void
_AT_@ -326,6 +326,8 @@ static void
 c(const char *path, struct stat *st, void *data, struct recursor *r)
 {
         archive(path);
+ if (vflag)
+ puts(path);
 
         if (st && S_ISDIR(st->st_mode))
                 recurse(path, NULL, r);
_AT_@ -429,6 +431,8 @@ xt(int argc, char *argv[], int (*fn)(char *, ssize_t, char[BLKSIZ]))
                 }
 
                 fn(fname, size, b);
+ if (vflag && mode != 't')
+ puts(fname);
         }
 
         if (!mflag) {
_AT_@ -482,6 +486,9 @@ main(int argc, char *argv[])
         case 'h':
                 r.follow = 'L';
                 break;
+ case 'v':
+ vflag = 1;
+ break;
         default:
                 usage();
         } ARGEND;
Received on Fri May 08 2015 - 16:56:25 CEST

This archive was generated by hypermail 2.3.0 : Fri May 08 2015 - 17:00:12 CEST