page: generalize html support

front
cinap_lenrek 2011-09-17 12:21:24 +02:00
parent 6bf47606de
commit 35fcb73f86
1 changed files with 5 additions and 3 deletions

View File

@ -148,7 +148,7 @@ createtmp(ulong id, char *pfx)
{ {
char nam[64]; 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); return create(nam, OEXCL|ORCLOSE|ORDWR, 0600);
} }
@ -323,10 +323,10 @@ popenepub(Page *p)
addpage(p, shortname(buf), popenfile, strdup(buf), -1); addpage(p, shortname(buf), popenfile, strdup(buf), -1);
} }
close(fd); close(fd);
p->text = strdup(p->label);
return -1; return -1;
} }
typedef struct Ghost Ghost; typedef struct Ghost Ghost;
struct Ghost struct Ghost
{ {
@ -623,7 +623,9 @@ popenfile(Page *p)
p->data = "lp -dstdout"; p->data = "lp -dstdout";
p->open = popengs; 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->data = "htmlfmt -c utf8 | lp -dstdout";
p->open = popengs; p->open = popengs;
} }