On 31/10/2007, Nikolay Molchanov <[EMAIL PROTECTED]> wrote: > > Shawn Walker wrote: > On 31/10/2007, Nikolay Molchanov <[EMAIL PROTECTED]> wrote: > > > I'm not suggesting to change stdio, I'm suggesting to change pkgrm code to > use > "read(0, buf, 1);" > in loop to read 1 byte from standard input until the end of line or EOF > happens. > Basically it is the same loop as it uses to write its questions: > > 12580: write(2, " D", 1) = 1 > 12580: write(2, " o", 1) = 1 > 12580: write(2, " ", 1) = 1 > 12580: write(2, " y", 1) = 1 > 12580: write(2, " o", 1) = 1 > 12580: write(2, " u", 1) = 1 > 12580: write(2, " ", 1) = 1 > ... > > In this case it will leave the pointer in the input file at the beginning of > next line, > so the child process will read from this point. > > That seems like a lot of hackery for little benefit. > > > > There is no "hackery". What do you mean "hackery", reading one byte? Why > writing > one byte is not a "hackery"?
It is hackery because you are placing special behaviour into how input is read from stdin for the sole purpose of supporting a deficiency in the design of the program. I also never support byte-based reads because I think that's a silly hack in a multi-byte world. > And the benefits for the users are obvious: the existing behavior is buggy No it is not. It behaves exactly as I would expect it to given that it is separate programs. Not only that, I consider it silly to expect someone to be able to do a yes | package-command. That points to a deficiency in the package command rather than a need to read data in an arbitrary fashion from stdin. > and simply > unusable in non-interactive mode, because it misses the replies. > If all replies are "y", command /bin/yes can solve this problem. If some > replies should > be "n" - there is no solution. Sorry, I disagree. -- Shawn Walker, Software and Systems Analyst http://binarycrusader.blogspot.com/ "We don't have enough parallel universes to allow all uses of all junction types--in the absence of quantum computing the combinatorics are not in our favor..." --Larry Wall _______________________________________________ opensolaris-discuss mailing list [email protected]
