]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - warp/filexp
cgram: consistently use char for characters
[bsdgames-darwin.git] / warp / filexp
1 #!/bin/sh
2 : expand filename
3 case "$1" in
4 ~/*|~)
5 echo $1 | sed "s|~|${HOME-$LOGDIR}|"
6 ;;
7 ~*)
8 if /bin/test -f /bin/csh; then
9 /bin/csh -f -c "glob $1"
10 echo ""
11 else
12 name=`expr x$1 : '..\([^/]*\)'`
13 dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
14 if /bin/test ! -d "$dir"; then
15 me=`basename $0`
16 echo "$me: can't locate home directory for: $name" >&2
17 exit 1
18 fi
19 case "$1" in
20 */*)
21 echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
22 ;;
23 *)
24 echo $dir
25 ;;
26 esac
27 fi
28 ;;
29 *)
30 echo $1
31 ;;
32 esac