summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/page.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/src/cmd/page.c b/sys/src/cmd/page.c
index a0751a5eb..4a3842b94 100644
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -238,6 +238,36 @@ popenconv(Page *p)
return fd;
}
+int
+popentape(Page *p)
+{
+ char mnt[32], cmd[NPATH], *argv[4];
+
+ snprint(mnt, sizeof(mnt), "/n/tapefs.%.12d%.8lux", getpid(), (ulong)p);
+ switch(rfork(RFREND|RFPROC|RFFDG)){
+ case -1:
+ close(p->fd);
+ p->fd = -1;
+ return -1;
+ case 0:
+ dup(p->fd, 0);
+ argv[0] = "rc";
+ argv[1] = "-c";
+ snprint(cmd, sizeof(cmd), "%s -m %s /fd/0", p->data, mnt);
+ argv[2] = cmd;
+ argv[3] = nil;
+ exec("/bin/rc", argv);
+ sysfatal("exec: %r");
+ }
+ waitpid();
+ close(p->fd);
+ p->fd = -1;
+ p->open = popenfile;
+ p->data = strdup(mnt);
+ return p->open(p);
+}
+
+
typedef struct Ghost Ghost;
struct Ghost
{
@@ -525,6 +555,10 @@ popenfile(Page *p)
p->data = "doc2ps";
p->open = popengs;
}
+ else if(memcmp(buf, "PK\x03\x04", 4) == 0){
+ p->data = "fs/zipfs";
+ p->open = popentape;
+ }
else if(memcmp(buf, "GIF", 3) == 0)
p->data = "gif -t9";
else if(memcmp(buf, "\111\111\052\000", 4) == 0)