Skip to content
Snippets Groups Projects
Commit 9232f4ad authored by Mike Baker's avatar Mike Baker
Browse files

strtok helper function

SVN-Revision: 5592
parent d28e34c3
No related branches found
No related tags found
No related merge requests found
...@@ -118,3 +118,27 @@ find_mtd_part() { ...@@ -118,3 +118,27 @@ find_mtd_part() {
echo "${PART:+/dev/mtdblock/$PART}" echo "${PART:+/dev/mtdblock/$PART}"
} }
strtok() { # <string> <variable> [<separator>] ...
local right
local left="$1"
local count=0
shift
while [ $# -gt 1 ]; do
right="${left%%$2*}"
[ "$right" = "$left" ] && break
left="${left#$right$2}"
export $1="$right"; count=$((count+1))
shift 2
done
if [ $# -gt 0 -a "$left" ]; then
export $1="$left"; count=$((count+1))
fi
return $count
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment