diff options
author | dteske <dteske@FreeBSD.org> | 2014-01-20 03:31:16 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2014-01-20 03:31:16 +0000 |
commit | 0973152defb80c6b60ebf10ee660134bda0fdea7 (patch) | |
tree | 28118462304390b0476fd43eb5b28baaa39116eb | |
parent | 16e5d67c2cf6e6ac3677727fed208205f146e32d (diff) | |
download | FreeBSD-src-0973152defb80c6b60ebf10ee660134bda0fdea7.zip FreeBSD-src-0973152defb80c6b60ebf10ee660134bda0fdea7.tar.gz |
Dummy commit (s/__num/__number/) in f_expand_number() to describe that the
previous commit here (SVN r260894) was [in-part] from Submitted-by:
Christoph Mallon <christoph.mallon@gmx.de>
MFC after: 3 days
-rw-r--r-- | usr.sbin/bsdconfig/share/strings.subr | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/usr.sbin/bsdconfig/share/strings.subr b/usr.sbin/bsdconfig/share/strings.subr index c41dc37..1bb42e3 100644 --- a/usr.sbin/bsdconfig/share/strings.subr +++ b/usr.sbin/bsdconfig/share/strings.subr @@ -369,16 +369,14 @@ f_shell_unescape() f_expand_number() { local __string="$1" __var_to_set="$2" - local __cp __num __bshift __maxinput + local __cp __number __bshift __maxinput - # Remove any leading non-digits + # Remove any leading non-digits and store numbers (sans suffix) __string="${__string#${__string%%[0-9]*}}" - - # Store the numbers (no trailing suffix) - __num="${__string%%[!0-9]*}" + __number="${__string%%[!0-9]*}" # Produce `-1' if string didn't contain any digits - if [ ! "$__num" ]; then + if [ ! "$__number" ]; then if [ "$__var_to_set" ]; then setvar "$__var_to_set" -1 else @@ -388,7 +386,7 @@ f_expand_number() fi # Remove all the leading numbers from the string to get at the prefix - __string="${__string#"$__num"}" + __string="${__string#"$__number"}" # # Test for invalid prefix (and determine bitshift length) @@ -396,9 +394,9 @@ f_expand_number() case "$__string" in ""|[[:space:]]*) # Shortcut if [ "$__var_to_set" ]; then - setvar "$__var_to_set" $__num + setvar "$__var_to_set" $__number else - echo $__num + echo $__number fi return $SUCCESS ;; [Kk]*) __bshift=10 ;; @@ -419,7 +417,7 @@ f_expand_number() # Determine if the wheels fall off __maxinput=$(( 0x7fffffffffffffff >> $__bshift )) - if [ $__num -gt $__maxinput ]; then + if [ $__number -gt $__maxinput ]; then # Input (before expanding) would exceed 64-bit signed int if [ "$__var_to_set" ]; then setvar "$__var_to_set" -1 @@ -430,11 +428,11 @@ f_expand_number() fi # Shift the number out and produce it - __num=$(( $__num << $__bshift )) + __number=$(( $__number << $__bshift )) if [ "$__var_to_set" ]; then - setvar "$__var_to_set" $__num + setvar "$__var_to_set" $__number else - echo $__num + echo $__number fi } |