From: Andrew Gaffney <agaffney@gentoo.org>
Date: Fri, 14 Nov 2008 16:14:23 +0000 (-0600)
Subject: Simplify implementation of parse_opt in linuxrc
X-Git-Tag: v3.4.10.902~13
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=890382b8e06374979dbeb0e45541ac315237d551;p=genkernel.git

Simplify implementation of parse_opt in linuxrc
---

diff --git a/ChangeLog b/ChangeLog
index 0f2468d..e011419 100644
--- 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
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index d333767..0de1e1f 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -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
 }