: ${EDITOR:=/bin/ed} ${TERM:=vt100}
[[ ${HOSTNAME:=$(ulimit -c 0; cat /proc/sys/kernel/hostname)} = \
    @(localhost|*([ 	])) ]] && HOSTNAME=$(ulimit -c 0; cat /proc/sys/kernel/hostname)
if [[ $(ulimit -c 0; id -u 2>/dev/null) -eq 0 ]]; then
	PS1='# '
else
	PS1='$ '
fi; PS1='$(integer rv=$?; ((rv)) && print -n $rv\|)${USER:=$(ulimit -c 0; \
    id -un 2>/dev/null || print -n nobody)}@${HOSTNAME:=nil}:$(
	local pfx=~ wd=${PWD:-$(builtin pwd)}; integer n=${COLUMNS:-80}/3
	[[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx}
	pfx=; let n="n < 7 ? 7 : n"
	while (( (${#pfx} + ${#wd}) > n )); do
		if [[ $wd = */* ]]; then
			pfx=.../
			wd=${wd#*/}
		else
			pfx=...
			wd=${wd#?????}
		fi
	done
	print -nr -- "$pfx$wd") '$PS1
export EDITOR HOSTNAME MKSH=$(whence -p mksh) PS1 TERM USER

alias l='/bin/ls -F'
alias la='l -a'
alias ll='l -l'
alias lo='la -l'
whence -p rot13 >/dev/null || alias rot13='tr [A-Za-z] [N-ZA-Mn-za-m]'
whence -p hd >/dev/null || function hd {
	hexdump -e '"%08.8_ax  " 8/1 "%02X " " - " 8/1 "%02X "' \
	    -e '"  |" "%_p"' -e '"|\n"' "$@"
}

# strip comments (and leading/trailing whitespace if IFS is set) from
# any file(s) given as argument, or stdin if none, and spew to stdout
function Lstripcom {
	cat "$@" | { set -o noglob; while read _line; do
		_line=${_line%%#*}
		[[ -n $_line ]] && print -r -- $_line
	done; }
}

# place customisations between this line and the “: RCSID” line below

: $MirOS: src/bin/mksh/dot.mkshrc,v 1.12 2007/04/17 20:07:09 tg Rel $
