summaryrefslogtreecommitdiff
path: root/getgbook.c
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-08-21 17:22:35 +0100
committerNick White <git@njw.me.uk>2011-08-21 17:22:35 +0100
commit043da4609ae6f9e229f0f03d602f57908f66879a (patch)
tree287d1d9a5f25872e855597dcf4ce0d217dce0314 /getgbook.c
parent0fedff7492d97609cdfc5a02a883bdfd693f4dbb (diff)
Fix reporting of no pages available
Diffstat (limited to 'getgbook.c')
-rw-r--r--getgbook.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/getgbook.c b/getgbook.c
index e60316f..3fbdf47 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -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++) {