home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / armlinux / alpha / PARTITIONS / USR_GZ / usr / lib / mthreads / filexp < prev    next >
Encoding:
Text File  |  1995-05-14  |  648 b   |  35 lines

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