vac: add -t flag to exclude temporary files and directories (thanks foura)

This commit is contained in:
cinap_lenrek 2021-05-30 14:30:50 +02:00
parent 3858b49942
commit 1af2546e96
2 changed files with 10 additions and 3 deletions

View file

@ -4,7 +4,7 @@ vac, unvac \- create, extract a vac archive on Venti
.SH SYNOPSIS .SH SYNOPSIS
.B vac .B vac
[ [
.B -mqsv .B -mqstv
] [ ] [
.B -a .B -a
.I vacfile .I vacfile
@ -166,6 +166,9 @@ rather than examining the contents of the files.
.B -s .B -s
Print out various statistics on standard error. Print out various statistics on standard error.
.TP .TP
.B -t
Exclude files and directories with the temporary flag set.
.TP
.B -v .B -v
Produce more verbose output on standard error, including the name of the files added to the archive 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. and the vac archives that are expanded and merged.

View file

@ -8,7 +8,7 @@
void void
usage(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"); threadexitsall("usage");
} }
@ -29,6 +29,7 @@ struct
int qdiff; int qdiff;
int merge; int merge;
int verbose; int verbose;
int notmp;
char *host; char *host;
VtConn *z; VtConn *z;
VacFs *fs; VacFs *fs;
@ -109,6 +110,9 @@ threadmain(int argc, char **argv)
case 's': case 's':
printstats++; printstats++;
break; break;
case 't':
notmp++;
break;
case 'v': case 'v':
verbose++; verbose++;
break; break;
@ -422,7 +426,7 @@ vac(VacFile *fp, VacFile *diffp, char *name, Dir *d)
VacFile *f, *fdiff; VacFile *f, *fdiff;
VtEntry e; VtEntry e;
if(!includefile(name)){ if(!includefile(name) || (notmp && (d->qid.type&QTTMP))) {
warn("excluding %s%s", name, (d->mode&DMDIR) ? "/" : ""); warn("excluding %s%s", name, (d->mode&DMDIR) ? "/" : "");
return; return;
} }