esac
done
-base="$(basename "$(pwd)")"
+dirbase="$(basename "$(pwd)")"
+base=.
nextep=n
file=
tqual=
if [ $# -eq 0 ]; then
nextep=y
- if [ -r curser ]; then
- base="$base $(<curser)"
- fi
elif [ $# -eq 1 ]; then
if [ -r "$1" ]; then
file="$1"
else
- if findfile "$base - " "$1" >/dev/null; then
- ep="$1"
- else
- nextep=y
- base="$base $1"
- fi
+ base=
+ ep="$1"
fi
elif [ $# -eq 2 ]; then
- if findfile "$base - " "$1" "$2" >/dev/null; then
+ if findfile "$dirbase - " "$1" "$2" >/dev/null; then
+ base=""
ep="$1"
tqual="$2"
else
- if [ "$1" = . -a -r curser ]; then
- base="$base $(<curser)"
- else
- base="$base $1"
- fi
+ base="$1"
ep="$2"
fi
else
- if [ "$1" = . -a -r curser ]; then
- base="$base $(<curser)"
- else
- base="$base $1"
- fi
+ base="$1"
ep="$2"
tqual="$3"
fi
fi
fi
if [ -z "$file" ]; then
- file="$(findfile "$base - " "$ep" "$tqual")"
+ if [ "$base" = . ]; then
+ if [ -r curser ]; then
+ curser="$(<curser)"
+ else
+ curser=
+ fi
+ else
+ curser="$base"
+ fi
+ if [ -n "$curser" ]; then
+ file="$(findfile "$dirbase $curser - " "$ep" "$tqual")" || \
+ file="$(findfile "$curser - " "$ep" "$tqual")"
+ else
+ file="$(findfile "$dirbase - " "$ep" "$tqual")"
+ fi
fi
if [ -z "$file" -o ! -r "$file" ]; then