Remove local keyword.

* util/grub-mkconfig_lib.in (version_test_numeric): Remove local.
	(version_test_gt): Likewise.
	(version_find_latest): Likewise.
	(gettext_printf): Likewise.
	* util/grub.d/10_windows.in (get_os_name_from_boot_ini): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-10 08:46:09 +01:00
parent cb544caa2e
commit c3591189b8
3 changed files with 39 additions and 29 deletions

View file

@ -1,3 +1,13 @@
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
Remove local keyword.
* util/grub-mkconfig_lib.in (version_test_numeric): Remove local.
(version_test_gt): Likewise.
(version_find_latest): Likewise.
(gettext_printf): Likewise.
* util/grub.d/10_windows.in (get_os_name_from_boot_ini): Likewise.
2011-11-10 Vladimir Serbinenko <phcoder@gmail.com> 2011-11-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/zfs/zfs.c (zfs_mount): Fix spurious warning. * grub-core/fs/zfs/zfs.c (zfs_mount): Fix spurious warning.

View file

@ -167,21 +167,21 @@ grub_file_is_not_garbage ()
version_test_numeric () version_test_numeric ()
{ {
local a="$1" version_test_numeric_a="$1"
local cmp="$2" version_test_numeric_cmp="$2"
local b="$3" version_test_numeric_b="$3"
if [ "$a" = "$b" ] ; then if [ "$version_test_numeric_a" = "$version_test_numeric_b" ] ; then
case "$cmp" in case "$version_test_numeric_cmp" in
ge|eq|le) return 0 ;; ge|eq|le) return 0 ;;
gt|lt) return 1 ;; gt|lt) return 1 ;;
esac esac
fi fi
if [ "$cmp" = "lt" ] ; then if [ "$version_test_numeric_cmp" = "lt" ] ; then
c="$a" version_test_numeric_c="$version_test_numeric_a"
a="$b" version_test_numeric_a="$version_test_numeric_b"
b="$c" version_test_numeric_b="$version_test_numeric_c"
fi fi
if (echo "$a" ; echo "$b") | sort -n | head -n 1 | grep -qx "$b" ; then if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | sort -n | head -n 1 | grep -qx "$version_test_numeric_b" ; then
return 0 return 0
else else
return 1 return 1
@ -190,30 +190,30 @@ version_test_numeric ()
version_test_gt () version_test_gt ()
{ {
local a="`echo "$1" | sed -e "s/[^-]*-//"`" version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`"
local b="`echo "$2" | sed -e "s/[^-]*-//"`" version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`"
local cmp=gt version_test_gt_cmp=gt
if [ "x$b" = "x" ] ; then if [ "x$version_test_gt_b" = "x" ] ; then
return 0 return 0
fi fi
case "$a:$b" in case "$version_test_gt_a:$version_test_gt_b" in
*.old:*.old) ;; *.old:*.old) ;;
*.old:*) a="`echo -n "$a" | sed -e 's/\.old$//'`" ; cmp=gt ;; *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; cmp=gt ;;
*:*.old) b="`echo -n "$b" | sed -e 's/\.old$//'`" ; cmp=ge ;; *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; cmp=ge ;;
esac esac
version_test_numeric "$a" "$cmp" "$b" version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
return "$?" return "$?"
} }
version_find_latest () version_find_latest ()
{ {
local a="" version_find_latest_a=""
for i in "$@" ; do for i in "$@" ; do
if version_test_gt "$i" "$a" ; then if version_test_gt "$i" "$version_find_latest_a" ; then
a="$i" version_find_latest_a="$i"
fi fi
done done
echo "$a" echo "$version_find_latest_a"
} }
# One layer of quotation is eaten by "", the second by sed, and the third by # One layer of quotation is eaten by "", the second by sed, and the third by
@ -227,9 +227,9 @@ gettext_quoted () {
# remaining arguments to printf. This is a useful abbreviation and tends to # remaining arguments to printf. This is a useful abbreviation and tends to
# be easier to type. # be easier to type.
gettext_printf () { gettext_printf () {
local format="$1" gettext_printf_format="$1"
shift shift
printf "$(gettext_quoted "$format")" "$@" printf "$(gettext_quoted "$gettext_printf_format")" "$@"
} }
uses_abstraction () { uses_abstraction () {

View file

@ -42,14 +42,14 @@ get_os_name_from_boot_ini ()
sort | uniq | wc -l`" = 1 || return 1 sort | uniq | wc -l`" = 1 || return 1
# Search 'default=PARTITION' # Search 'default=PARTITION'
local part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ \t\r]*$,,;1q'` get_os_name_from_boot_ini_part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ \t\r]*$,,;1q'`
test -n "$part" || return 1 test -n "$get_os_name_from_boot_ini_part" || return 1
# Search 'PARTITION="NAME" ...' # Search 'PARTITION="NAME" ...'
local name=`sed -n 's,\\\\,/,g;s,^'"$part"'="\([^"]*\)".*$,\1,p' "$1" | sed 1q` get_os_name_from_boot_ini_name=`sed -n 's,\\\\,/,g;s,^'"$get_os_name_from_boot_ini_part"'="\([^"]*\)".*$,\1,p' "$1" | sed 1q`
test -n "$name" || return 1 test -n "$get_os_name_from_boot_ini_name" || return 1
echo "$name" echo "$get_os_name_from_boot_ini_name"
} }