9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* screen blanker.
@ 1996-11-19  4:38 Russ
  0 siblings, 0 replies; only message in thread
From: Russ @ 1996-11-19  4:38 UTC (permalink / raw)


To make a screen blanker:
  First, apply the attached boddle to 8½, adding in the
  process the file /dev/active to the 8½ served files list.
  /dev/active returns "y" if the keyboard or mouse has been
  active since the last time it was read (note that the initial
  open does not count as a read, so that it can be used in 
  rc scripts).

  Then, you can just start this blanker script and fork to
  the background when you log in:
--- /rc/bin/blanker
#!/bin/rc

fn black {
	fb/getmap black
}

fn clear {
	fb/getmap rgbv
}

t1 = 60		# 60 second intervals when waiting to black
t2 = 1		# wait one second when waiting to come back.

idlemax = 10	# 10 t1 intervals gets blacked
blank = 0
idle = 0

while() {
switch($blank) {
case 0
	sleep $t1
	switch(`{cat /dev/active}) {
	case y
		idle = 0
	case n
		idle = `{echo $idle + 1 | hoc}
	}
	if(test $idle -gt $idlemax) {
		black
		blank = 1
	}
	echo idle $idle

case 1
	sleep $t2
	switch(`{cat /dev/active}) {
	case y
		clear
		idle = 0
		blank = 0
	}
}
}
--- blanker end.
--- 8½ boddle. 
#!/bin/rc
#
# command: /bin/boddle /sys/clean-src/cmd/8½ /sys/src/cmd/8½
# srcdir: /sys/clean-src/cmd/8½
# version: 848378407
# date: Mon Nov 18 23:40:07 EST 1996
#
myname=$0
doextract=no

fn usage{
	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
	exit usage
}

fn sigint{
	rm -rf 848378407
	exit interrupt
}

while(~ $1 -*){
	switch($1){
	case -X
		doextract=yes
	case -*
		usage
	}
	shift
}

switch($#*){
case 0
	srcdir=/sys/clean-src/cmd/8½
case 1
	srcdir=$1
case *
	usage
}

if(! ~ $doextract yes){
	echo This shell file contains a bundle of diffs representing changes
	echo to original source files in the Plan 9 distribution. It will run
	echo against the files in
	echo ' ' $srcdir
	echo '(unless overridden by the optional source directory argument)'
	echo and create a directory 848378407 containing the updated files.
	echo It will NOT automatically update the original files.
	echo
	echo Invoke with argument -X to perform the actual extraction.
	exit 0
}

rm -rf 848378407
mkdir 848378407

target=848378407/dat.h
echo -n '848378407/dat.h: '
if(! test -f $srcdir/dat.h || ! test -r $srcdir/dat.h){
	echo $srcdir/dat.h unreadable
	exit unreadable
}
sum=`{sum < $srcdir/dat.h}
if(! ~ 7bda55924355  $sum(1)^$sum(2)){
	echo $srcdir/dat.h is not the original distribution file
	exit original
}
cp $srcdir/dat.h 848378407/dat.h
ed 848378407/dat.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM dat.h'
177a
extern	int	active;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-11-19  4:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-19  4:38 screen blanker Russ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).