Pipe woes (not DF specific I guess)

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Thu Feb 5 05:49:40 PST 2004


Heyas,

While doing some shell-fu (with grep and tee) I once again noted that 
pipes don't really work the way I'd like them to work: Be line buffered 
(not fully buffered) when the final output is a terminal.

This - of course doesn't work automatically. But a nice thing would be 
some way to declare a pipe as line oriented...

But first things first: A small test visualize pipe effects

% sh pipetest.shar
% cd pipetest
% make test
result:
Testing standard pipe...
. /writer | ./reader 20
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
Testing double pipe...
. /writer | grep a | ./reader 20
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
384
1000
1000
1000
i.e. A single pipe transports each write, a double one (except with 
`cat') buffers completely (here: 16384 bytes)

Joerg wrote an approach with nonblocking IO and polling, but actually 
I'd like to have some more generic thing, where not every involved 
program needs to be changed.

cheers
  simon
ps: or is there something I'm missing?
Attachment:
pipetest.shar
Description: Unix shell archive
--
/"\   http://corecode.ath.cx/#donate
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News
Attachment:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/bugs/attachments/20040205/773d4142/attachment-0042.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sha00000.shar
Type: application/octet-stream
Size: 1514 bytes
Desc: "PGP.sig"
URL: <http://lists.dragonflybsd.org/pipermail/bugs/attachments/20040205/773d4142/attachment-0043.obj>


More information about the Bugs mailing list