5 void debug_flush(void) {
6 eassert(!fflush(debug));
7 eassert(!ferror(debug));
11 const char *get_vardir(void) { return "."; }
26 static char *o_screenshots_fn;
27 static int o_single_page;
29 FILE *screenshots_file;
31 int main(int argc, char **argv) {
35 while ((arg=*++argv)) {
36 if (!strcmp(arg,"--find-window-only"))
37 o_mode= mode_findwindow;
38 else if (!strcmp(arg,"--screenshot-only"))
39 o_mode= mode_screenshot;
40 else if (!strcmp(arg,"--analyse-only"))
42 else if (!strcmp(arg,"--single-page"))
44 else if (!strcmp(arg,"--screenshots-file"))
45 eassert( o_screenshots_fn= *++argv );
47 else if (!strcmp(arg,"-D" #f)) \
48 debug_flags |= dbg_##f;
51 else if (!strcmp(arg,"--window-id")) {
53 eassert((arg=*++argv));
54 unsigned long windowid= strtoul(arg,&ep,0);
56 set_yppclient_window(windowid);
58 eassert(!"bad option");
61 if (!o_screenshots_fn) {
62 r= asprintf(&o_screenshots_fn,"%s/#pages#.ppm",get_vardir());
63 eassert(r>=0); eassert(o_screenshots_fn);
66 if (o_mode & mf_findwindow) {
68 find_yppclient_window();
70 if (o_mode & mf_screenshot) {
71 screenshots_file= fopen(o_screenshots_fn, "w"); eassert(screenshots_file);
73 take_one_screenshot();
77 screenshots_file= fopen(o_screenshots_fn, "r"); eassert(screenshots_file);
80 if (o_mode & mf_analyse) {