1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* See COPYING file for copyright, license and warranty details. */
#define VERSION "prealpha"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.c"
#define usage "getgbook bookid"
#define hostname "books.google.com"
int main(int argc, char *argv[])
{
int i, s;
char *bookid, url[80];
char *curpage;
FILE *srv;
if(argc != 2)
die("usage: " usage "\n");
bookid = argv[1];
i = dial(hostname, "80");
srv = fdopen(i, "r+");
snprintf(url, 80, "/books?id=%s&pg=%s&jscmd=click3", bookid, "PA1");
if((curpage = get(srv, hostname, url)) == NULL)
fprintf(stderr,"Error downloading page\n");
else {
fputs(curpage,stdout);
free(curpage);
}
return 0;
}
|