From a9ea077d6e47e520b3cc828d7ed63bcc96fc04d0 Mon Sep 17 00:00:00 2001 From: local account Date: Thu, 26 Jun 2014 21:41:15 +0200 Subject: [PATCH] corrected missing negative hex-offset-value support, mt --- thresholds/write_thresholds.pl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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(); -- 2.43.0