moused revision 140339
1#!/bin/sh 2# 3# $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $ 4# $FreeBSD: head/etc/rc.d/moused 140339 2005-01-16 03:12:03Z obrien $ 5# 6 7# PROVIDE: moused 8# REQUIRE: DAEMON cleanvar 9# KEYWORD: nojail 10 11. /etc/rc.subr 12 13name=moused 14rcvar=`set_rcvar` 15command="/usr/sbin/${name}" 16start_cmd="moused_start" 17_pidprefix="/var/run/moused" 18pidfile="${_pidprefix}.pid" 19_pidarg= 20load_rc_config $name 21 22# Set the pid file and variable name. The second argument, if it exists, is 23# expected to be the mouse device. 24# 25if [ -n "$2" ]; then 26 checkyesno moused_nondefault_enable && 27 eval moused_$2_enable=\${moused_$2_enable-YES} 28 rcvar=`set_rcvar moused_$2` 29 pidfile="${_pidprefix}.$2.pid" 30 _pidarg="-I $pidfile" 31fi 32 33moused_start() 34{ 35 local ms myflags myport mytype 36 37 # Set the mouse device and get any related variables. If 38 # a moused device has been specified on the commandline, then 39 # rc.conf(5) variables defined for that device take precedence 40 # over the generic moused_* variables. The only exception is 41 # the moused_port variable, which if not defined sets it to the 42 # passed in device name. 43 # 44 ms=$1 45 if [ -n "$ms" ]; then 46 eval myflags=\${moused_${ms}_flags-$moused_flags} 47 eval myport=\${moused_${ms}_port-/dev/$ms} 48 eval mytype=\${moused_${ms}_type-$moused_type} 49 else 50 ms="default" 51 myflags="$moused_flags" 52 myport="$moused_port" 53 mytype="$moused_type" 54 fi 55 56 echo -n "Starting ${ms} moused:" 57 /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${_pidarg} 58 59 _mousechar_arg= 60 case ${mousechar_start} in 61 [Nn][Oo] | '') 62 ;; 63 *) 64 echo -n ' mousechar_start' 65 _mousechar_arg="-M ${mousechar_start}" 66 ;; 67 esac 68 69 for ttyv in /dev/ttyv* ; do 70 vidcontrol < ${ttyv} ${_mousechar_arg} -m on 71 done 72 echo '.' 73} 74 75run_rc_command $* 76