aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/page/filter.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2007-03-26 20:55:26 +0000
committerrsc <devnull@localhost>2007-03-26 20:55:26 +0000
commit05a4d855f167ae2d0d2c0ba0e386d933172b71ea (patch)
tree8a1c64cf67479d8cab98b70fd25a12929f566634 /src/cmd/page/filter.c
parent6c4c5c5b959ec8a2e85510bdf85339582f638f36 (diff)
downloadplan9port-05a4d855f167ae2d0d2c0ba0e386d933172b71ea.tar.gz
plan9port-05a4d855f167ae2d0d2c0ba0e386d933172b71ea.tar.bz2
plan9port-05a4d855f167ae2d0d2c0ba0e386d933172b71ea.zip
add page (Kris Maglione)
Diffstat (limited to 'src/cmd/page/filter.c')
-rw-r--r--src/cmd/page/filter.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/cmd/page/filter.c b/src/cmd/page/filter.c
index 319cfb68..415db038 100644
--- a/src/cmd/page/filter.c
+++ b/src/cmd/page/filter.c
@@ -1,9 +1,9 @@
#include <u.h>
#include <libc.h>
#include <draw.h>
-#include <cursor.h>
-#include <event.h>
+#include <thread.h>
#include <bio.h>
+#include <cursor.h>
#include "page.h"
Document*
@@ -24,7 +24,7 @@ initfilt(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf, char *type, cha
if(docopy){
if(pipe(p) < 0){
fprint(2, "pipe fails: %r\n");
- exits("Epipe");
+ threadexits("Epipe");
}
}else{
p[0] = open("/dev/null", ORDWR);
@@ -35,27 +35,29 @@ initfilt(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf, char *type, cha
switch(fork()){
case -1:
fprint(2, "fork fails: %r\n");
- exits("Efork");
+ threadexits("Efork");
default:
- close(p[1]);
+ close(p[0]);
if(docopy){
- write(p[0], buf, nbuf);
+ write(p[1], buf, nbuf);
if(b)
while((n = Bread(b, xbuf, sizeof xbuf)) > 0)
- write(p[0], xbuf, n);
+ write(p[1], xbuf, n);
else
while((n = read(stdinfd, xbuf, sizeof xbuf)) > 0)
- write(p[0], xbuf, n);
+ write(p[1], xbuf, n);
}
- close(p[0]);
+ close(p[1]);
waitpid();
break;
case 0:
- close(p[0]);
- dup(p[1], 0);
+ close(p[1]);
+ dup(p[0], 0);
dup(ofd, 1);
/* stderr shines through */
- execl("/bin/rc", "rc", "-c", cmd, nil);
+ if(chatty)
+ fprint(2, "Execing '%s'\n", cmd);
+ execlp("rc", "rc", "-c", cmd, nil);
break;
}
@@ -81,7 +83,7 @@ initdvi(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf)
*/
if(b == nil){ /* standard input; spool to disk (ouch) */
fd = spooltodisk(buf, nbuf, &name);
- sprint(fdbuf, "/fd/%d", fd);
+ sprint(fdbuf, "/dev/fd/%d", fd);
b = Bopen(fdbuf, OREAD);
if(b == nil){
fprint(2, "cannot open disk spool file\n");