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);
typ = snooptype(fd);
}
if(typ == COMPRESS){
fd=pipeline("/bin/uncompress", fd);
typ = snooptype(fd);
}
switch(typ){
default:
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);
break;
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 PNG:
case BMP:

View file

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