Simplify implementation of parse_opt in linuxrc
authorAndrew Gaffney <agaffney@gentoo.org>
Fri, 14 Nov 2008 16:14:23 +0000 (10:14 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Fri, 14 Nov 2008 16:14:23 +0000 (10:14 -0600)
ChangeLog
defaults/initrd.scripts

index 0f2468df275bde425fabe91aa0e5a924059b5ff6..e011419590638de7a0f6551433985165321a0e92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 # Copyright 1999-2008 Gentoo Foundation; 2008 Chris Gianelloni, Andrew Gaffney
 # Distributed under the GPL v2
 
+  14 Nov 2008; Andrew Gaffney <agaffney@gentoo.org> defaults/initrd.scripts:
+  Simplify implementation of parse_opt in linuxrc
+
   14 Nov 2008; Andrew Gaffney <agaffney@gentoo.org> defaults/initrd.scripts,
   defaults/linuxrc:
   Small cleanups in unionfs code
index d333767021dfc773ff4adccafdbe9d1ddb6f2c49..0de1e1f59b2c2f38136c0386d987738303e372ce 100644 (file)
@@ -6,22 +6,10 @@ backup() {
        echo -ne "\033[0G\033[0K"
 }
 
-strlen() {
-       if [ -z "$1" ]
-       then
-               echo "usage: strlen <variable_name>"
-               die
-       fi
-       eval echo "\${#${1}}"
-}
-
 parse_opt() {
        case "$1" in
                *\=*)
-                       local key_name="`echo "$1" | cut -f1 -d=`"
-                       local key_len=`strlen key_name`
-                       local value_start=$((key_len+2))
-                       echo "$1" | cut -c ${value_start}-
+                       echo "$1" | cut -d= -f2-
                ;;
        esac
 }