diff -ur srcx.orig/vpsprntr.cxx srcx/vpsprntr.cxx --- srcx.orig/vpsprntr.cxx Wed Mar 6 16:22:30 1996 +++ srcx/vpsprntr.cxx Wed Jun 25 16:49:02 1997 @@ -14,6 +14,11 @@ #include #include +#include +#include +#include +#include + #define prompt_width 32 #define prompt_height 32 static unsigned char prompt_bits[] = { @@ -165,7 +170,42 @@ if (_pstream) _pstream->close(); - _pstream = new ofstream(_name); // open output stream + if (_name[0]=='|') + { + char *cmdname = (char *)&_name[1]; + + fprintf(stderr, "%s\n", cmdname); + + int pipe_fd[2]; + + pipe(pipe_fd); + + if (fork() == 0) // child + { + + close(pipe_fd[1]); // unidirectional pipe + + close(0); dup(pipe_fd[0]); close(pipe_fd[0]); + execlp(cmdname, cmdname, NULL); + + } + else // parent + { + + close(pipe_fd[0]); // unidirectional pipe + + } + + _pstream = new ofstream(pipe_fd[1]); + + } + else + { + + _pstream = new ofstream(_name); // open output stream + + } + return _pstream; } @@ -175,6 +215,9 @@ if (_pstream) _pstream->close(); delete _pstream; + + if (_name[0] == '|') wait(NULL); + _pstream = 0; }