| To: | yyyyyyyyyyyyyy@xxxxxxxxxxxxx, yyy@xxxxxxxxxxxxxxxx |
|---|---|
| Subject: | Re: Re: [austin] Re: Defect in XSH Interaction of File Descriptors and Standard I/O Streams |
| From: | Joerg Schilling <yyyyyyyyy@xxxxxxxxxxxx> |
| Date: | Fri, 1 Feb 2002 14:57:10 +0100 (MET) |
>From: David Korn <yyy@xxxxxxxxxxxxxxxx>
>> flushing an *input* stream is idiotic nonsense. To flush means to
>> pass buffered data forward to an operating system, it does not
>> mean discarding arbitrary, unknown amounts of input. The semantics
>> of flushing and discarding are miles apart.
>The purpose of this requirement was not to cause data to be
>sent back to the operating system, but to cause the seek pointer
>to be positioned to the end of the data that had been read.
>For example, if the implementation of the head utility uses
>buffered I/O, the file pointer would be positioned at end
>end of the data that it read so that a script such as
> (head 5>/dev/null;cat) < file
>would successfully behead the first 5 lines of file.
>There are standard I/O implementations that do this and ksh
>calls fflush() on the input stream before running a command
>to get it seek pointer positioned correctly.
.... and if you have a stream open for reading and writing, you need
to call fflush() before switching the I/O direction.
Jörg
EMail:yyyyy@xxxxxxxxxxxxxxxxxxxxxxxxxxx (home) Jörg Schilling D-13353 Berlin
yy@xxxxxxxxxxxxxxx (uni) If you don't have iso-8859-1
yyyyyyyyy@xxxxxxxxxxxx (work) chars I am J"org Schilling
URL: http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: RE: Re: [austin] Re: Defect in XSH Interaction of File Descriptor s and Standard I/O Streams, David Korn |
|---|---|
| Next by Date: | Re: [austin] Re: Re: [austin] Re: Defect in XSH Interaction of FileDescriptors and Standard I/O Streams, Kaz Kylheku |
| Previous by Thread: | RE: Re: [austin] Re: Defect in XSH Interaction of File Descriptors and Standard I/O Streams, Schwarz Konrad |
| Next by Thread: | Re: [austin] Re: Re: [austin] Re: Defect in XSH Interaction of FileDescriptors and Standard I/O Streams, Kaz Kylheku |
| Indexes: | [Date] [Thread] [All Lists] |