diff --git a/functions b/functions index 5ff4a9b7ca..0280b2bcc4 100644 --- a/functions +++ b/functions @@ -729,6 +729,8 @@ function iniset() { local option=$3 local value=$4 + [[ -z $section || -z $option ]] && return + if ! grep -q "^\[$section\]" "$file" 2>/dev/null; then # Add section at the end echo -e "\n[$section]" >>"$file" diff --git a/lib/config b/lib/config index 91cefe48cc..c28072fc08 100644 --- a/lib/config +++ b/lib/config @@ -95,7 +95,7 @@ function merge_config_file() { /^ *\#/ { next } - /^.+/ { + /^[^ \t]+/ { split($0, d, " *= *") print "iniset " configfile " " section " " d[1] " \"" d[2] "\"" } diff --git a/tests/functions.sh b/tests/functions.sh index 40376aa63f..95dafe1028 100755 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -38,195 +38,6 @@ if [[ $? = 0 ]]; then fi -echo "Testing INI functions" - -cat >test.ini <test.ini <