shithub: stashfs

Download patch

ref: d6730b9aeffeb72392c63b75af8694627fda457f
parent: 0a8361b74fc4ac864e2c5fdecdc0831d61d061c7
author: kemal <[email protected]>
date: Sun Sep 12 14:40:15 EDT 2021

add -m, fix usage
---

--- a/stashfs.c
+++ b/stashfs.c
@@ -596,7 +596,7 @@
 void
 usage(void)
 {
-	fprint(2, "%s [-v] [-m mtpt] dir\n", argv0);
+	fprint(2, "usage: %s [-Dv] [-N N] [-R R] [-P P] [-m mtpt] dir\n", argv0);
 	exits("usage");
 }
 
@@ -604,9 +604,10 @@
 main(int argc, char *argv[])
 {
 	int fd, nd;
-	char *s;
+	char *mtpt, *s;
 	Dir *d, *dd;
 
+	mtpt = ".";
 	fmtinstall('H', encodefmt);
 
 	genrandom(defhdr.S, sizeof(defhdr.S));
@@ -621,6 +622,9 @@
 	case 'P':
 		defhdr.P = atoi(EARGF(usage()));
 		break;
+	case 'm':
+		mtpt = EARGF(usage());
+		break;
 	case 'v':
 		verbose++;
 		break;
@@ -694,6 +698,6 @@
 		getkey(defhdr.N, defhdr.R, defhdr.P, defhdr.S);
 	}
 
-	postmountsrv(&fs, nil, ".", MBEFORE|MCREATE);
+	postmountsrv(&fs, nil, mtpt, MBEFORE|MCREATE);
 	exits(nil);
 }