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
.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.

View 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;
}