config.pl get: be better behaved
When printing an option's value, print a newline at the end. When the requested option is missing, fail with status 1 (the usual convention for "not found") rather than -1 (which has a system-dependent effect).
This commit is contained in:
parent
58e5fdc0ca
commit
ad8b9ec9e9
1 changed files with 5 additions and 5 deletions
|
@ -56,7 +56,7 @@ Commands
|
|||
unset <symbol> - Comments out the #define for the given symbol if
|
||||
present in the configuration file.
|
||||
get <symbol> - Finds the #define for the given symbol, returning
|
||||
an exitcode of 0 if the symbol is found, and -1 if
|
||||
an exitcode of 0 if the symbol is found, and 1 if
|
||||
not. The value of the symbol is output if one is
|
||||
specified in the configuration file.
|
||||
full - Uncomments all #define's in the configuration file
|
||||
|
@ -220,7 +220,7 @@ for my $line (@config_lines) {
|
|||
}
|
||||
|
||||
# Did the set command work?
|
||||
if ($action eq "set"&& $force_option && !$done) {
|
||||
if ($action eq "set" && $force_option && !$done) {
|
||||
|
||||
# If the force option was set, append the symbol to the end of the file
|
||||
my $line = "#define $name";
|
||||
|
@ -236,14 +236,14 @@ if (defined $config_write) {
|
|||
}
|
||||
|
||||
if ($action eq "get") {
|
||||
if($done) {
|
||||
if ($done) {
|
||||
if ($value ne '') {
|
||||
print $value;
|
||||
print "$value\n";
|
||||
}
|
||||
exit 0;
|
||||
} else {
|
||||
# If the symbol was not found, return an error
|
||||
exit -1;
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue