From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200406181606.i5IG6BW06986@zamenhof.cs.utwente.nl> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] 9term echo-disabling fix (for ssh, vncviewer) In-reply-to: Your message of "Fri, 18 Jun 2004 17:04:24 +0200." <013a01c45545$8bf80c50$07fa7d50@SOMA> References: <200406181311.i5IDBLB05307@zamenhof.cs.utwente.nl> <013a01c45545$8bf80c50$07fa7d50@SOMA> From: Axel Belinfante Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 18 Jun 2004 18:06:11 +0200 Topicbox-Message-UUID: a62061fc-eacd-11e9-9e20-41e7f4b1d025 > > - return (ttmode.c_lflag&(ICANON|ECHO)); > > + return (ttmode.c_lflag&(ICANON) && ttmode.c_lflag&(ECHO)); > > that's weird. 1st returns either: > > ICANON > ECHO > ICANON|ECHO > 2nd returns 0 [raw | raw and no echo] or 1 [not raw and echo]. the return value is interpreted as boolean, as in your ttyechoing routine (thanks for the pointer) (but the != 0 test is omitted here). for some reason (why? likely because matty's code did. why?) we are not only looking at ECHO but also at ICANON . Then, we must be careful to correctly deal with the case where we have [icanon and no echo] which is what ssh and vncviewer use when prompting for a password (shows up as: israw c- in the debug 9term output) The above seems to do the right thing in that case. The original would interpret [icanon] as a reason to echo, which is incorrect (or at least, does not hide the password that is typed). However, I guess with the above 9term does the wrong thing in the case where we have [no icanon and echo], because also then it does not echo. However, I'm less concerned about that. However, I'm the first to admit I know very little about termio(s). Axel.