chiark / gitweb /
Default cursor is LH one
[ypp-sc-tools.web-live.git] / pctb / convert.c
index 950300b588d1cc7e1e7fe9afc5409f0c4084c8d2..3c5af994c3f7c9db88c8cc22875b7979f6384bad 100644 (file)
@@ -66,7 +66,9 @@ FILE *screenshot_file;
 const char *o_ocean, *o_pirate;
 int o_quiet;
 
-enum flags o_flags= ff_dict_fetch|ff_dict_submit|ff_dict_pirate;
+enum flags o_flags=
+   ff_charset_allowedit |
+   ff_dict_fetch|ff_dict_submit|ff_dict_pirate;
 
 static void vbadusage(const char *fmt, va_list) FMT(1,0) NORET;
 static void vbadusage(const char *fmt, va_list al) {
@@ -82,9 +84,6 @@ static void open_screenshot_file(const char *mode) {
   if (!screenshot_file)
     fatal("could not open screenshots file `%s': %s",
          o_screenshot_fn, strerror(errno));
-
-  if ((o_flags & ff_upload) && !(o_flags & ff_testservers))
-    badusage("must not reuse screenshots for upload to live PCTB database");
 }
 
 static void run_analysis(void) {
@@ -95,7 +94,7 @@ static void run_analysis(void) {
   analyse(tf);
 
   if (o_flags & ff_upload) {
-    if (o_flags & ff_singlepage)
+    if (npages<=1)
       fatal("Recognition successful, but refusing to upload partial data\n"
            " (--single-page specified).  Specify an output mode?");
   }
@@ -130,7 +129,7 @@ void fetch_with_rsync(const char *stem) {
     if (DEBUGP(rsync))
       fprintf(stderr,"executing rsync to fetch %s to %s\n",remote,local);
     execlp(rsync, "rsync",
-          DEBUGP(rsync) ? "-vLt" : "-Lt",
+          DEBUGP(rsync) ? "-zvLt" : "-zLt",
           "--",remote,local,(char*)0);
     sysassert(!"exec rsync failed");
   }
@@ -198,7 +197,8 @@ int main(int argc, char **argv) {
     else if (IS("--find-island"))      o_flags |= ffs_printisland;
     else if (IS("--single-page"))      o_flags |= ff_singlepage;
     else if (IS("--quiet"))            o_quiet= 1;
-    else if (IS("--edit-charset"))     o_flags |= ff_editcharset;
+    else if (IS("--edit-charset"))     o_flags |= ff_charset_edit;
+    else if (IS("--no-edit-charset"))  o_flags &= ~(ffm_charset);
     else if (IS("--test-servers"))     o_flags |= ff_testservers;
     else if (IS("--dict-local-only"))  o_flags &= ~ffs_dict;
     else if (IS("--dict-read-only"))   o_flags &= (~ffs_dict | ff_dict_fetch);
@@ -300,13 +300,15 @@ int main(int argc, char **argv) {
     progress_log("OK for you to move the mouse now.");
   }
   if (o_mode & mf_readscreenshot) {
+    if ((o_flags & ff_upload) && !(o_flags & ff_testservers))
+      badusage("must not reuse screenshots for upload to live PCTB database");
     open_screenshot_file("r");
     if (o_flags & ff_singlepage) read_one_screenshot();
     else read_screenshots();
   }
   if (o_mode & mf_analyse) {
     if (o_flags & ff_needisland) {
-      find_islandname(page0_rgbimage);
+      find_islandname(page_images[0]->rgb);
       if (o_flags & ff_printisland)
        printf("%s, %s\n", archipelago, island);
       sysassert(! setenv("YPPSC_ISLAND",island,1) );