diff options
author | Nick White <git@njw.me.uk> | 2011-08-21 17:22:35 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2011-08-21 17:22:35 +0100 |
commit | 043da4609ae6f9e229f0f03d602f57908f66879a (patch) | |
tree | 287d1d9a5f25872e855597dcf4ce0d217dce0314 /getgbook.c | |
parent | 0fedff7492d97609cdfc5a02a883bdfd693f4dbb (diff) |
Fix reporting of no pages available
Diffstat (limited to 'getgbook.c')
-rw-r--r-- | getgbook.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -33,10 +33,10 @@ int getpagelist(char *bookid, Page **pages) snprintf(url, URLMAX, "/books?id=%s&printsec=frontcover", bookid); if(!get("books.google.com", url, NULL, NULL, &buf)) - return -1; + return 0; if((s = strstr(buf, "_OC_Run({\"page\":[")) == NULL) - return -1; + return 0; s+=strlen("_OC_Run({\"page\":["); for(i=0, p=pages[0];*s; s++) { @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) page = malloc(sizeof(*page) * MAXPAGES); for(i=0; i<MAXPAGES; i++) page[i] = malloc(sizeof(**page)); if(!(totalpages = getpagelist(bookid, page))) { - fprintf(stderr, "Could not find pages for %s\n", bookid); + fprintf(stderr, "Could not find any pages for %s\n", bookid); return 1; } for(i=0; i<totalpages; i++) { |