libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add an XSI replacement for func_split_short_opt.


From: Eric Blake
Subject: Re: [PATCH] Add an XSI replacement for func_split_short_opt.
Date: Mon, 28 Jun 2010 05:49:40 -0700 (PDT)

> No, ${parameter:offset} and ${parameter:offset:length} are bash specific
> not XSI mandated.

But we don't need bash-specific hacks.
${parameter#??} serves as a great XSI alternative to ${parameter:2},
and with a (lot) more thought, ${1:1:1} can be written without forks
and without bash-isms as:
tmp=${1#?}
patt=
i=2
while test $i -lt ${#1}; do
  patt="?$patt"
  i=$((i+1))
done
result=${tmp%$patt}

Obviously, you'd want to pick better variable names due to namespace
considerations...

-- 
View this message in context: 
http://old.nabble.com/-PATCH--Add-an-XSI-replacement-for-func_split_short_opt.-tp29005049p29008555.html
Sent from the Gnu - Libtool - Patches mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]