GPS - Thu May 9, 2002: I wrote this little extension for my file server. My file server is a console application that prompts the user for a password. Being the pedantic programmer that I am I decided I didn't want someone to be able to see the password while the user enters it. I also wanted to receive a character at a time, so that I could display * for each entered char. This extension provides four commands. Please feel free to add to this. I place the code in the public domain.

KBK - 10 May 2002 - George, would you consider writing a TIP on this? This code could slide very easily into tclUnixChan.c (in the functions TtyGetOptionProc and TtySetOptionProc) as additional 'fconfigure' options that apply to ttys. Perhaps one could spell them something like:

fconfigure stdin -echo false -canonicalize false

It's slightly messy that configuring these flags might apply to several channels at once, but that's no worse than the bucket of options we already have on ttys:

You may also need to add a -l flag to link with the terminal library needed. Use nm in /usr/lib to findout which library has the required symbols. Then load it into your tclsh like so:

load ./terminal.so

Example usage:

terminal:echoOff
#now we can read characters or lines without having them echo
terminal:echoOn
#now we see each character entered
terminal:canonicalOff
#now we can read a character at a time
terminal:canonicalOn
#now we read only when \r is received