shithub: namespace-example

Download patch

ref: c7227c70e8b096472f689885c5b11bf34615c3da
parent: f86d02fc768075a4cfab130f340174fddbd69c2c
author: glenda <glenda@9front.local>
date: Sat Nov 28 00:37:30 EST 2020

added usage

--- a/main.c
+++ b/main.c
@@ -4,6 +4,13 @@
 #include <thread.h>
 #include <9p.h>
 
+void
+usage(void)
+{
+	fprint(2, "%s [-D] [-m mtpt] [-s srv]\n", argv0);
+	exits("usage");
+}
+
 enum {
 	Qroot,
 		Qitem1,
@@ -111,7 +118,6 @@
 	int n = 0;
 	uvlong path = r->fid->qid.path;
 	vlong offset;
-	long count;
 	offset = r->ifcall.offset;
 	if(offset >= 1){
 		r->ofcall.count = 0;
@@ -190,6 +196,19 @@
 	char *mtpt, *srvn;
 	mtpt = "/mnt/namespace-test";
 	srvn = nil;
+	ARGBEGIN{
+	case 'm':
+		mtpt = EARGF(usage());
+		break;
+	case 's':
+		srvn = EARGF(usage());
+		break;
+	case 'D':
+		chatty9p++;
+		break;
+	default:
+		usage();
+	}ARGEND;
 	postmountsrv(&fs, srvn, mtpt, MREPL);
 	exits(nil);
 }