From: local account Date: Thu, 26 Jun 2014 19:41:15 +0000 (+0200) Subject: corrected missing negative hex-offset-value support, mt X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=a9ea077d6e47e520b3cc828d7ed63bcc96fc04d0;p=daqtools.git corrected missing negative hex-offset-value support, mt --- diff --git a/thresholds/write_thresholds.pl b/thresholds/write_thresholds.pl index dfd091b..661b710 100755 --- a/thresholds/write_thresholds.pl +++ b/thresholds/write_thresholds.pl @@ -17,21 +17,28 @@ my $result = GetOptions ( ); if($help) { - usage(); - exit; + usage(); + exit; +} if ($offset) { + my $sign = 1; + if( $offset =~/^-/ ) { + $offset =~ s/^-//; + $sign = -1; + } + if($offset =~ /^0x/) { - $offset = hex($offset); + $offset = hex($offset) * $sign; } else { die "wrong number format for offset parameter: \"$offset\"" unless $offset =~ /^\d+$/; - $offset = int($offset); + $offset = int($offset) * $sign; } #print "called with offset: $offset\n"; } -} + trb_init_ports() or die trb_strerror();