ANSI C and standard libraries

Doug Gwyn gwyn at brl-smoke.ARPA
Sat Jul 30 14:35:28 AEST 1988


In article <62114 at sun.uucp> swilson%thetone at Sun.COM (Scott Wilson) writes:
>So the question is this:  what does ANSI C say about the behavior of
>library routines?  Can I expect it to be defined that when using
>getchar the user will see what he/she types?  And have a chance to
>correct mistakes (which you also can't do with LSC)?  I realize that
>with some implementations, such as UNIX, the behavior of the terminal
>driver is set independently of the C environment so getchar cannot
>guarantee echoing and error correction.  However, does ANSI C need
>to state that under default terminal settings getchar will echo?
>What about specifying that character erase or line erase facilties
>are available?

None of the input functions is specified as performing any output
operation (except that input from an interactive device, whatever
that means, will first cause buffered STDIO output for that device
to be fflushed).  It is not within the scope of the ANSI C Standard
to specify such details of the operating system as you are asking
about.  In fact it really isn't considered the C library's job to
perform echoing of terminal input, but if you have a mickey-mouse
operating system then a quality implementation will have to
compensate for its deficiencies.  I would have expected yours to
have provided ways to switch into and out of "input canonicalization"
mode in its terminal input support.  Even Apple II Aztec C does that.



More information about the Comp.std.c mailing list