Getchar w/wout echo

Alan Fargusson alanf%smile at Sun.COM
Wed Aug 24 05:45:19 AEST 1988


In article <302 at quintus.UUCP>, ok at quintus.uucp (Richard A. O'Keefe) writes:
> (1) Don't forget, the C standard has to make sense on IBM mainframes,
>     which do not use a character-at-a-time interface to their terminals.

I didn't.  This has nothing to do with turning off echo, and you can cause the
IBM terminals to blank out the input area when echo is off so it does not
echo in effect.  BTW it is possible to do character at a time input from these
guys, but it is very inefficient.

> (2) The dpANS makes it clear that fgets() and getchar() are supposed to
>     do the same things (in general), so if one of them echoes and the
>     other doesn't, that's broken.

I completely agree.  What I think should happen is if you do a fnoecho( stdin )
then both will not echo.  I just made up fnoecho(), it could be called whatever.

> (3) The story with respect to UNIX and MS-DOS is nowhere near as bad as
>     has been made out: yes the terminal ioctl() calls differ between BSD
>     and Sys V, but if you want to control features like echoing you
>     should probably be using Curses, and while there are differences,
>     they aren't _that_ great.  There are implementations of Curses for
>     MS-DOS, and even VMS tries to support that interface.

It is bad enough.  I maintained a runtime library that had to turn echo off and
do some other things, and it was a real bear to keep it working on all the
various flavors of UNIX.  We couldn't use curses for this due to some
limitations that I can't remember now.  I think it had something to do with
supporting color terminals.

> 
> I loathe Curses myself, but it _is_ a de facto standard, and is being
> used successfully by a lot of applications programmers.  It seems to
> me that the appropriate thing to do is to propose that Curses be part
> of the next version of the C standard (perhaps as an optional module
> so that IBM won't have to bring their operating systems into the '70s).

I happen to like curses actually, but for simply turning echo off for a short
time, then turning it back on the overhead is to high.  It just isn't the right
tool for this job.
- - - - - - - - - - - - - - - - - - - - -
Alan Fargusson		Sun Microsystems
alanf at sun.com		..!sun!alanf



More information about the Comp.lang.c mailing list