diff options
-rw-r--r-- | getbnbook.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/getbnbook.c b/getbnbook.c index dba1856..a9ae88d 100644 --- a/getbnbook.c +++ b/getbnbook.c @@ -69,6 +69,21 @@ 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]; @@ -83,6 +98,11 @@ 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); |