Popup window version of rwall
mmm%informatics.rutherford.ac.uk at nss.cs.ucl.ac.uk
mmm%informatics.rutherford.ac.uk at nss.cs.ucl.ac.uk
Wed Mar 15 02:57:13 AEST 1989
in Sun-Spots Digest, v7n163
David C. Kovar <daedalus!corwin at talcott.harvard.edu> writes
> Our users ... happily ignore the beeps
> indicating that a console message has arrived...
> Something that works along these lines is Chuck Musciano's "contool".
> ... --wnl
I always like to try to solve problems with shell scripts rather than
programs: they are usually much easier to adapt to people's particular
wishes, are shorter and therefore more likely to be read, and on today's
machines don't need to be a performance bottleneck. Instead of "contool"
I use the following script in the shelltool or cmdtool I want to be my
console, started with, eg:
cmdtool -Wp 399 0 -Ws 668 554 -WP 1088 0 -Wi sh -c "stamp;exec sh"
The script will time-stamp messages appearing on the console, and can ring
the bell and pop up and open the window as well (suppressed to not more
than once a minute in the example below). It can ignore messages matching
patterns, such as is done with /[Ss]tarting [Dd]umps/. It uses dd to read
the input since sh's read doesn't cope too well. Make sure the 3
non-printing characters ^g ^[ ^m get through the mailers. Startup is a
little slow due to the TIOCCONS needed.
---------------cut here for stamp------------------
#!/bin/sh
# console listener and timestamp. Mark Martin June 1988 RAL
# the following are: bell='^g' esc='^[' carriagereturn='^m'
bell='' esc='' carriagereturn='
becomeconsole=/tmp/makecon$$ parent=$$
open=${esc}'[1t' pop=${esc}'[5t' pagemodeoff=${esc}'[>1l'
endtext=${esc}'\'
iconlabel=${esc}']L' # add endtext
dateformat='%a %H:%M '
notify="$bell$open$pop$pagemodeoff"
trap 'rm -f $becomeconsole.c $becomeconsole; exit 1' 0 1 2 3 15
echo '#include <sys/ioctl.h>
main(){
if(ioctl(1,TIOCCONS,0)<0)exit(1);
exit(0);
}' >$beconsole.c
nice -9 cc $beconsole.c -s -o $beconsole
rm $beconsole.c
for m in p q r
do
for n in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do master="/dev/pty$m$n"
slave="/dev/tty$m$n"
(
if $beconsole
then echo "using $slave" >/dev/console
rm $beconsole
kill -9 $parent
while line=`dd count=1 bs=4k 2>/dev/null`
do stamp=`date "+$dateformat"`
if [ "$stamp" = "$laststamp" ]
then note=
else note=$notify
laststamp=$stamp
fi
echo "$line" | sed '
s/'"$bell"'//g
s/'"$carriagereturn"'//g
/[Ss]tarting [Dd]umps/b stamp
/^[ *]*$/d
s/$/'"$note"'/
:stamp
s/[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z ][a-zA-Z ][a-zA-Z ]/&'"$iconlabel&$endtext"'\/
s/^/'"$stamp"'/
' 1>&2
done
fi <$master 2>&1 >$slave
) 2>/dev/null
done
done
Mark M Martin janet: mmm at uk.ac.rl.inf
Informatics arpa: mmm%inf.rl.ac.uk at nss.cs.ucl.ac.uk
Rutherford Appleton Lab uucp: ..!mcvax!ukc!rlinf!mmm
Didcot, Oxon, UK. OX11 0QX mmm at rlinf.uucp
Tel +44 235 44 5160 Fax +44 235 44 5831
More information about the Comp.sys.sun
mailing list