diff options
author | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
commit | 2277c5d7bbe1f9595fad512d8f790708473a9bf1 (patch) | |
tree | 4d653e13906f1971d3170dba6dbe0fbf92eb48d6 /src/cmd/samterm | |
parent | a770daa795754cb600ad3fab2fdd2961147006c4 (diff) | |
download | plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.gz plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.bz2 plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.zip |
Small tweaks
Lots of new code imported.
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r-- | src/cmd/samterm/plan9.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c index 7c4ed39b..f8614d3f 100644 --- a/src/cmd/samterm/plan9.c +++ b/src/cmd/samterm/plan9.c @@ -10,6 +10,12 @@ #include <cursor.h> #include <keyboard.h> #include <frame.h> +#define Tversion Tversion9p +#define Twrite Twrite9p +#include <fcall.h> +#undef Tversion +#undef Twrite +#include <fs.h> #include <plumb.h> #include "flayer.h" #include "samterm.h" @@ -212,27 +218,22 @@ plumbformat(Plumbmsg *m, int i) } void -plumbproc(void *argv) +plumbproc(void *arg) { - Channel *c; - int i, *fdp; - void **arg; + Fid *fid; + int i; Plumbmsg *m; - arg = argv; - c = arg[0]; - fdp = arg[1]; - + fid = arg; i = 0; - threadfdnoblock(*fdp); for(;;){ - m = threadplumbrecv(*fdp); + m = plumbrecvfid(fid); if(m == nil){ fprint(2, "samterm: plumb read error: %r\n"); threadexits("plumb"); /* not a fatal error */ } if(plumbformat(m, i)){ - send(c, &i); + send(plumbc, &i); i = 1-i; /* toggle */ } } @@ -241,21 +242,18 @@ plumbproc(void *argv) int plumbstart(void) { - static int fd; - static void *arg[2]; + Fid *fid; plumbfd = plumbopen("send", OWRITE|OCEXEC); /* not open is ok */ - fd = plumbopen("edit", OREAD|OCEXEC); - if(fd < 0) + fid = plumbopenfid("edit", OREAD|OCEXEC); + if(fid == nil) return -1; plumbc = chancreate(sizeof(int), 0); if(plumbc == nil){ - close(fd); + fsclose(fid); return -1; } - arg[0] = plumbc; - arg[1] = &fd; - threadcreate(plumbproc, arg, STACK); + threadcreate(plumbproc, fid, STACK); return 1; } |