git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1068
959494ce-11ee-0310-bf91-
de5d638817bd
#!/bin/sh
+isnum() {
+ grep -xq '[0-9]\+' <<<"$1"
+}
+
+findfile() {
+ local file tail eq eqt m
+ for file in "$1"*; do
+ tail="${file#$1}"
+ eq="${tail%.*}"
+ m=n
+ if [ "${eq%% *}" -eq "$2" ] 2>/dev/null; then
+ if [[ "$eq" == *\ * ]]; then
+ eqt="${eq#* }"
+ else
+ eqt=
+ fi
+ m=y
+ elif [ "${eq:0:${#2}}" = "$2" ]; then
+ eqt="${eq:${#2}}"
+ if [ "${eqt:0:1}" = " " -o -z "$eqt" ]; then
+ eqt="${eqt# }"
+ m=y
+ fi
+ fi
+ if [ "$m" = y ]; then
+ if [ "$eqt" = "$3" -o "$eqt" = "($3)" ]; then
+ echo "$file"
+ return 0
+ fi
+ fi
+ done
+ return 1
+}
+
cmdline=(mplayer -fs)
while [ "${1:0:1}" = - ]; do