File:  [CSRG BSD Unix] / 43BSDReno / games / warp / filexp
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:57 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

#!/bin/sh
: expand filename
case "$1" in
 ~/*|~)
    echo $1 | sed "s|~|${HOME-$LOGDIR}|"
    ;;
 ~*)
    if /bin/test -f /bin/csh; then
	/bin/csh -f -c "glob $1"
	echo ""
    else
	name=`expr x$1 : '..\([^/]*\)'`
	dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
	if /bin/test ! -d "$dir"; then
	    me=`basename $0`
	    echo "$me: can't locate home directory for: $name" >&2
	    exit 1
	fi
	case "$1" in
	*/*)
	    echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
	    ;;
	*)
	    echo $dir
	    ;;
	esac
    fi
    ;;
*)
    echo $1
    ;;
esac

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.