BSD 4_3_Tahoe development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Sun, 10 Jan 1988 05:43:19 +0000 (21:43 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Sun, 10 Jan 1988 05:43:19 +0000 (21:43 -0800)
Work on file usr/src/new/patch/filexp

Synthesized-from: CSRG/cd2/4.3tahoe

usr/src/new/patch/filexp [new file with mode: 0644]

diff --git a/usr/src/new/patch/filexp b/usr/src/new/patch/filexp
new file mode 100644 (file)
index 0000000..4221a83
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+: expand filename
+case "$1" in
+~/*|~)
+    /bin/echo $1 | /bin/sed "s|~|${HOME-$LOGDIR}|"
+    ;;
+~*)
+    if /bin/test -f /bin/csh; then
+       /bin/csh -f -c "glob $1"
+       /bin/echo ""
+    else
+       name=`/bin/expr x$1 : '..\([^/]*\)'`
+       dir=`/bin/sed </etc/passwd -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}'`
+       if /bin/test ! -d "$dir"; then
+           me=`basename $0`
+           /bin/echo "$me: can't locate home directory for: $name" >&2
+           exit 1
+       fi
+       case "$1" in
+       */*)
+           /bin/echo $dir/`/bin/expr x$1 : '..[^/]*/\(.*\)'`
+           ;;
+       *)
+           /bin/echo $dir
+           ;;
+       esac
+    fi
+    ;;
+*)
+    /bin/echo $1
+    ;;
+esac