Simplify implementation of parse_opt in linuxrc

cleanup-cruft
Andrew Gaffney 16 years ago
parent abf5986e2b
commit 890382b8e0

@ -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

@ -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
}

Loading…
Cancel
Save