[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reciproc pipe()
From: |
William Park |
Subject: |
Re: reciproc pipe() |
Date: |
Mon, 05 Sep 2005 00:15:47 -0400 |
User-agent: |
tin/1.6.2-20030910 ("Pabbay") (UNIX) (Linux/2.6.12-smp (i686)) |
Robert Millan <rmh@aybabtu.com> wrote:
>
> Hi!
>
> Is there any way to tell bash to do something like this? If there isn't, I
> think it would be nice to have it (maybe through a builtin or something).
>
> int p1[2];
> int p2[2];
>
> pipe(p1);
> pipe(p2);
>
> if (fork () == 0)
> {
> close (0); dup (p1[0]);
> close (1); dup (p2[1]);
> exec(whatever);
> }
>
> if (fork () == 0)
> {
> close (0); dup (p2[0]);
> close (1); dup (p1[1]);
> exec(whatever);
> }
>
> I.e, each process communicates with the other via stdin/stdout, and we get the
> actual results via stderr.
Where would you use it?
--
William Park <opengeometry@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
.
- reciproc pipe(), Robert Millan, 2005/09/02
- Re: reciproc pipe(),
William Park <=