~foura/wired

d3fb184a9d99c91a68d716a471bdffc84b8097ed — james palmer 1 year, 2 months ago c6b1509
dial the server. flag info in the readme.
2 files changed, 27 insertions(+), 7 deletions(-)

M README.md
M main.c
M README.md => README.md +7 -3
@@ 19,6 19,10 @@ mk install
- 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


M main.c => main.c +20 -4
@@ 127,7 127,7 @@ dochat(char *mtpt, char *chan, char *usr)
		free(s->usr);
		free(s);
		
		sysfatal("chat server not mounted");
		sysfatal("couldn't read channel: %r");
	};
		
	s->cwin = awincreate();


@@ 160,6 160,17 @@ dochat(char *mtpt, char *chan, char *usr)
}

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 @@ usage(void)
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 @@ threadmain(int argc, char *argv[])
	case 's':
		srv = EARGF(usage());
		break;
	case 'm':
		mtpt = EARGF(usage());
		break;
	case 'c':
		chan = EARGF(usage());
		break;


@@ 189,7 204,8 @@ threadmain(int argc, char *argv[])
		usage();
	} ARGEND
	
	dochat(srv, chan, user);
	dialchat(srv, mtpt);
	dochat(mtpt, chan, user);
	
	awincloseall();
	threadexitsall(nil);