Subject: Re: Trailing / in pathnames passed to build.sh
To: None <tech-toolchain@NetBSD.org>
From: Bang Jun-Young <junyoung@mogua.com>
List: tech-toolchain
Date: 08/17/2004 23:03:46
Alan Barrett wrote:
> On Tue, 17 Aug 2004, Bang Jun-Young wrote:
> > How about this:
> > + [ ${OPTARG} != "/" ] && OPTARG="${OPTARG%/}"
>
> That should work (modulo quoting "${OPTARG}"). However, I would do it
> like this:
>
> +# Convert possibly-relative path to absolute path by prepending
> +# ${TOP} if necessary. Also delete trailing "/", if any.
> resolvepath()
> {
> case "${OPTARG}" in
> + /)
> + ;;
> /*)
> + OPTARG="${OPTARG%/}"
> ;;
> +
> *)
> - OPTARG="${TOP}/${OPTARG}"
> + OPTARG="${TOP}/${OPTARG%/}"
> ;;
> esac
> }
The winner is... this one. :-) I committed your patch. Thanks.
Jun-Young