CIFS: Don't let read only caching for mandatory byte-range locked files
[firefly-linux-kernel-4.4.55.git] / scripts / config
index 9723c7de07cc1f2b905b48029ac677aeab3bfc32..bb4d3deb6d1c0add7815115a14a574212c0f3d90 100755 (executable)
@@ -17,6 +17,7 @@ commands:
                             Set option to "string"
        --set-val option value
                             Set option to value
+       --undefine|-u option Undefine option
        --state|-s option    Print state of option (n,y,m,undef)
 
        --enable-after|-E beforeopt option
@@ -73,6 +74,12 @@ set_var() {
        fi
 }
 
+undef_var() {
+       local name=$1
+
+       sed -ri "/^($name=|# $name is not set)/d" "$FN"
+}
+
 if [ "$1" = "--file" ]; then
        FN="$2"
        if [ "$FN" = "" ] ; then
@@ -94,7 +101,6 @@ while [ "$1" != "" ] ; do
        case "$CMD" in
        --keep-case|-k)
                MUNGE_CASE=no
-               shift
                continue
                ;;
        --refresh)
@@ -134,6 +140,9 @@ while [ "$1" != "" ] ; do
                set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
                shift
                ;;
+       --undefine|-u)
+               undef_var "${CONFIG_}$ARG"
+               ;;
 
        --state|-s)
                if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
@@ -146,7 +155,7 @@ while [ "$1" != "" ] ; do
                                V="${V/#${CONFIG_}$ARG=/}"
                                V="${V/#\"/}"
                                V="${V/%\"/}"
-                               V="${V/\\\"/\"}"
+                               V="${V//\\\"/\"}"
                                echo "${V}"
                        fi
                fi