diff options
Diffstat (limited to 'getbnbook.c')
-rw-r--r-- | getbnbook.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/getbnbook.c b/getbnbook.c index a9ae88d..a10d98e 100644 --- a/getbnbook.c +++ b/getbnbook.c @@ -33,7 +33,6 @@ int getpagelist() char *s, *l; int i, num; char avail[STRMAX]; - char dummy1[STRMAX], dummy2[STRMAX]; numpages = 0; @@ -57,7 +56,10 @@ int getpagelist() for(i=0, s=buf;*s && i<MAXPAGES; s++) { if((s = strstr(s, "<page ")) == NULL) break; - sscanf(s, "<page sequence=\"%d\" type=\"bitmap\" toc=\"%[^\"]\" folio=\"%[^\"]\" freevendstatus=\"%[^\"]\" />", &num, dummy1, dummy2, avail); + sscanf(s, "<page sequence=\"%d\"", &num); + if((s = strstr(s, "freevendstatus")) == NULL) + break; + sscanf(s, "freevendstatus=\"%[^\"]\"", avail); if(strncmp(avail, "true", STRMAX) == 0) pages[i++] = num; @@ -69,21 +71,6 @@ int getpagelist() return 0; } -int isflash(char *path) -{ - FILE *f; - int ret; - - if((f = fopen(path, "rb")) == NULL) - return 1; - - ret = fgetc(f) == 'F' ? 1 : 0; - - fclose(f); - - return ret; -} - int getpage(int pagenum) { char path[STRMAX], pageurl[STRMAX]; @@ -98,11 +85,6 @@ int getpage(int pagenum) fprintf(stderr, "%d failed\n", pagenum); return 1; } - if(isflash(path)) { - fprintf(stderr, "%d not found\n", pagenum); - remove(path); - return 1; - } renameifjpg(path); printf("%d downloaded\n", pagenum); |