mothra: animated gifs, page: cleanup

This commit is contained in:
cinap_lenrek 2011-10-05 00:05:51 +02:00
parent 3efbb4fa00
commit 569e0181b2
2 changed files with 17 additions and 2 deletions

View file

@ -954,6 +954,10 @@ void geturl(char *urlname, int method, char *body, int cache, int map){
fd=pipeline("/bin/gunzip", fd); fd=pipeline("/bin/gunzip", fd);
typ = snooptype(fd); typ = snooptype(fd);
} }
if(typ == COMPRESS){
fd=pipeline("/bin/uncompress", fd);
typ = snooptype(fd);
}
switch(typ){ switch(typ){
default: default:
message("Bad type %x in geturl", typ); message("Bad type %x in geturl", typ);
@ -991,6 +995,17 @@ void geturl(char *urlname, int method, char *body, int cache, int map){
setcurrent(i, selection->tag); setcurrent(i, selection->tag);
break; break;
case GIF: case GIF:
if(rfork(RFFDG|RFPROC|RFNAMEG|RFNOWAIT) == 0){
snprint(cmd, sizeof(cmd), "-pid %d", getpid());
if(newwindow(cmd) != -1){
close(1); open("/dev/cons", OWRITE);
print("reading gif...\n");
filter("gif", fd);
}
exits(nil);
}
close(fd);
break;
case JPEG: case JPEG:
case PNG: case PNG:
case BMP: case BMP:

View file

@ -625,7 +625,7 @@ popenfile(Page *p)
{ {
static struct { static struct {
char *typ; char *typ;
void *popen; void *open;
void *data; void *data;
} tab[] = { } tab[] = {
"application/pdf", popengs, nil, "application/pdf", popengs, nil,
@ -709,7 +709,7 @@ popenfile(Page *p)
} }
p->fd = fd; p->fd = fd;
p->data = tab[i].data; p->data = tab[i].data;
p->open = tab[i].popen; p->open = tab[i].open;
if(seek(fd, 0, 0) < 0) if(seek(fd, 0, 0) < 0)
goto Noseek; goto Noseek;
if((i = read(fd, buf+n, n)) < 0) if((i = read(fd, buf+n, n)) < 0)