#!	/bin/ash

case $0 in
ps|*/ps)
	for i in /proc/[0-9]*/; do
		read stat < $i/stat
		set -- $stat
		echo "$1	$2"
	done
	;;
lilo|*/lilo)
	if [ ! -f /target/sbin/lilo ];then
		echo "
You must mount your root filesystem under /target and the base system
must be installed to be able to run lilo. 
To mount your root filesystem use: \"mount <partition> /target\"
where <partition> is the device name of the partition where your root
filesystem is. Or use the \"Mount a Previously-Initialized Partition\"
option in the installation system's main menu."
		exit 1
	fi
	LD_LIBRARY_PATH=/target/lib:/target/usr/lib /target/sbin/lilo -r /target
	;;
uname|*/uname)
	if [ $# -gt 0 ]; then
		case $1 in
		-r|--release)
			set -- `cat /proc/version`
			echo $3
			;;
		-s|--sysname)
			echo "Linux"
			;;
		esac
	else
		echo "Linux"
	fi
	;;
emacs|*/emacs)
	echo "Emacs and vi are available in Debian, but wouldn't fit on the
installation floppies. Please type \"ae\" to invoke a tiny, but
easy-to-learn editor. As soon as you have your system installed, you may
install the \"emacs\" package, and/or the \"vim\" or \"nvi\" packages.
\"vim\" and \"nvi\" each provide a different version of \"vi\"."
	;;
vi|*/vi)
	ae -f /etc/ae/ae2vi.rc "$@"
	;;
mformat|*/mformat)
	;;
grep|*/grep)
	R="$1"
	shift
	sed /$R/P -n "$@"
	;;
lsmod|*/lsmod)
	echo "Module         Pages    Used by"
	cat /proc/modules
	;;
*)
	echo "no function defined for $0"
	exit 1
esac
exit 0
