summaryrefslogtreecommitdiff
path: root/sys/src/cmd/page.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-09-16 07:25:27 +0200
committercinap_lenrek <cinap_lenrek@centraldogma>2011-09-16 07:25:27 +0200
commite18a70a9487952902bc9a69f2a398bfc6e8620ea (patch)
treec8b5fb548e70f68cc57dffda21f148bdf3bddbbe /sys/src/cmd/page.c
parent84e88b845cb3e96e6e8ebe04a50694a29264560c (diff)
page: add cbz support
Diffstat (limited to 'sys/src/cmd/page.c')
-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)