]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
corrected missing negative hex-offset-value support, mt
authorlocal account <hadaq@dircdaq002.gsi.de>
Thu, 26 Jun 2014 19:41:15 +0000 (21:41 +0200)
committerlocal account <hadaq@dircdaq002.gsi.de>
Thu, 26 Jun 2014 19:41:15 +0000 (21:41 +0200)
thresholds/write_thresholds.pl

index dfd091b49ef6962163a8816157d12ef04897c1c3..661b7106f16e8dc7d68477a048e761a6d9742fa3 100755 (executable)
@@ -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();