4 grep -xq '[0-9]\+' <<<"$1"
8 local file tail eq eqt m
13 if [ "${eq%% *}" -eq "$2" ] 2>/dev/null; then
14 if [[ "$eq" == *\ * ]]; then
20 elif [ "${eq:0:${#2}}" = "$2" ]; then
22 if [ "${eqt:0:1}" = " " -o -z "$eqt" ]; then
28 if [ "$eqt" = "$3" -o "$eqt" = "($3)" ]; then
40 while [ "${1:0:1}" = - ]; do
45 echo "usage: planime [-ht] [-s PAR VAL] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
49 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
55 if [ "$a" = \; ]; then
58 cmdline=("${cmdline[@]}" "$a")
70 base="$(basename "$(pwd)")"
76 if [ -r curser ]; then
77 base="$base $(<curser)"
79 elif [ $# -eq 1 ]; then
83 if findfile "$base - " "$1" >/dev/null; then
90 elif [ $# -eq 2 ]; then
91 if findfile "$base - " "$1" "$2" >/dev/null; then
95 if [ "$1" = . -a -r curser ]; then
96 base="$base $(<curser)"
103 if [ "$1" = . -a -r curser ]; then
104 base="$base $(<curser)"
111 if [ "$ep" = . ]; then nextep=y; fi
112 if [ "$nextep" = y -a -r nextep ]; then
114 if ! isnum "$ep"; then
115 echo "planime: nextep is non-numeric" >&2
119 if [ -z "$file" ]; then
120 file="$(findfile "$base - " "$ep" "$tqual")"
123 if [ -z "$file" -o ! -r "$file" ]; then
124 echo "planime: no matching file found" >&2
128 case "${file##*.}" in
130 defopts=(-aid 1 -sid 0)
133 defopts=(-slang eng -alang jpn)
137 ifile=".${file}.info"
139 if [ -n "$savepar" ]; then
140 if [ -r "$ifile" ]; then
141 egrep -v "^${savepar} " "$ifile" >"$ifile.new"
142 mv -f "$ifile.new" "$ifile"
144 echo "$savepar $saveval" >>"$ifile"
150 if [ -r "$ifile" ]; then
153 while read par arg; do
154 if [ "$par" = delay ]; then
155 cmdline=("${cmdline[@]}" -delay "$arg")
156 elif [ "$par" = aspect ]; then
157 cmdline=("${cmdline[@]}" -aspect "$arg")
163 cmdline=("${cmdline[@]}" "${defopts[@]}")
166 if [ "`hostname`" = pc6 ]; then chwp=y; fi
168 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
169 "${cmdline[@]}" "$file"
171 if [ "$nextep" = y ]; then
172 echo "0. Save and continue (or Space)"
173 echo "1. Continue without saving"
174 echo "2. Save and exit (or Enter)"
175 echo "3. Exit without saving (or any key)"
191 if [ "$save" = y ]; then
195 if [ "$cont" = y ]; then
196 exec "${origargs[@]}"