chiark / gitweb /
document the options
[ypp-sc-tools.web-live.git] / pctb / convert.c
index ac3ceb3e44e2bf6910cdc6aa76fbacef24f3369d..eb7536d6fac4bcc3014f2b7c35880602febc3820 100644 (file)
@@ -47,11 +47,11 @@ static enum {
   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;
@@ -63,11 +63,11 @@ static void vbadusage(const char *fmt, va_list al) {
 }
 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) {
@@ -110,6 +110,8 @@ int main(int argc, char **argv) {
     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"))
@@ -121,8 +123,8 @@ int main(int argc, char **argv) {
             !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;
@@ -137,8 +139,8 @@ int main(int argc, char **argv) {
       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);
   }
 
@@ -147,12 +149,12 @@ int main(int argc, char **argv) {
     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();
   }