5 void debug_flush(void) {
6 eassert(!fflush(debug));
7 eassert(!ferror(debug));
11 const char *get_vardir(void) { return "."; }
14 static enum { mode_all=03, mode_screenshot=01, mode_analyse=02 }
16 static char *o_screenshots_fn;
17 static int o_single_page;
19 FILE *screenshots_file;
21 int main(int argc, char **argv) {
25 while ((arg=*++argv)) {
26 if (!strcmp(arg,"--screenshots-only"))
27 o_mode= mode_screenshot;
28 else if (!strcmp(arg,"--analyse-only"))
30 else if (!strcmp(arg,"--single-page"))
32 else if (!strcmp(arg,"--screenshots-file"))
33 eassert( o_screenshots_fn= *++argv );
34 else if (!strcmp(arg,"--window-id")) {
36 eassert((arg=*++argv));
37 unsigned long windowid= strtoul(arg,&ep,0);
39 set_yppclient_window(windowid);
41 eassert(!"bad option");
44 if (!o_screenshots_fn) {
45 r= asprintf(&o_screenshots_fn,"%s/#pages#.ppm",get_vardir());
46 eassert(r>=0); eassert(o_screenshots_fn);
49 if (o_mode & mode_screenshot) {
51 find_yppclient_window();
52 screenshots_file= fopen(o_screenshots_fn, "w"); eassert(screenshots_file);
54 take_one_screenshot();
58 screenshots_file= fopen(o_screenshots_fn, "r"); eassert(screenshots_file);
61 if (o_mode & mode_analyse) {