TTY without echos

D. Jason Penney penneyj at servio.UUCP
Tue Mar 27 03:15:25 AEST 1990


[100 lashes with a wet noodle for anyone who doesn't post enough 
return address that one can follow up with e-mail!]

In article <1990Mar25.170947.2415 at jdyx.UUCP> shawn at jdyx.UUCP (Shawn Hayes) writes:
>
>     I'm trying to set up a program to read and write characters to a tty
>port.  What I would like to have happen is I read a character from the port
>and if it's a numeric character I echo it back, and if it is anything else
>I ignore it.  Currently I can type in alphabetic characters and they are ignored
>, but as soon as I echo a numeric character back to the terminal the port
>echoes every character. 
>
>   I've set up the port with a  stty -echo -echoe -echok raw
>but something must still be wrong in the setup.  Is there a way to configure
>a tty port to never echo characters, so that only the output from my program
>shows up on the port?
>
>                                                         Shawn Hayes

You don't say what brand of pUnyx you're running, but I suppose from the
Newsgroups line that it's some form of AIX.  I strongly recommend setting
the terminal into RAW mode directly from within your program (i.e., 

c_lflag &= ~(HUPCL | ICANON | ISIG | ECHO),
c_cc[VMIN] = 1, c_cc[VTIME] = 0).

Note: the BSD incantation is somewhat different from this...

I suspect from your description that you're using stdio to do the 
echoing.  It could possibly be the case that stdio clears these flags.

Workaround:  use sprintf() to build the strings and then use write(2) 
to output the characters to the screen.  This works like a champ for me 
in all pUnyx variants.
-- 
D. Jason Penney           Ph: (503) 629-8383
Beaverton, OR 97006       uucp: ...uunet!servio!penneyj (penneyj at slc.com)
"Talking about music is like dancing about architecture." -- Steve Martin



More information about the Comp.unix.wizards mailing list