First of all. Standard input has a file handle of 0 and standard output
has a file handle of 1.
Input redirection is done by closing the handle 0 and after that simply
opening a new file. The new file will have the handle number of 0.
Output redirection is done in the same way. First close handle 1 and then
open the file to redirect to.
Under MSXDOS2 the output of the first process is redirected to a temporary
file.
The second process closes its standard input handle of 0 and opens
the temporary file of the first process. And so on.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
> Of Adriano
> Camargo Rodrigues da Cunha
> Sent: Thursday, November 25, 1999 3:01 PM
> To: MSX International Mailing List
> Subject: Piping
>
>
>
> Hi,
>
> Does anyone knows how a pipe between processes is implemented by
> UNIX shells?
> I think that lauching all processes at the same time and piping
> one to another is an extreme waste of resources. And I know
> that MS-DOS
> and MSXDOS2 have pipes and they are monotask OSs.
> For example:
>
> cat fudeba.txt | head 20 | tail 10 | less
>
> What is the (best) approach? I think that making 4
> fork()/exec()
> is an extreme waste of system resources. And I don't know how
> making the
> pipe in a serialized way.
> I tried to understand the code of the clam shell, but I
> couldn't. :P
>
> [btw, it's not off-topic. it's related to UZIX, even if some
> people doesn't like it]
>
> Thanks,
>
>
> Adriano Camargo Rodrigues da Cunha
> ([EMAIL PROTECTED])
> Engenharia de Computacao - UNICAMP
> http://www.adrpage.cjb.net
http://if.you.dont.like.msx.usuck.com
* Bug (n) Technology originally developed by Microsoft in the 1980s. *
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED]
(www.stack.nl/~wiebe/mailinglist/)
****
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****