[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140901071632.28909.31322.stgit@zurg>
Date: Mon, 01 Sep 2014 11:16:32 +0400
From: Konstantin Khlebnikov <koct9i@...il.com>
To: Michal Marek <mmarek@...e.cz>, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org
Cc: Paul Bolle <pebolle@...cali.nl>,
Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH v2 2/4] scripts/config: add option for changing output for
undefined options
This patch adds command line option '--if-undef' which replaces string 'undef'
in output of next command '--state' with whatever you want.
Also it adds grep key -s to suppress error messages about nonexistent file.
Signed-off-by: Konstantin Khlebnikov <koct9i@...il.com>
---
scripts/config | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/scripts/config b/scripts/config
index 026aeb4..178652c 100755
--- a/scripts/config
+++ b/scripts/config
@@ -6,6 +6,9 @@ myname=${0##*/}
# If no prefix forced, use the default CONFIG_
CONFIG_="${CONFIG_-CONFIG_}"
+# Output for undefined options
+UNDEF="undef"
+
usage() {
cat >&2 <<EOL
Manipulate options in a .config file from the command line.
@@ -34,6 +37,7 @@ commands:
options:
--file config-file .config file to change (default .config)
--keep-case|-k Keep next symbols' case (dont' upper-case it)
+ --if-undef string Print this string instead of state "undef"
$myname doesn't check the validity of the .config file. This is done at next
make time.
@@ -152,6 +156,11 @@ while [ "$1" != "" ] ; do
B=$ARG
shift 2
;;
+ --if-undef)
+ UNDEF=$1
+ shift
+ continue
+ ;;
-*)
checkarg "$1"
shift
@@ -185,12 +194,12 @@ while [ "$1" != "" ] ; do
;;
--state|-s)
- if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
+ if grep -sq "# ${CONFIG_}$ARG is not set" $FN ; then
echo n
else
- V="$(grep "^${CONFIG_}$ARG=" $FN)"
+ V="$(grep -s "^${CONFIG_}$ARG=" $FN)"
if [ $? != 0 ] ; then
- echo undef
+ echo "${UNDEF}"
else
V="${V/#${CONFIG_}$ARG=/}"
V="${V/#\"/}"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists