#!/bin/sh

SPEED=$1
DEVICE=$2
TERM=$3

# busybox' getty does this itself, util-linux' agetty needs extra help
getty="/sbin/getty"
case $(readlink -f "${getty}") in
    */busybox*)
        ;;
    *)
        if [ -x "/usr/bin/setsid" ] ; then
            setsid="/usr/bin/setsid"
        fi
        options=""
        ;;
esac

${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM
