1#!@PERL 2eval 'exec @PERL@ -S $0 ${1+"$@"}' 3 if $running_under_some_shell; 4 # this emulates #! processing on NIH machines. 5 # (remove #! line above if indigestible) 6 7use Getopt::Std; 8my(%args,%options); 9# get the arguments 10getopts( 11 "a:b:cd:e:f:g:h:i:j:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:" . 12 "A:B:C:D:E:F:G:H:I:J:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:", 13 \%args ); 14 15# Now handle options 16# set :key=value -> $option{$key}=$value 17# set :key@ -> $option{$key}="0" 18# set :key -> $option{$key}="1" 19 20 map { 21 if( m/^\s*:([^=]+)=(.*)/ ){ 22 $options{$1}=$2; 23 } elsif( m/^\s*:([^=]+)\@$/ ){ 24 $options{$1}="0"; 25 } elsif( m/^\s*:([^=]+)/ ){ 26 $options{$1}="1"; 27 } elsif( m/^\s*([^|]+)/ ){ 28 $options{"Printer"}=$1; 29 } 30 } split( "\n", $ENV{'PRINTCAP_ENTRY'}); 31 32# get the control file entries 33 34 map { 35 if( m/^\s*([A-Z])(.*)/ ){ 36 $options{$1}=$2; 37 } elsif( m/^\s*([a-z])/ ){ 38 $options{'Format'}=$1; 39 } 40 } split( "\n", $ENV{'CONTROL'}); 41 42 for (keys %options){ print "option $_='$options{$_}'\n"; } 43 while( <> ){ 44 print; 45 } 46