projects
/
openwrt
/
staging
/
wigyori.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d28e34c
)
strtok helper function
author
Mike Baker
<mbm@openwrt.org>
Mon, 20 Nov 2006 19:30:50 +0000
(19:30 +0000)
committer
Mike Baker
<mbm@openwrt.org>
Mon, 20 Nov 2006 19:30:50 +0000
(19:30 +0000)
SVN-Revision: 5592
package/base-files/default/etc/functions.sh
patch
|
blob
|
history
diff --git
a/package/base-files/default/etc/functions.sh
b/package/base-files/default/etc/functions.sh
index f7cb878bc935b7cebc807a458dd3010898bd26ad..aa5b000644d8d0fcd5426116e8f3a46e5c0d6b1a 100755
(executable)
--- a/
package/base-files/default/etc/functions.sh
+++ b/
package/base-files/default/etc/functions.sh
@@
-118,3
+118,27
@@
find_mtd_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
+}