[sane-devel] Prompted batch-scan with scanimage

Dominik Fischer dom_fischer at web.de
Sun Feb 15 21:03:23 GMT 2004


Quoting Julien BLACHE <jb at jblache.org>:
> Send it to the list, so everybody will see it and it will be archived,
> which can be useful in the future.
>
> Maybe it'll make its way to the CVS and the next version ;)

Hi,
here it comes... (I hope inline is okay)

Kind regards
Dominik Fischer

------8<--------8<------
--- sane-backends-1.0.12/frontend/scanimage.c	2003-03-02 17:59:34.000000000
+0100
+++ sane-backends-1.0.12/frontend/scanimage.c-promptedbatch	2004-02-12
20:14:43.080162500 +0100
@@ -70,6 +70,7 @@
 #define OPTION_BATCH_START_AT	1004
 #define OPTION_BATCH_DOUBLE	1005
 #define OPTION_BATCH_INCREMENT	1006
+#define OPTION_BATCH_PROMPT	1007

 #define BATCH_COUNT_UNLIMITED -1

@@ -86,6 +87,7 @@
   {"batch-start", required_argument, NULL, OPTION_BATCH_START_AT},
   {"batch-double", no_argument, NULL, OPTION_BATCH_DOUBLE},
   {"batch-increment", required_argument, NULL, OPTION_BATCH_INCREMENT},
+  {"batch-prompt", no_argument, NULL, OPTION_BATCH_PROMPT},
   {"format", required_argument, NULL, OPTION_FORMAT},
   {"accept-md5-only", no_argument, NULL, OPTION_MD5},
   {"icc-profile", required_argument, NULL, 'i'},
@@ -1458,6 +1460,7 @@
   const char *defdevname = 0;
   const char *format = 0;
   int batch = 0;
+  int batch_prompt = 0;
   int batch_count = BATCH_COUNT_UNLIMITED;
   int batch_start_at = 1;
   int batch_increment = 1;
@@ -1465,6 +1468,8 @@
   char *full_optstring;
   SANE_Int version_code;

+  char readbuf[2];
+  char *readbuf2;
   atexit (scanimage_exit);

   prog_name = strrchr (argv[0], '/');
@@ -1511,6 +1516,9 @@
 	case 'n':
 	  dont_scan = 1;
 	  break;
+	case OPTION_BATCH_PROMPT:
+          batch_prompt = 1;
+          break;
 	case OPTION_BATCH_INCREMENT:
 	  batch_increment = atoi (optarg);
 	  break;
@@ -1961,6 +1969,12 @@

 	  if (batch)
 	    {
+              if (batch_prompt)
+                {
+                  fprintf (stderr, "Place document no. %d on the scanner.\n",
n);
+                  fprintf (stderr, "Press <RETURN> to continue.\n");
+                  readbuf2=fgets(readbuf, 2, stdin);
+                }
 	      fprintf (stderr, "Scanning page %d\n", n);
 	    }
 	  status = scan_it ();


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the sane-devel mailing list