Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: mmm%informatics.rutherford.ac.uk@nss.cs.ucl.ac.uk Newsgroups: comp.sys.sun Subject: Re: Popup window version of rwall Keywords: Software Message-ID: <8903031351.AA05011@pyr-a> Date: 14 Mar 89 16:57:13 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 83 Approved: Sun-Spots@rice.edu Original-Date: Fri, 3 Mar 89 13:51:35 GMT X-Sun-Spots-Digest: Volume 7, Issue 199, message 2 of 16 in Sun-Spots Digest, v7n163 David C. Kovar 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 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@uk.ac.rl.inf Informatics arpa: mmm%inf.rl.ac.uk@nss.cs.ucl.ac.uk Rutherford Appleton Lab uucp: ..!mcvax!ukc!rlinf!mmm Didcot, Oxon, UK. OX11 0QX mmm@rlinf.uucp Tel +44 235 44 5160 Fax +44 235 44 5831