mode_all= 0111,
} o_mode= mode_all;
-static char *o_screenshots_fn;
+static char *o_screenshot_fn;
static int o_single_page, o_quiet;
static const char *o_outputmode= "upload";
-FILE *screenshots_file;
+FILE *screenshot_file;
static void vbadusage(const char *fmt, va_list) FMT(1,0) NORET;
}
DEFINE_VWRAPPERF(static, badusage, NORET);
-static void open_screenshots_file(const char *mode) {
- screenshots_file= fopen(o_screenshots_fn, mode);
- if (!screenshots_file)
+static void open_screenshot_file(const char *mode) {
+ screenshot_file= fopen(o_screenshot_fn, mode);
+ if (!screenshot_file)
fatal("could not open screenshots file `%s': %s",
- o_screenshots_fn, strerror(errno));
+ o_screenshot_fn, strerror(errno));
}
static void run_analysis(void) {
progress("running recognition...");
analyse(tf);
+ if (o_single_page && !strcmp(o_outputmode,"upload"))
+ fatal("Recognition successful, but refusing to upload partial data\n"
+ " (--single-page specified). Specify an output mode?");
+
sysassert( fseek(tf,0,SEEK_SET) == 0);
progress_log("processing results (--%s)...", o_outputmode);
else if (!strcmp(arg,"--analyse-only") ||
!strcmp(arg,"--same"))
o_mode= mode_analyse;
+ else if (!strcmp(arg,"--everything"))
+ o_mode= mode_all;
else if (!strcmp(arg,"--single-page"))
o_single_page= 1;
else if (!strcmp(arg,"--quiet"))
!strcmp(arg,"--tsv") ||
!strcmp(arg,"--best-prices"))
o_outputmode= arg+2;
- else if (!strcmp(arg,"--screenshots-file"))
- o_screenshots_fn= ARGVAL;
+ else if (!strcmp(arg,"--screenshot-file"))
+ o_screenshot_fn= ARGVAL;
#define DF(f) \
else if (!strcmp(arg,"-D" #f)) \
debug_flags |= dbg_##f;
badusage("unknown option `%s'",arg);
}
- if (!o_screenshots_fn) {
- r= asprintf(&o_screenshots_fn,"%s/#pages#.ppm",get_vardir());
+ if (!o_screenshot_fn) {
+ r= asprintf(&o_screenshot_fn,"%s/#pages#.ppm",get_vardir());
sysassert(r>=0);
}
find_yppclient_window();
}
if (o_mode & mf_screenshot) {
- open_screenshots_file("w");
+ open_screenshot_file("w");
if (o_single_page) take_one_screenshot();
else take_screenshots();
}
if (o_mode & mf_readscreenshot) {
- open_screenshots_file("r");
+ open_screenshot_file("r");
if (o_single_page) read_one_screenshot();
else read_screenshots();
}