ref: 35fcb73f86518e00fb002c98d0d0a39eef9209fa
parent: 6bf47606dec88a77390df6dae6ab27f9533cf0a1
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sat Sep 17 08:21:24 EDT 2011
page: generalize html support
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -148,7 +148,7 @@
{
char nam[64];
- snprint(nam, sizeof nam, "%s%s%.12d%.8lux", pagespool, pfx, getpid(), id ^ 0xcafebabe);
+ snprint(nam, sizeof nam, "%s%s%.12d%.8lux", pagespool, pfx, getpid(), id);
return create(nam, OEXCL|ORCLOSE|ORDWR, 0600);
}
@@ -323,10 +323,10 @@
addpage(p, shortname(buf), popenfile, strdup(buf), -1);
}
close(fd);
+ p->text = strdup(p->label);
return -1;
}
-
typedef struct Ghost Ghost;
struct Ghost
{
@@ -623,7 +623,9 @@
p->data = "lp -dstdout";
p->open = popengs;
}
- else if(memcmp(buf, "<?xml", 5) == 0){
+ else if(cistrncmp(buf, "<?xml", 5) == 0 ||
+ cistrncmp(buf, "<!DOCTYPE", 9) == 0 ||
+ cistrncmp(buf, "<HTML", 5) == 0){
p->data = "htmlfmt -c utf8 | lp -dstdout";
p->open = popengs;
}