Hello
Could you give me an idea how to organize Unix pipe
with some Unix utility (Like Unix POPEN system call does)?
I'm using CMUCL 18c on Slackware 7.0.
I could think about two ways of doing that
1) UNIX:UNIX-PIPE
UNIX:UNIX-FORK
UNIX:UNIX-EXECVE
2) Using ALIEN to write some interfacing C function
to POPEN and call it from Lisp.
3) Something else ?
Even if you don't recommend 1) any example of doing
such things will be _appreciated_.
Best regards
--
Vladimir Zolotych ······@eurocom.od.ua
In article <·················@eurocom.od.ua>,
"Vladimir V. Zolotych" <······@eurocom.od.ua> writes:
> Hello
>
> Could you give me an idea how to organize Unix pipe
> with some Unix utility (Like Unix POPEN system call does)?
> I'm using CMUCL 18c on Slackware 7.0.
> 3) Something else ?
How about CMUCL's run-program?
Mike McDonald
·······@mikemac.com
Vladimir V. Zolotych <······@eurocom.od.ua> wrote:
> Hello
> Could you give me an idea how to organize Unix pipe
> with some Unix utility (Like Unix POPEN system call does)?
> I'm using CMUCL 18c on Slackware 7.0.
> I could think about two ways of doing that
> 1) UNIX:UNIX-PIPE
> UNIX:UNIX-FORK
> UNIX:UNIX-EXECVE
I don't know how to do that in LISP.
But what popen(3) does is:
- create a pipe
- fork a child
- closing unused ends of the pipe
- execing a shell to execute the command
- waiting for the command to terminate
I think you then should also implement the pclose(3) function....
BTW: Are you really shure that you want to use (reimplement)
popen(3) and not fork(2) and exec(3) directly?
The popen always calls a shell before starting the
program to exec; and that may be overhead...
Ciao,
Oliver