On Tue, Dec 14, 2010 at 7:38 AM, Gaetan Nadon <[email protected]> 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 <[email protected]>
> ---
>  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
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to