]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
minor fixes, resulting in less warnings and better help messages
authorwww@jspc55 <www@jspc55>
Fri, 28 Mar 2014 14:58:19 +0000 (15:58 +0100)
committerwww@jspc55 <www@jspc55>
Fri, 28 Mar 2014 14:58:19 +0000 (15:58 +0100)
tools/adcmon.pl
tools/changeConfigVal.pl
tools/startup.pl
tools/xml2ini.pl
tools/xmlOperation.pl
tools/xmlOperations.pm

index 95a7e41b60eb4c2558e9fb850b56be6269fec63a..eccbe75ec388ebad4be8a92d973ae885c528be91 100755 (executable)
@@ -295,7 +295,8 @@ sub init_html{
   {'src'=>'../layout/adcmon.css'}
   ],
   -script=>[
-  { -type => 'text/javascript', -src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'},
+#   { -type => 'text/javascript', -src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'},
+  { -type => 'text/javascript', -src => '../scripts/jquery.min.js'},
   { -type => 'text/javascript', -src => './adcmon.js'},
   { -type => 'text/javascript', -src => '../scripts/jquery.timer.js'}
   ]
index 43fc88a24c042c2f883ff4463d3aa1059c142e14..505a0bba1c7f0b883ee279c54e6a801afac104d8 100755 (executable)
@@ -127,7 +127,7 @@ for my $line (@inputLines){
     if($field eq "*") { 
       $field = "";
     }
-    del($register,$field);
+    deleteEntry($register,$field);
   } else {
     save($register,$field,$value);
   }
@@ -158,10 +158,9 @@ Register/Field=Value
 
 changeConfigVal.pl -c config.xml [-v]
 
-the script reads STDIN in the following format (one line per command):
-
-Register/Field=Value
-
+The script parses STDIN for attribution directives in the format "registerName/fieldName=value" and applies
+these attributions to a denoted configuration XML file. Multiple attributions can be processed at
+the same time when separated by semicolon or line break
 
  Options:
    -h, --help       brief help message
index 90aaa5e13c3fbcae94d75f68f054af17ddc2e4bb..36a303c48797c800e3fd2625119770dad5ebf4e8 100755 (executable)
@@ -244,7 +244,7 @@ startup.pl - Run the necessary steps to configure and start MAPS sensors
 
 =head1 SYNOPSIS
 
-startup.pl filename
+startup.pl setupFile
 
  Options:
    -h, --help     brief help message
index 3d1049d81dec91322797c1f6652c25dd10f2d90d..cba58988a9f65c9de487918abbe89b9abe8f068f 100755 (executable)
@@ -269,8 +269,10 @@ xml2ini.pl -c config.xml [-o output.ini]
    -c, --config     specifies the input config xml file
    -o, --output     specifies the output filename, if ommitted,
                     the generated ini file is written to STDOUT
-   -t, --testblock  execute only testblock
-   
+                    
+This script creates a low level ini file for the JTAG programming script from a valid configuration XML
+file. The specification file which is used to build the ini file is referenced inside the configuration
+XML file and has not to be given as an argument.
 
 =back
 
index a582d49970d4d4f30445d98c20bb6cead5f41ff7..7d04d459462f4fea4781345793c62cf394e61123 100755 (executable)
@@ -25,44 +25,22 @@ use Environment;
 our $confDir = CONFDIR;
 our $specDir = SPECDIR;
 
+my $isHttpReq = $ENV{HTTP_USER_AGENT};
 
 my $q = CGI->new;
 
-print header;
-print start_html(
--title=>'xmlOperation',
--style=>{'src'=>'../layout/styles.css'}
-);
-
-print div({-class=>"header"},"Debug Output");
-
-
-unless ($q->param()){
-  print "usage:",br;
-  print escapeHTML("http://[...]/tools/xmlOperation.pl?action=[action]&[parameter]&[parameter]& ..."),br;
-  print br,br;
-  print "possible actions: save, delete, copyDefaultRegister, createFile, deleteFile, changeAncestor",br,br;
-  print "parameter summary:",br;
-  print "save a value into a specific field, optional: if you enter a numeric base, value will be saved in the specified format.:",br;
-  print escapeHTML("action=save&configFile=[configFile]&register=[register]&field=[field]&value=[value]&base=[base]"),br,br;
-  print "delete a specific field:",br;
-  print escapeHTML("action=delete&configFile=[configFile]&register=[register]&field=[field]"),br,br;
-  print "delete a whole register:",br;
-  print escapeHTML("action=delete&configFile=[configFile]&register=[register]"),br,br;
-  print "copy a register including default values from the specification to the config file:",br;
-  print escapeHTML("action=copyDefaultRegister&configFile=[configFile]&register=[register]"),br,br;
-  print "create a new config file based on the given specification file",br;
-  print escapeHTML("action=createFile&configFile=[configFile]&specFile=[specFile]"),br,br;
-  print "delete a config file",br;
-  print escapeHTML("action=deleteFile&configFile=[configFile]"),br,br;
-  print "change the ancestor (include directive) of config file",br;
-  print escapeHTML("action=changeAncestor&configFile=[configFile]&newAncestor=[newAncestor]"),br,br;
-  print "move/rename config file",br;
-  print escapeHTML("action=moveFile&configFile=[configFile]&newFile=[newFile]"),br,br;
-  print "copy config file",br;
-  print escapeHTML("action=copyFile&configFile=[configFile]&newFile=[newFile]"),br,br;
+print header('text/plain') if $isHttpReq;
+
+#   print header;
+#   print start_html(
+#   -title=>'xmlOperation',
+#   -style=>{'src'=>'../layout/styles.css'}
+#   );
+  
+  
+# print div({-class=>"header"},"Debug Output");
+
 
-}
 
 if ( defined $q->param('action') ) {
 
@@ -107,14 +85,14 @@ if ( defined $q->param('action') ) {
   }
   if ( $q->param('action') eq 'delete' ) {
     parseConfigFile( $q->param('configFile') );
-    del( $q->param('register'), $q->param('field') );
+    deleteEntry( $q->param('register'), $q->param('field') );
     writeConfigFile();
     report_param();
       exit;
   }
   if ( $q->param('action') eq 'copyDefaultRegister' ) {
     parseConfigAndSpec( $q->param('configFile') );
-    del( $q->param('register'), "" ); # delete existing register from setfile
+    deleteEntry( $q->param('register'), "" ); # delete existing register from setfile
     copyDefaultRegister( $q->param('register') );
     writeConfigFile();
     report_param();
@@ -142,12 +120,17 @@ if ( defined $q->param('action') ) {
   }
   
 
+} else {
+
+print_usage();
+
 }
 
 
 
 
-print end_html;
+
+# print end_html;
 
 sub report_param {
   print "action ".$q->param('action')." executed with following parameters:",br;
@@ -164,3 +147,62 @@ sub report_param {
   print "</table>";
 
 }
+
+sub print_usage{
+
+my $text = q%
+
+usage:
+
+  via CGI/HTTP request:
+  http://[...]/tools/xmlOperation.pl?action=[action]&[parameter]&[parameter]& ...
+
+  via command line:
+  xmlOperation.pl action=[action] [parameter] [parameter] ...
+  (just like the CGI request, just leave out ? and &)
+
+possible actions: save, delete, copyDefaultRegister, createFile, deleteFile, changeAncestor
+
+parameter summary:
+
+  save a value into a specific field, optional: if you enter a numeric base,
+  value will be saved in the specified format.:
+  action=save&configFile=[configFile]&register=[register]&field=[field]&value=[value]&base=[base]
+
+  delete a specific field:
+  action=delete&configFile=[configFile]&register=[register]&field=[field]
+
+  delete a whole register:
+  action=delete&configFile=[configFile]&register=[register]
+
+  copy a register including default values from the specification to the config file:
+  action=copyDefaultRegister&configFile=[configFile]&register=[register]
+
+  create a new config file based on the given specification file
+  action=createFile&configFile=[configFile]&specFile=[specFile]
+
+  delete a config file
+  action=deleteFile&configFile=[configFile]
+
+  change the ancestor (include directive) of config file
+  action=changeAncestor&configFile=[configFile]&newAncestor=[newAncestor]
+
+  move/rename config file
+  action=moveFile&configFile=[configFile]&newFile=[newFile]
+
+  copy config file
+  action=copyFile&configFile=[configFile]&newFile=[newFile]
+
+%;
+
+
+
+  if ( $isHttpReq ){
+    print "you have called this script via CGI\n";
+  } else {
+    print "you have called this script via command line\n";
+  }
+  print $text;
+  exit;
+
+}
\ No newline at end of file
index cf63c83412bf293e20f2576d281e1b3c5f9c1555..98a5b2161d0c43b903bb1b12fc5a087077af9b5f 100644 (file)
@@ -297,7 +297,7 @@ sub changeAncestor {
 # description: change the "inheritSettingsFrom" tag in the current configTree to "ancestorFileName"
 # make change permanent by calling writeConfigFile() hereafter.
 
-sub del {
+sub deleteEntry {
 
   my $registerName = $_[0];
   my $fieldName    = $_[1];