wscons revision 1.5
11.1Slukem#!/bin/sh
21.1Slukem#
31.5Slukem# $NetBSD: wscons,v 1.5 2000/08/21 23:02:25 lukem Exp $
41.1Slukem#
51.1Slukem
61.1Slukem# PROVIDE: wscons
71.4Slukem# REQUIRE: mountcritremote
81.1Slukem
91.1Slukem. /etc/rc.subr
101.1Slukem
111.1Slukemname="wscons"
121.2Sveegostart_precmd="checkyesno wscons"
131.5Slukemstart_cmd="wscons_start"
141.2Sveegostop_cmd=":"
151.1Slukem
161.5Slukemwscons_start()
171.1Slukem{
181.5Slukem	wscfg=/usr/sbin/wsconscfg
191.5Slukem	wsfld=/usr/sbin/wsfontload
201.5Slukem	config=/etc/wscons.conf
211.5Slukem	usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
221.5Slukem	DOIT=
231.5Slukem
241.5Slukem	while [ $# -gt 0 ]; do
251.5Slukem		case $1 in
261.5Slukem			-n)
271.5Slukem				DOIT=echo
281.5Slukem				;;
291.5Slukem			-f)
301.5Slukem				config=$2
311.5Slukem				shift
321.5Slukem				;;
331.5Slukem			-font)
341.5Slukem				wsfld=$2
351.5Slukem				shift
361.5Slukem				;;
371.5Slukem			-screen)
381.5Slukem				wscfg=$2
391.5Slukem				shift
401.5Slukem				;;
411.5Slukem			*)
421.5Slukem				echo $usage
431.5Slukem				exit 1
441.5Slukem				;;
451.5Slukem		esac
461.5Slukem		shift
471.5Slukem	done
481.5Slukem
491.5Slukem
501.5Slukem	# args mean:
511.5Slukem	#	screen idx scr emul
521.5Slukem	#	font   name width height enc file
531.5Slukem	( while read type arg1 arg2 arg3 arg4 arg5; do
541.5Slukem		case "$type" in
551.5Slukem			\#*|"")
561.5Slukem				continue
571.5Slukem				;;
581.5Slukem			font)
591.5Slukem				name=$arg1
601.5Slukem				width=$arg2
611.5Slukem				height=$arg3
621.5Slukem				enc=$arg4
631.5Slukem				file=$arg5
641.5Slukem				cmd=$wsfld
651.5Slukem
661.5Slukem				case $width in
671.5Slukem					-)
681.5Slukem						;;
691.5Slukem					*)
701.5Slukem						cmd="$cmd -w $width"
711.5Slukem						;;
721.5Slukem				esac
731.5Slukem				case $height in
741.5Slukem					-)
751.5Slukem						;;
761.5Slukem					*)
771.5Slukem						cmd="$cmd -h $height"
781.5Slukem						;;
791.5Slukem				esac
801.5Slukem				case $enc in
811.5Slukem					-)
821.5Slukem						;;
831.5Slukem					*)
841.5Slukem						cmd="$cmd -e $enc"
851.5Slukem						;;
861.5Slukem				esac
871.5Slukem				cmd="$cmd -N $name $file"
881.5Slukem				eval $DOIT $cmd
891.5Slukem				;;
901.5Slukem			screen)
911.5Slukem				idx=$arg1
921.5Slukem				scr=$arg2
931.5Slukem				emul=$arg3
941.5Slukem				cmd=$wscfg
951.5Slukem
961.5Slukem				case $scr in
971.5Slukem					-)
981.5Slukem						;;
991.5Slukem					*)
1001.5Slukem						cmd="$cmd -t $scr"
1011.5Slukem						;;
1021.5Slukem				esac
1031.5Slukem				case $emul in
1041.5Slukem					-)
1051.5Slukem						;;
1061.5Slukem					*)
1071.5Slukem						cmd="$cmd -e $emul"
1081.5Slukem						;;
1091.5Slukem				esac
1101.5Slukem				cmd="$cmd $idx"
1111.5Slukem				eval $DOIT $cmd
1121.5Slukem				;;
1131.5Slukem			keyboard)
1141.5Slukem				kbd=$arg1
1151.5Slukem				cmd=$wscfg
1161.5Slukem				case $kbd in
1171.5Slukem					-|auto)
1181.5Slukem						cmd="$cmd -k"
1191.5Slukem						;;
1201.5Slukem					*)
1211.5Slukem						cmd="$cmd -k $kbd"
1221.5Slukem						;;
1231.5Slukem				esac
1241.5Slukem				eval $DOIT $cmd
1251.5Slukem				;;
1261.5Slukem			mux)
1271.5Slukem				cmd="$wscfg -m $arg1"
1281.5Slukem				eval $DOIT $cmd
1291.5Slukem				;;
1301.5Slukem		esac
1311.5Slukem	done ) < $config
1321.1Slukem}
1331.1Slukem
1341.3Slukemload_rc_config $name
1351.1Slukemrun_rc_command "$1"
136