ref: 7c911ddb9ad6bb8c8602b13478b78fa585df5ee8
parent: 159ec2bcd7132d65936f6abb4c918652072e7a1f
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;
}
--
⑨