[PATCH v2 modular 1/1] build.sh: use the script name only, not the path in usage statement
Dan Nicholson
dbn.lists at gmail.com
Tue Dec 14 15:08:46 PST 2010
On Tue, Dec 14, 2010 at 7:38 AM, Gaetan Nadon <memsize at videotron.ca> wrote:
> If invoked from $PREFIX you currently you get:
> Usage: util/modular/build.sh [options] prefix
>
> Where you should always get:
> Usage: build.sh [options] prefix
>
> The path name is not part of the usage. The GNU compiler and
> associated tools do not use the path.
>
> Autoconf recommends using "expr" rather than "basename" for portability.
>
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> ---
> build.sh | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/build.sh b/build.sh
> index d6c946e..027c1c0 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -934,7 +934,8 @@ process_module_file() {
> }
>
> usage() {
> - echo "Usage: $0 [options] prefix"
> + basename="`expr "//$0" : '.*/\([^/]*\)'`"
> + echo "Usage: $basename [options] prefix"
> echo " where options are:"
> echo " -a : do NOT run auto config tools (autogen.sh, configure)"
> echo " -b : use .build.$HAVE_ARCH build directory"
> @@ -953,7 +954,7 @@ usage() {
> echo " --cmd cmd : execute arbitrary git, gmake, or make command 'cmd'"
> echo " --modfile file : only process the module/components specified in 'file'"
> echo ""
> - echo "Usage: $0 -L"
> + echo "Usage: $basename -L"
> echo " -L : just list modules to build"
> echo ""
> envoptions
Since build.sh is a POSIX shell script, might I suggest parameter
expansion with ${0##*/}?
--
Dan
More information about the xorg-devel
mailing list