#!/bin/sh
#
# Make standard devices
#

PATH=/bin

for I; do
  case "$I" in
    std)
      $0 console tty null zero # fd
      ;;
    console)
      settrans -cf console /hurd/term console `pwd`/console ;;
    tty)
      settrans -cf tty /hurd/magic tty ;;
    null)
      settrans -cf null /hurd/null ;;
    zero)
      settrans -cf zero /hurd/null -z ;;
    fd)
      settrans -cf fd /hurd/magic fd
      ln -f -s fd/0 stdin
      ln -f -s fd/1 stdout
      ln -f -s fd/2 stderr
      ;;

    fd*|mt*)
      settrans -cf r$I /hurd/devio $I
      settrans -cf $I /hurd/devio -b $I
      ;;

    [hrs]d*)
      case "$I" in
      [a-z][a-z][0-9][a-z])
        settrans -cf r$I /hurd/devio $I
        settrans -cf $I /hurd/devio -b $I
	;;
      *)
	echo 1>&2 $0: $I: Must supply a device number and partition
	exit 1
	;;
      esac
      ;;

    *)
      echo >&2 $0: $I: Unknown device
      exit 1
      ;;
  esac
done