From 6be352d49745cd1195e8108720819a57a9ae2289 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 26 Sep 2014 15:53:21 -0700 Subject: [PATCH] make scan stuff use simplex if specified and have more options in general --- scan_stuff | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scan_stuff b/scan_stuff index 8b08761..484ea31 100755 --- a/scan_stuff +++ b/scan_stuff @@ -56,9 +56,12 @@ my %options = (device => 'fujitsu', debug => 0, help => 0, man => 0, + mode => 'Gray' ); GetOptions(\%options, + 'duplex!', + 'simplex!', 'debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; @@ -67,13 +70,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,7 +103,7 @@ find(sub { return if /^\./; $last_num++; exec('scanimage','-d',$options{device}, - '--source','ADF Duplex','--mode','Gray','--format','tiff', + '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff', '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif'); __END__ -- 2.39.2