shithub: 9pro

Download patch

ref: 074c3a81de2ab536fb7e0d6fd5350d52a0c8fbdc
parent: 22d0ae4eb5e27fd0eb8ed941b964c50fd04eb6bd
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Jan 17 15:54:53 EST 2021

9gc: add -c option to specify alternative channel name

--- a/9gc.c
+++ b/9gc.c
@@ -44,6 +44,7 @@
 static uint64_t chatoff, skipuntil;
 static char *regsrv = "tcp!registry.9gridchan.org!6675";
 static char *chatsrv = "tcp!grid.a-b.xyz!9990";//"tcp!chat.9gridchan.org!9997";
+static char *channel = "chat";
 
 static uint8_t *
 ctxread(C9ctx *ctx, uint32_t size, int *err)
@@ -179,7 +180,7 @@
 	switch (r->type) {
 	case Rversion:
 		c9attach(ctx, &tag, Rootfid, C9nofid, "none", NULL);
-		path[0] = "chat";
+		path[0] = channel;
 		path[1] = NULL;
 		c9walk(ctx, &tag, Rootfid, Chatfid, path);
 		c9open(ctx, &tag, Chatfid, C9rdwr);
@@ -407,6 +408,9 @@
 			}
 			nick = ps.optarg;
 			break;
+		case 'c':
+			channel = ps.optarg;
+			break;
 		case 'j':
 			printjoin = 1;
 			break;
@@ -414,7 +418,7 @@
 			noecho = 1;
 			break;
 		case 'h':
-			fprintf(stderr, "usage: 9gc [-j] [-e] NICKNAME\n");
+			fprintf(stderr, "usage: 9gc [-j] [-e] [-c CHANNEL] NICKNAME\n");
 			return 0;
 			break;
 		case '?':