Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2014 03:31:16 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260899 - head/usr.sbin/bsdconfig/share
Message-ID:  <201401200331.s0K3VGon050893@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Mon Jan 20 03:31:16 2014
New Revision: 260899
URL: http://svnweb.freebsd.org/changeset/base/260899

Log:
  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

Modified:
  head/usr.sbin/bsdconfig/share/strings.subr

Modified: head/usr.sbin/bsdconfig/share/strings.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/strings.subr	Mon Jan 20 01:59:35 2014	(r260898)
+++ head/usr.sbin/bsdconfig/share/strings.subr	Mon Jan 20 03:31:16 2014	(r260899)
@@ -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
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401200331.s0K3VGon050893>