ref: d3fb184a9d99c91a68d716a471bdffc84b8097ed
parent: c6b15096dd0493dbe7a91cdfd3330dc2218b90d3
author: james palmer <[email protected]>
date: Mon Jun 7 17:34:44 EDT 2021
dial the server. flag info in the readme.
--- a/README.md
+++ b/README.md
@@ -19,6 +19,10 @@
- open acme
- launch `Wired`
-gridchat should be mounted at /n/chat.
-your chat username will be your plan9 username.
-specify -u to change it (e.g `Wired -u foura`).
+### flags
+
+- -s: server address
+- -m: mountpoint
+- -c: channel
+- -u: username
+
--- a/main.c
+++ b/main.c
@@ -127,7 +127,7 @@
free(s->usr);
free(s);
- sysfatal("chat server not mounted");
+ sysfatal("couldn't read channel: %r");
};
s->cwin = awincreate();
@@ -160,6 +160,17 @@
}
void
+dialchat(char *srv, char *mtpt)
+{
+ int fd;
+
+ if((fd = dial(srv, nil, nil, nil)) < 0)
+ sysfatal("couldn't dial chat server: %r");
+ if(mount(fd, -1, mtpt, MREPL, "") == -1)
+ sysfatal("couldn't mount chat server: %r");
+}
+
+void
usage(void)
{
fprint(2, "usage: %s [-s srv] [-c chan] [-u user]\n", argv0);
@@ -169,9 +180,10 @@
void
threadmain(int argc, char *argv[])
{
- char *srv, *user, *chan;
+ char *srv, *mtpt, *user, *chan;
- srv = "/n/chat";
+ srv = "tcp!chat.9p.zone!9990";
+ mtpt = "/n/chat";
chan = "chat";
user = getuser();
@@ -179,6 +191,9 @@
case 's':
srv = EARGF(usage());
break;
+ case 'm':
+ mtpt = EARGF(usage());
+ break;
case 'c':
chan = EARGF(usage());
break;
@@ -189,7 +204,8 @@
usage();
} ARGEND
- dochat(srv, chan, user);
+ dialchat(srv, mtpt);
+ dochat(mtpt, chan, user);
awincloseall();
threadexitsall(nil);