Nikolay Molchanov writes:
> I'm not suggesting to change stdio, I'm suggesting to change pkgrm code to 
> use 
> "read(0, buf, 1);"

Don't forget that pkgadd and pkgrm exec many other programs (as part
of the scripting interfaces, among other reasons), none of which will
have your special changes.  Your suggested change won't actually work.

> 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

Indeed; the fact that it's flushing each character out is badness.  It
has to do with the way that stderr works, but it's still badness.

In any event, it's actually unrelated to the stdin problem, because
that's buffered.

> 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.

Yes, I understand the goal.  I just think that trying to "script"
something that is so clearly designed for humans is a waste of time
and effort, so it's not really worth fixing.

If you're really intent on doing this, I'd suggest using the 'expect'
program instead.  Then, at least, you'd have some control over the
behavior of your script in the event that pkgadd or pkgrm issued a
prompt you *weren't* expecting.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to