From 1af2546e96fa96ec5341026dd509c9e4ed54c6db Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 30 May 2021 14:30:50 +0200 Subject: [PATCH] vac: add -t flag to exclude temporary files and directories (thanks foura) --- sys/man/1/vac | 5 ++++- sys/src/cmd/vac/vac.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/man/1/vac b/sys/man/1/vac index 053c56d7a..c63a77c7d 100644 --- a/sys/man/1/vac +++ b/sys/man/1/vac @@ -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. diff --git a/sys/src/cmd/vac/vac.c b/sys/src/cmd/vac/vac.c index 6acfb4057..f4a18f812 100644 --- a/sys/src/cmd/vac/vac.c +++ b/sys/src/cmd/vac/vac.c @@ -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; } -- 2.44.0