Skip to content

Commit

Permalink
scripts/config: add option to undef a symbol
Browse files Browse the repository at this point in the history
It is currently possible to enable, disable or modularise
a symbol. Also, an undefined symbol is reported as such.

Add a new command to undefine a symbol, by removing the
corresponding line from the .config file.

Signed-off-by: "Yann E. MORIN" <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
yann-morin-1998 authored and michal42 committed Jun 28, 2012
1 parent f5ef2f7 commit d5bfb6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -134,6 +141,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
Expand Down

0 comments on commit d5bfb6b

Please sign in to comment.