What's a good Java mailing list?
David Kramer
david at thekramers.net
Wed Aug 17 22:45:11 EDT 2005
Kevin D. Clark wrote:
> Adam Russell writes:
>
>>Apparently the difference is that some programs like ssh(maybe yours
>>too?) do not read from stdin but, rather, "the terminal". Now, my
>>system programming experience is limited so I am not quite sure what
>>"reading from the terminal means". Does that mean that it uses
>>something like ncurses to read input? If so, how is that different
>>than just reading stdin besides just wrapping it in someway? If
>>soneoen could care to explain it to me that would be cool. Always
>>sort of wondered.......
>
> This is a FAQ in some places.
>
> The thing that you are alluding to here is that some programs happily
> read from stdin wheras others (most famously the passwd program) go to
> the trouble of reading from the controlling terminal (/dev/tty). It's
> not really a ncurses thing.
>
> All of this is done for "security reasons", but I have to confess I
> don't understand these anymore since (1) Expect is nearly ubiquitous
> nowadays (2) it isn't impossible to write pty code (nefarious or not)
> (3) many modern versions of tools like passwd give you the option of
> reading from stdin anyways and (4) if you're stupid enough to use such
> a feature and leave whatever scripts/etc. that drive this program in
> cleartext, then you'll eventually get what you richly deserve.
>
> The OP didn't mention that his program was reading directly from
> /dev/tty, so I doubt that this is relevant to the problem. I'm not
> sure what the problem is at this point either.
>
> Regards,
I'm reading from stdin and writing to stdout.
Problem is now fixed, after some more googling. I needed an fflush() after
my fprintf() calls. I woulda figured stdin and stdout were line buffered if
at all, but that turns out not to be the case.
> --kevin (changing into his light asbestos underwear right now)
Save it for the BBQ.
More information about the Discuss
mailing list