diff mbox

[1/2] scripts/config: replace hard-coded script name by a dynamic value

Message ID 9442eebf0117a0d975ca766ea84efec4ad58c6d0.1368379475.git.chauplac@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Clement Chauplannaz May 12, 2013, 7:08 p.m. UTC
The script `config' prints its name in usage() function. It is currently
hard-coded to value `config'. However, the script may be reused under
a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
---
 scripts/config | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Andi Kleen May 12, 2013, 7:25 p.m. UTC | #1
On Sun, May 12, 2013 at 09:08:51PM +0200, Clement Chauplannaz wrote:
> The script `config' prints its name in usage() function. It is currently
> hard-coded to value `config'. However, the script may be reused under
> a different name in contexts other than the Linux Kernel.
> 
> Replace the hard-coded value `config' by the name of the script at runtime.
> 
> Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>

Both patched are fine for me.
Acked-by: Andi Kleen <ak@linux.intel.com>

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yann E. MORIN May 12, 2013, 8:29 p.m. UTC | #2
Andy, Clément, All,

On 2013-05-12 21:25 +0200, Andi Kleen spake thusly:
> On Sun, May 12, 2013 at 09:08:51PM +0200, Clement Chauplannaz wrote:
> > The script `config' prints its name in usage() function. It is currently
> > hard-coded to value `config'. However, the script may be reused under
> > a different name in contexts other than the Linux Kernel.
> > 
> > Replace the hard-coded value `config' by the name of the script at runtime.
> > 
> > Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
> 
> Both patched are fine for me.
> Acked-by: Andi Kleen <ak@linux.intel.com>

It's too late for 3.10 now, so I'll queue them in my tree for 3.11.

Thank you!

Regards,
Yann E. MORIN.
Clement Chauplannaz May 12, 2013, 8:54 p.m. UTC | #3
Thanks!
Clément

2013/5/12 Yann E. MORIN <yann.morin.1998@free.fr>:
> Andy, Clément, All,
>
> On 2013-05-12 21:25 +0200, Andi Kleen spake thusly:
>> On Sun, May 12, 2013 at 09:08:51PM +0200, Clement Chauplannaz wrote:
>> > The script `config' prints its name in usage() function. It is currently
>> > hard-coded to value `config'. However, the script may be reused under
>> > a different name in contexts other than the Linux Kernel.
>> >
>> > Replace the hard-coded value `config' by the name of the script at runtime.
>> >
>> > Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
>>
>> Both patched are fine for me.
>> Acked-by: Andi Kleen <ak@linux.intel.com>
>
> It's too late for 3.10 now, so I'll queue them in my tree for 3.11.
>
> Thank you!
>
> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yann E. MORIN May 20, 2013, 3:57 p.m. UTC | #4
Clément, All,

On 2013-05-12 21:08 +0200, Clement Chauplannaz spake thusly:
> The script `config' prints its name in usage() function. It is currently
> hard-coded to value `config'. However, the script may be reused under
> a different name in contexts other than the Linux Kernel.
> 
> Replace the hard-coded value `config' by the name of the script at runtime.
> 
> Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>

I've applied this in my tree in the branch yem-kconfig-for-next, for
inclusion upstream when the 3.11 merge window opens. Thank you!

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/scripts/config b/scripts/config
index bb4d3de..6b3272e 100755
--- a/scripts/config
+++ b/scripts/config
@@ -1,6 +1,8 @@ 
 #!/bin/bash
 # Manipulate options in a .config file from the command line
 
+myname=${0##*/}
+
 # If no prefix forced, use the default CONFIG_
 CONFIG_="${CONFIG_-CONFIG_}"
 
@@ -8,7 +10,7 @@  usage() {
 	cat >&2 <<EOL
 Manipulate options in a .config file from the command line.
 Usage:
-config options command ...
+$myname options command ...
 commands:
 	--enable|-e option   Enable option
 	--disable|-d option  Disable option
@@ -33,14 +35,14 @@  options:
 	--file config-file   .config file to change (default .config)
 	--keep-case|-k       Keep next symbols' case (dont' upper-case it)
 
-config doesn't check the validity of the .config file. This is done at next
+$myname doesn't check the validity of the .config file. This is done at next
 make time.
 
-By default, config will upper-case the given symbol. Use --keep-case to keep
+By default, $myname will upper-case the given symbol. Use --keep-case to keep
 the case of all following symbols unchanged.
 
-config uses 'CONFIG_' as the default symbol prefix. Set the environment
-variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
+$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
 EOL
 	exit 1
 }