freebsd-dev/etc/rc.d/moused
Yaroslav Tykhiy 45da9952e5 Eliminate global symbols starting with an underscore from rc.d
scripts, except for mdconfig* and jail.  Such symbols are reserved
for the rc.subr internals.  Most scripts can be fixed by just
declaring _foo symbols as local: few scripts actually need them to
be global.

Discussed with:	dougb in freebsd-rc
2006-12-30 22:53:20 +00:00

75 lines
1.6 KiB
Bash

#!/bin/sh
#
# $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $
# $FreeBSD$
#
# PROVIDE: moused
# REQUIRE: DAEMON cleanvar
# KEYWORD: nojail
. /etc/rc.subr
name=moused
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
start_cmd="moused_start"
pidprefix="/var/run/moused"
pidfile="${pidprefix}.pid"
pidarg=
load_rc_config $name
# Set the pid file and variable name. The second argument, if it exists, is
# expected to be the mouse device.
#
if [ -n "$2" ]; then
eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
rcvar=`set_rcvar moused_$2`
pidfile="${pidprefix}.$2.pid"
pidarg="-I $pidfile"
fi
moused_start()
{
local ms myflags myport mytype
# Set the mouse device and get any related variables. If
# a moused device has been specified on the commandline, then
# rc.conf(5) variables defined for that device take precedence
# over the generic moused_* variables. The only exception is
# the moused_port variable, which if not defined sets it to the
# passed in device name.
#
ms=$1
if [ -n "$ms" ]; then
eval myflags=\${moused_${ms}_flags-$moused_flags}
eval myport=\${moused_${ms}_port-/dev/$ms}
eval mytype=\${moused_${ms}_type-$moused_type}
else
ms="default"
myflags="$moused_flags"
myport="$moused_port"
mytype="$moused_type"
fi
echo -n "Starting ${ms} moused:"
/usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
mousechar_arg=
case ${mousechar_start} in
[Nn][Oo] | '')
;;
*)
echo -n ' mousechar_start'
mousechar_arg="-M ${mousechar_start}"
;;
esac
for ttyv in /dev/ttyv* ; do
vidcontrol < ${ttyv} ${mousechar_arg} -m on
done
echo '.'
}
run_rc_command $*