From: www@jspc55 Date: Fri, 28 Mar 2014 14:58:19 +0000 (+0100) Subject: minor fixes, resulting in less warnings and better help messages X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=bebff7e037ad3f99cade83f19736014bead3690c;p=mvdsensorcontrol.git minor fixes, resulting in less warnings and better help messages --- diff --git a/tools/adcmon.pl b/tools/adcmon.pl index 95a7e41..eccbe75 100755 --- a/tools/adcmon.pl +++ b/tools/adcmon.pl @@ -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'} ] diff --git a/tools/changeConfigVal.pl b/tools/changeConfigVal.pl index 43fc88a..505a0bb 100755 --- a/tools/changeConfigVal.pl +++ b/tools/changeConfigVal.pl @@ -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 diff --git a/tools/startup.pl b/tools/startup.pl index 90aaa5e..36a303c 100755 --- a/tools/startup.pl +++ b/tools/startup.pl @@ -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 diff --git a/tools/xml2ini.pl b/tools/xml2ini.pl index 3d1049d..cba5898 100755 --- a/tools/xml2ini.pl +++ b/tools/xml2ini.pl @@ -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 diff --git a/tools/xmlOperation.pl b/tools/xmlOperation.pl index a582d49..7d04d45 100755 --- a/tools/xmlOperation.pl +++ b/tools/xmlOperation.pl @@ -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]®ister=[register]&field=[field]&value=[value]&base=[base]"),br,br; - print "delete a specific field:",br; - print escapeHTML("action=delete&configFile=[configFile]®ister=[register]&field=[field]"),br,br; - print "delete a whole register:",br; - print escapeHTML("action=delete&configFile=[configFile]®ister=[register]"),br,br; - print "copy a register including default values from the specification to the config file:",br; - print escapeHTML("action=copyDefaultRegister&configFile=[configFile]®ister=[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 ""; } + +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]®ister=[register]&field=[field]&value=[value]&base=[base] + + delete a specific field: + action=delete&configFile=[configFile]®ister=[register]&field=[field] + + delete a whole register: + action=delete&configFile=[configFile]®ister=[register] + + copy a register including default values from the specification to the config file: + action=copyDefaultRegister&configFile=[configFile]®ister=[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 diff --git a/tools/xmlOperations.pm b/tools/xmlOperations.pm index cf63c83..98a5b21 100644 --- a/tools/xmlOperations.pm +++ b/tools/xmlOperations.pm @@ -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];