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).
diff --git a/scripts/config.pl b/scripts/config.pl
index 9fc6062..b99140a 100755
--- a/scripts/config.pl
+++ b/scripts/config.pl
@@ -56,7 +56,7 @@
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 @@
}
# 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 ($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;
}
}