[PATCH v2 modular 1/1] build.sh: use the script name only, not the path in usage statement
Gaetan Nadon
memsize at videotron.ca
Tue Dec 14 16:35:21 PST 2010
On Tue, 2010-12-14 at 15:08 -0800, Dan Nicholson wrote:
> 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##*/}?
>
Thanks for the suggestion.
My Bash book says that "pattern-matching variable operators"
do not work on the Bourne shell and we have build.sh users running with
this shell.
Trevor had to remove getopt() and local variables. Would we face similar
issues
with this operator?
> --
> Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101214/09e0b510/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101214/09e0b510/attachment.pgp>
More information about the xorg-devel
mailing list