9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] vac: add -t flag to exclude temporary files and directories.
@ 2021-05-23 17:00 james palmer
  0 siblings, 0 replies; only message in thread
From: james palmer @ 2021-05-23 17:00 UTC (permalink / raw)
  To: 9front

i heard that the cwfs dump excludes temporary files,
and i wanted this with my hjfs + venti setup so i added the feature.

here's the patch:

# HG changeset patch
# User james palmer <foura@biobuf.link>
# Date 1621788211 -3600
# Branch foura
# Node ID 7c017169db5a3e9f4c02446958fe161006b8e443
# Parent  53bcdc0d2e7b9eb9e541d0a1746fc8a3478acb72
vac: add -t flag to exclude temporary files and directories

diff -r 53bcdc0d2e7b -r 7c017169db5a sys/man/1/vac
--- a/sys/man/1/vac	Sun May 23 16:37:54 2021 +0100
+++ b/sys/man/1/vac	Sun May 23 17:43:31 2021 +0100
@@ -4,7 +4,7 @@
 .SH SYNOPSIS
 .B vac
 [
-.B -mqsv
+.B -mqstv
 ] [
 .B -a
 .I vacfile
@@ -166,6 +166,9 @@
 .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 -r 53bcdc0d2e7b -r 7c017169db5a sys/src/cmd/vac/vac.c
--- a/sys/src/cmd/vac/vac.c	Sun May 23 16:37:54 2021 +0100
+++ b/sys/src/cmd/vac/vac.c	Sun May 23 17:43:31 2021 +0100
@@ -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 @@
 int qdiff;
 int merge;
 int verbose;
+int notmp;
 char *host;
 VtConn *z;
 VacFs *fs;
@@ -109,6 +110,9 @@
 	case 's':
 		printstats++;
 		break;
+	case 't':
+		notmp++;
+		break;
 	case 'v':
 		verbose++;
 		break;
@@ -422,7 +426,7 @@
 	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;
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-24  6:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 17:00 [9front] [patch] vac: add -t flag to exclude temporary files and directories james palmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).