plan9fox/rc/bin/screenrc
cinap_lenrek d1315ade41 libdraw, screenrc: bind devdraw and devmouse in screenrc instead of handling it in libdraw
libdraw was attempting to bind '#i' and '#m' to /dev when it could not find
/dev/mouse or /dev/draw. a library shouldnt be that clever and do namespace
manipulations on behalf of the caller. so instead, we setup the graphics
environment in screenrc on boot time.
2015-09-20 12:25:01 +02:00

54 lines
889 B
Bash
Executable file

#!/bin/rc
# setup mouse and graphics
fn ask {
if(~ $"$1 ask){
echo -n $1
echo -n $2
echo -n ' ['
echo -n $3
echo -n '] '
$1=`{read}
if(~ $"$1 '!rc'){
rc -i
$1=ask
}
if(~ $#$1 0)
$1=$3
ask $*
}
}
if(test -f /dev/vgactl){
ask vgasize ' is (text, 640x480x8, 1024x768x16, ...)' 1024x768x16
if(! ~ $"vgasize '' text none){
ask monitor ' is (vesa, xga, lcd, ...)' vesa
if(! ~ $"monitor ''){
@{
rfork n
if(~ $monitor vesa)
aux/realemu
aux/vga -l $vgasize
}
}
}
}
if(! test -d /dev/draw)
bind -a '#i' /dev
if(! test -f /dev/mouse)
bind -a '#m' /dev
if(test -f /dev/mousectl && test -f /dev/winname){
ask mouseport ' is (ps2, ps2intellimouse, 0, 1, 2)' ps2
switch($mouseport){
case ps2 ps2intellimouse 0 1 2
aux/mouse $mouseport
if(~ $accupoint 1)
pipefile -dr /bin/aux/accupoint /dev/mouse
}
}
rm -f '/env/fn#ask'