TTY without echos

Guy Harris guy at auspex.auspex.com
Wed Mar 28 04:44:16 AEST 1990


>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).

Well:

	1) HUPCL has nothing to do with "raw mode";

	2) you may or may not want to turn ISIG off.  Turning it off
	   means your interrupt character (^C, <DEL>, whatever) has no
	   effect; leaving it on means that it still generates the
	   appropriate signal.  If you *do* want to be able to interrupt
	   things with ^C or <DEL> or whatever, leave it on, but
	   remember to *catch* the SIGINT signal and restore the tty
	   modes back to their original values before exiting.

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

BSD RAW mode turns off the signal characters; BSD CBREAK mode doesn't,
just as turning ICANON off doesn't.

>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.

The only terminal "ioctl" function every standard I/O implementation I
know of does is the one to read the current settings, and it only does
that to see if a file descriptor refers to a terminal.  None of them
change the settings; it's conceivable that some broken implementation
out there does, but it's unlikely.



More information about the Comp.unix.wizards mailing list