]> git.donarmstrong.com Git - bin.git/blobdiff - scan_stuff
add a VERBOSE flag to getmail
[bin.git] / scan_stuff
index b556d962c65cb5220ad39872c97e51af4df8adff..3b913aeb340fc943f7cca1b09555c09ac6b0ddcc 100755 (executable)
@@ -56,9 +56,13 @@ my %options = (device          => 'fujitsu',
                debug           => 0,
                help            => 0,
                man             => 0,
+               mode            => 'Gray'
               );
 
 GetOptions(\%options,
+           'duplex!',
+           'simplex!',
+           'mode=s',
            'debug|d+','help|h|?','man|m');
 
 pod2usage() if $options{help};
@@ -67,13 +71,21 @@ pod2usage({verbose=>2}) if $options{man};
 $DEBUG = $options{debug};
 
 my @USAGE_ERRORS;
-# if (1) {
-#     push @USAGE_ERRORS,"You must pass something";
-# }
+my $use_duplex = 1;
+if (exists $options{duplex} and exists $options{simplex} and
+    not ($options{duplex} xor $options{simplex})) {
+    push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
+}
 
 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
 
 
+if ((exists $options{duplex} and not $options{duplex}) or
+    (exists $options{simplex} and $options{simplex})) {
+    $use_duplex = 0;
+}
+
+
 use File::Find;
 
 if (@ARGV) {
@@ -92,8 +104,8 @@ find(sub { return if /^\./;
 $last_num++;
 
 exec('scanimage','-d',$options{device},
-     '--source','ADF Duplex','--mode','Gray','--format','tiff',
-     '--batch','out_'.sprintf('%03d',$lastnum).'_%03d.tif');
+     '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
+     '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');
 
 __END__