]> git.lizzy.rs Git - plan9front.git/commitdiff
vac: add -t flag to exclude temporary files and directories (thanks foura)
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sun, 30 May 2021 12:30:50 +0000 (14:30 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sun, 30 May 2021 12:30:50 +0000 (14:30 +0200)
sys/man/1/vac
sys/src/cmd/vac/vac.c

index 053c56d7a0fe6da7398362b0b9da522a02f4369a..c63a77c7d3d2928f79ab759dd890152884c1fc25 100644 (file)
@@ -4,7 +4,7 @@ vac, unvac \- create, extract a vac archive on Venti
 .SH SYNOPSIS
 .B vac
 [
-.B -mqsv
+.B -mqstv
 ] [
 .B -a
 .I vacfile
@@ -166,6 +166,9 @@ rather than examining the contents of the files.
 .B -s
 Print out various statistics on standard error.
 .TP
+.B -t
+Exclude files and directories with the temporary flag set.
+.TP
 .B -v
 Produce more verbose output on standard error, including the name of the files added to the archive
 and the vac archives that are expanded and merged.
index 6acfb4057c645e812c98699e099f30e7020aef20..f4a18f8127b4a695178ff08da08c70852958f6aa 100644 (file)
@@ -8,7 +8,7 @@
 void
 usage(void)
 {
-       fprint(2, "vac [-imqsv] [-a archive.vac] [-b bsize] [-d old.vac] [-e exclude] [-f new.vac] [-i name] [-h host] [-x excludefile] file...\n");
+       fprint(2, "vac [-imqstv] [-a archive.vac] [-b bsize] [-d old.vac] [-e exclude] [-f new.vac] [-i name] [-h host] [-x excludefile] file...\n");
        threadexitsall("usage");
 }
 
@@ -29,6 +29,7 @@ struct
 int qdiff;
 int merge;
 int verbose;
+int notmp;
 char *host;
 VtConn *z;
 VacFs *fs;
@@ -109,6 +110,9 @@ threadmain(int argc, char **argv)
        case 's':
                printstats++;
                break;
+       case 't':
+               notmp++;
+               break;
        case 'v':
                verbose++;
                break;
@@ -422,7 +426,7 @@ vac(VacFile *fp, VacFile *diffp, char *name, Dir *d)
        VacFile *f, *fdiff;
        VtEntry e;
 
-       if(!includefile(name)){
+       if(!includefile(name) || (notmp && (d->qid.type&QTTMP))) {
                warn("excluding %s%s", name, (d->mode&DMDIR) ? "/" : "");
                return;
        }