diff options
author | rsc <devnull@localhost> | 2004-04-16 15:27:29 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-16 15:27:29 +0000 |
commit | a2705f207ff006c07c72081897ec4a6ca22ef269 (patch) | |
tree | 32babd989cd836072be4bb1ef526340fd0186d82 /src/cmd/9term/9term.c | |
parent | aba09191af8012bc7d6a1b998ac937875f728d0c (diff) | |
download | plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.tar.gz plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.tar.bz2 plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.zip |
make echoing work.
Diffstat (limited to 'src/cmd/9term/9term.c')
-rw-r--r-- | src/cmd/9term/9term.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c index 852e7dac..2b2f5539 100644 --- a/src/cmd/9term/9term.c +++ b/src/cmd/9term/9term.c @@ -835,7 +835,7 @@ key(Rune r) return; } - rawon = israw(sfd); + rawon = !isecho(sfd); if(rawon && t.q0==t.nr){ addraw(&r, 1); consread(); @@ -927,7 +927,7 @@ consready(void) if(holdon) return 0; - rawon = israw(sfd); + rawon = !isecho(sfd); if(rawon) return t.nraw != 0; @@ -946,12 +946,11 @@ consread(void) { char buf[8000], *p; int c, width, n; - int echo; + int s; for(;;) { if(!consready()) return; - n = sizeof(buf); p = buf; c = 0; @@ -965,19 +964,22 @@ consread(void) c = *p; p += width; n -= width; - rawon = israw(sfd); + rawon = !isecho(sfd); if(!rawon && (c == '\n' || c == '\004' || c == '\x7F')) break; } - /* take out control-d when not doing a zero length write */ n = p-buf; - if(0) fprint(2, "write buf\n"); - /* temporarily disable echo for buf. sensitive to race? Axel. */ - // echo = setecho(sfd, 0); + + /* + * We've been echoing, so make sure the terminal isn't + * while we do the write. This screws up if someone + * else tries to turn on echo at the same time (we'll turn it + * off again after the write), but that's not too likely. + */ + s = setecho(sfd, 0); if(write(rcfd, buf, n) < 0) exits(0); - // setecho(sfd, echo); -/* mallocstats(); */ + setecho(sfd, s); } } @@ -1258,7 +1260,7 @@ paste(Rune *r, int n, int advance) { Rune *rbuf; - rawon = israw(sfd); + rawon = !isecho(sfd); if(rawon && t.q0==t.nr){ addraw(r, n); return; |