From: Albrecht Kleine (kleine@ak.sax.de)
Date: Fri Dec 08 2000 - 20:48:53 CET
Hi, everyone!
> I also have my *desiderata* list: it is possible, in e3vi command-line
> mode, to call "ex" command such "1,$ s/X/Y"?
>
> Michele
Okay Michele, you could get it :) But unfortunately I need some HELP!
For the 1st time I've written assembler code for two pipes in a bidirectional
connection using e3 as a parent and "sed" as a child, but only small test
cases < 4 kbyte are working okay :-((
Because assembler sources are hard to explain let me include some
quite similar C code.
......
pipe(fd1);
pipe(fd2);
if(fork()>0)
{
close(fd1[0]);
close(fd2[1]);
strcpy(command,"s/foo/bar/");
write(fd1[1],"a foo test\n",11);
// if writing more than 20480 byte pipe hangs
close(fd1[1]);
// if missing, pipe hangs, at least with 'sed' child
n=read(fd2[0],buf,20480);
// never got more than 4096 byte!
close(fd2[0]);
buf[n]=0;printf("%s",buf);
}
else
{
close(fd1[1]);
close(fd2[0]);
dup2(fd1[0],STDIN_FILENO);
close(fd1[0]);
dup2(fd2[1],STDOUT_FILENO);
close(fd2[1]);
exec....("sed","sed","-e",command,NULL);
exit
}
.....
(Keep in mind that I'm not using this C code, but 1:1 assembler code
using similar _kernel_ calls, not _libc_ calls.)
How this is to change to pass data up to 1 MB to sed and vice versa
w/o blocking?
I don't think that's a special assembler problem, but I don't
need hints like "Why not use popen()?". Only solutions using
direct kernel calls can help, no libc-depending wrapped stuff.
If you can't help, please feel free to forward to someone else
you expect he|she can help.
Cheers
Albrecht
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk
This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:17 CET