Getchar w/wout echo

T. William Wells bill at proxftl.UUCP
Mon Aug 29 08:52:49 AEST 1988


In article <8384 at smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
: In article <624 at proxftl.UUCP> bill at proxftl.UUCP (T. William Wells) writes:
: >#define getchar()       (putchar(getchar()))
:
: Ahem.  Consider (in UNIX shell notation):
:       filter <infile >outfile
:
: There really is no way to do this right in the application code;
: it has to be dealt with in the run-time environment.

Please recall that he wanted a fix for his Macintosh, where there
is no such thing as a command line, much less redirection.
(Actually, I hear that there is a kludge in Lightspeed C that
lets the user type in part of a command line at program start;
but according to a guy who is working with that compiler,
getchar() echoes when this kludge is used, so I suppose that the
guy with the problem isn't using this kludge.)

Of course, you really should have got me for this; I wrote:

: #define getchar()       (putchar(getchar()))

And I should have written:

: #define getchar()       (putchar(getc(stdin)))

I do agree that this would be a brain-damaged thing to do on
almost any other system.  And, I agree, the run-time environment
should deal with this; that was the first thing I said in the
message that you responded to:

In article <624 at proxftl.UUCP> I wrote:
: In article <65071 at sun.uucp> swilson at sun.UUCP (Scott Wilson) writes:
: :                                                   Making a window look
: : like a terminal is a function of the C libraries.
:
: Agreed.  And your compiler is broken for not doing this
: correctly.

---
Bill
novavax!proxftl!bill



More information about the Comp.lang.c mailing list