I still need to do some cleanups in the documentation. However, with one
*BIG* caveat, this should be read.
The *BIG* caveat is that I need some help looking over the ExternalParser
code. I switched it to using fork/exec to escape the whole question of
escaping shell metacharaters. On the other hand, it doesn't seem to be
returning output from the external parser...
Attached is a small program that should look similar to the current
ExternalParser code. For example:
gcc -o testfork testfork.c
./testfork echo foo
Output from child:
foo
I will try to take a look at this later tonight, but the more eyes, the
better.
Thanks very much, I apologize for the fairly broken snapshot--I'll take
another one mid-week as a prerelease version.
-Geoff
#include <unistd.h>
#include <stdio.h>
int main(int argc, char ** argv, char ** envp)
{
int pid;
int cp[2]; /* Child to parent pipe */
char ch;
int incount = 0, outcount = 0;
if( pipe(cp) < 0)
{
perror("Can't make pipe");
exit(1);
}
/* Create a child to run command. */
switch( pid = fork() )
{
case -1:
perror("Can't fork");
exit(1);
case 0:
/* Child. */
close(1); /* Close current stdout. */
dup( cp[1]); /* Make stdout go to write
end of pipe. */
close(0); /* Close current stdin. */
close( cp[0]);
execvp(argv[1], argv + 1);
perror("No exec");
exit(1);
default:
/* Parent. */
printf("\nOutput from child:\n");
close(cp[1]);
while( read(cp[0], &ch, 1) == 1)
{
write(1, &ch, 1);
outcount++;
}
exit(0);
}
exit(0);
}
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED]
You will receive a message to confirm this.