[comp.sources.sun] v01i054: Newstool - use tooltool to read news using rn

mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (07/21/89)

Submitted-by: bowen%prg.oxford.ac.uk@nfsnet-relay.ac.uk
Posting-number: Volume 1, Issue 54
Archive-name: newstool

[ My newsposter refused to take this file as-was: the <esc> character
  and ^G character was included, and it doesn't like it.  I've
  replaced the <esc> with "&" and the ^G with "~" - there are no other
  &'s or ~'s in the file, so replace all "&" characters with escape
  character and all "~" with control-g using your favorite editor
  before unsharing.  If anyone wants the original file mailed to them,
  send me mail.  - CWM]



              Copyright (C) 1989 University of Oxford
Permission to copy without fee all or part of this material is granted
provided that the copies are not made or distributed for direct
commercial advantage, the University of Oxford copyright notice and the
title and its date appear, and notice is given that copying is by
permission of the University of Oxford or the original contributor.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	README
#	Makefile
#	newstool
#	newstool.1
#	newsreader
#	news.icon
#	nonews.icon
# This archive created: Mon Apr 17 16:20:58 1989
# By:	Jonathan "news" Bowen (Programming Research Group, Oxford University, UK)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'README'" '(1403 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	XThese files relate to the ``newstool'' command which
	Xallows news to be read within a SunView window.
	XThe software has only been tested on a Sun 3/50
	Xusing the news reading program "rn".  The files include:
	X
	X	Makefile	- makefile to install files *
	X	README		- this file *
	X	news.icon	- icon displayed when new news is present
	X	nonews.icon	- icon display when there is no new news
	X	newsreader	- main news reading csh script *
	X	newstool	- start-up shell script *
	X	newstool.1	- manual page for tool *
	X
	X"newstool" is normally invoked by a user (e.g. in $HOME/.suntools
	Xor $HOME/.rootmenu) and this in turn invokes "newsreader".
	X
	X* Note that some files are currently put under "/usr/news".
	XThis may well need to be changed depending on the
	Xlocal configuration. All the files except the icon files
	Xshould be scanned for this string and edited appropriately
	Xbefore the files are installed (by running "make").
	X
	X
	XWritten by
	X	Jonathan Bowen
	X	Oxford University Computing Laboratory,
	X	Programming Research Group,
	X	8-11 Keble Road,
	X	Oxford OX1 3QD,
	X	England.
	X	Tel: +44-865-272574 (Sec: +44-865-273840)
	X
	XCopyright (C) 1987,1988  by J.P.Bowen
	X
	XPermission is granted to copy these files for
	Xnon-profit purposes, provided this notice is left intact.
	X
	XPlease send corrections, improvements, etc. to:
	X	JANET: bowen@uk.ac.oxford.prg
	X	ARPA:  bowen%prg.oxford.ac.uk@nsfnet-relay.ac.uk
	X	UUCP:  ...!uunet!mcvax!ukc!ox-prg!bowen
	X
SHAR_EOF
if test 1403 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 1403 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(360 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	XROOT=/usr/news
	XBIN=/usr/local/bin
	XLIB=$(ROOT)/bin
	XMAN=/usr/man/man1
	XIMAGES=$(ROOT)/images
	X
	Xinstall:
	X	chmod +x newstool newsreader
	X	cp newstool $(BIN)
	X	cp newsreader $(LIB)
	X	cp newstool.1 $(MAN)
	X	cp news.icon nonews.icon $(IMAGES)
	X
	Xshar:
	X	shar -a README Makefile newstool newstool.1 \
	X		newsreader news.icon nonews.icon > newstool.shar
	X	compress newstool.shar
	X
SHAR_EOF
if test 360 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 360 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'newstool'" '(699 characters)'
if test -f 'newstool'
then
	echo shar: will not over-write existing file "'newstool'"
else
sed 's/^	X//' << \SHAR_EOF > 'newstool'
	X#!/bin/sh
	X#
	X#	newstool - window-based news reader
	X#
	X#	Written by Jonathan Bowen, October 1987
	X#
	X
	XPATH=/bin:/usr/ucb:/usr/bin:/usr/local/bin
	XWHO=news
	XROOT=/usr/$WHO
	XICONDIR=$ROOT/images
	XPROGNAME=`basename $0`
	XINTERVAL=300
	X
	Xcase "$1" in
	X-i)
	X	shift
	X	case "$1" in
	X	"")
	X		echo "$PROGNAME: expected interval after -i"
	X		exit 1
	X		;;
	X	*)
	X		INTERVAL=`expr X"$1" : X'\([0-9]*\)'`
	X		if [ "$INTERVAL" = "" ]
	X		then
	X			echo "$PROGNAME: expected digits after -i"
	X			exit 1
	X		fi
	X		shift
	X		;;
	X	esac
	X	;;
	X
	X-u|-U)
	X	echo "Usage: $PROGNAME [-i interval] [tool args]"
	X	exit 0
	X	;;
	X
	Xesac
	X
	Xexport ROOT ICONDIR PROGNAME INTERVAL
	X
	Xexec shelltool -Wi -WI $ICONDIR/nonews.icon -Wl "$PROGNAME" -WL "" $* \
	X		$ROOT/bin/newsreader
SHAR_EOF
if test 699 -ne "`wc -c < 'newstool'`"
then
	echo shar: error transmitting "'newstool'" '(should have been 699 characters)'
fi
chmod +x 'newstool'
fi # end of overwriting check
echo shar: extracting "'newstool.1'" '(1676 characters)'
if test -f 'newstool.1'
then
	echo shar: will not over-write existing file "'newstool.1'"
else
sed 's/^	X//' << \SHAR_EOF > 'newstool.1'
	X.TH NEWSTOOL 1L "9 October 1987" "" "LOCAL"
	X.UC
	X.SH NAME
	Xnewstool \- window-based interface for news
	X.SH SYNOPSIS
	X.B newstool 
	X[
	X.B \-i
	X.I seconds
	X] 
	X.SH DESCRIPTION
	X.I Newstool
	Xis a window-based interface to the \fIrn\fP(1) program for reading news
	Xin the \fISunView\fP environment on a Sun workstation.  The icon
	Xindicates whether there is any news to be read.  Additionally, the bell
	Xis sounded when new news arrives, and \fIrn\fP is automatically
	Xinvoked.  If there is no new news available, \fIrn\fP may still be
	Xinvoked by opening the window and typing ^C to wake up the news
	Xprogram.  The window is automatically closed on exit from \fIrn\fP.
	X.SH OPTIONS
	XThe following options are available:
	X.TP 10
	X.BI \-i " seconds"
	XCheck for new news every \fIseconds\fP seconds.
	XThe default is 300.
	X.TP 10
	X.B \-u
	XDisplay the usage of the command.
	X.PP
	XSubsequently, standard \fIsuntools\fP(1) generic tool arguments may be
	Xsupplied if desired.
	X.PP
	XThe default program used to read news is \fIrn\fP; however, this may be
	Xchanged by setting the \fBNEWSPROG\fP environment variable to the
	Xcommand to be executed when reading news.  For example, the line:
	X.IP
	Xsetenv NEWSPROG "vn \-%" 
	X.LP
	Xwould cause \fIvn\fP to be used with the \fI\-%\fP flag to read news. 
	X.SH FILES
	X.PD 0
	X.TP 40
	X/usr/news/bin/newsreader
	Xmain \fIcsh\fP script
	X.TP 40
	X/usr/news/images/news.icon
	Xnews available icon
	X.TP 40
	X/usr/news/images/nonews.icon
	Xno news available icon
	X.PD
	X.SH "SEE ALSO"
	Xnews(5),
	Xsuntools(1),
	Xrn(1),
	Xrntool(1L),
	Xvn(1)
	X.SH AUTHOR
	XJonathan Bowen, Oxford University.
	X.SH BUGS
	XThis shell script and manual page may change without notice.
	X.PP
	XPlease report problems to \fI<news@uk.ac.oxford.prg>\fP.
SHAR_EOF
if test 1676 -ne "`wc -c < 'newstool.1'`"
then
	echo shar: error transmitting "'newstool.1'" '(should have been 1676 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'newsreader'" '(1316 characters)'
if test -f 'newsreader'
then
	echo shar: will not over-write existing file "'newsreader'"
else
sed 's/^	X//' << \SHAR_EOF > 'newsreader'
	X#!/bin/csh -f
	X#
	X#	News reading program - check for news every 360 seconds,
	X#		change icon etc when news is present/absent.
	X#
	X#	Normally invoked by "newstool".
	X#
	X#	Written by Jonathan Bowen, October 1987
	X#	Based on a "newsread" shell script by Jeremy Jacob, 9 Oct 87
	X#
	X
	X# set ROOT=/usr/news
	X# set ICONDIR=$ROOT/images
	X# set PROGNAME=newstool
	X# set INTERVAL=360
	Xif (${?NEWSPROG}) then
	X  set NONEWS="No news (^C to read news)"
	Xelse
	X  set NONEWS="No news (^C to read old news)"
	Xendif
	X
	Xonintr -
	Xecho -n "&]L&\"
	X
	Xwhile (1)
	X
	X echo -n "&[2t"
	X set NEWNEWS=`rn -c`
	X
	X if (! $#NEWNEWS) then
	X  echo -n "&]I$ICONDIR/nonews.icon&\"
	X  echo -n "&]l$PROGNAME - $NONEWS&\"
	X
	X# Check for new news
	X  while (! $#NEWNEWS)
	X   onintr read
	X   sleep $INTERVAL
	X   set NEWNEWS=`rn -c`
	X   goto cont
	X# Read news anyway
	Xread:
	X   onintr -
	X   echo -n "&]l$PROGNAME - Reading news&\&[1t"
	X   clear
	X   if (${?NEWSPROG}) then
	X	$NEWSPROG
	X   else 
	X	rn
	X   endif
	X   clear
	X   echo -n "&[2t&]l$PROGNAME - $NONEWS&\"
	Xcont:
	X   onintr -
	X  end
	X
	X# Sound bell twice
	X  echo -n "~" ; sleep 1; echo -n "~"
	X# Sound bell and make icon visible
	X# (Not safe if screen is locked)
	X# echo -n "~&[5t" ; echo -n "~"
	X endif
	X
	X# Read new news
	X echo -n "&]I$ICONDIR/news.icon&\"
	X echo -n "&]l$PROGNAME - News&\"
	X clear
	X if (${?NEWSPROG}) then
	X	$NEWSPROG
	X else 
	X	rn
	X endif
	X clear
	X
	Xend
SHAR_EOF
echo shar: 22 control characters may be missing from "'newsreader'"
if test 1316 -ne "`wc -c < 'newsreader'`"
then
	echo shar: error transmitting "'newsreader'" '(should have been 1316 characters)'
fi
chmod +x 'newsreader'
fi # end of overwriting check
echo shar: extracting "'news.icon'" '(1933 characters)'
if test -f 'news.icon'
then
	echo shar: will not over-write existing file "'news.icon'"
else
sed 's/^	X//' << \SHAR_EOF > 'news.icon'
	X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
	X */
	X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
	X	0x8000,0x0000,0x0000,0x0001,0x8003,0x9C00,0x0000,0x0001,
	X	0x8001,0xC800,0x0000,0x0001,0x8001,0xC800,0x0000,0x0001,
	X	0x8001,0x6870,0xC63E,0x0001,0x8001,0x68C8,0xC642,0x0001,
	X	0x8001,0x398C,0xC660,0x0001,0x8001,0x39FC,0xD63C,0x0001,
	X	0x8001,0x1980,0xD61E,0x0001,0x8001,0x1980,0xFE43,0x0001,
	X	0x8001,0x08C4,0xEE61,0x0001,0x8003,0x8878,0xC65E,0x0001,
	X	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
	X	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	X	0xBFFF,0xFD75,0xD346,0x0001,0xA000,0x0524,0x9B49,0x24A1,
	X	0xA010,0x0500,0x0045,0x24D1,0xA040,0x057E,0xAD42,0x2491,
	X	0xA48F,0x7D00,0x0049,0x2C91,0xA8EC,0xE55B,0xEB46,0x1491,
	X	0xAAEA,0xE500,0x0040,0x0001,0xA0AA,0xCD75,0xDF5B,0xE7FD,
	X	0xA8A8,0x8500,0x0040,0x0001,0xAFFF,0xF55F,0xFB57,0x7F7D,
	X	0xA935,0x0500,0x0040,0x0001,0xBFFF,0xFD7E,0x775D,0xFBFD,
	X	0x8000,0x0100,0x0040,0x0001,0xA828,0x0175,0xBD5E,0xFEED,
	X	0xBB3B,0x5500,0x0040,0x0001,0xAB2B,0x756F,0xFF5F,0xBFDD,
	X	0x8000,0x0100,0x0040,0x0001,0xBEFD,0xFD7F,0xCF5D,0xFB7D,
	X	0x8000,0x0100,0x0040,0x0001,0xB7F7,0xFD7B,0xBF57,0xDDDD,
	X	0x8000,0x0100,0x0040,0x0001,0xBBDF,0xDD3E,0xFB5F,0xBDED,
	X	0x8000,0x0100,0x0040,0x0001,0xBF7F,0x7D7F,0x675F,0xFFFD,
	X	0x8000,0x0100,0x0050,0x0005,0xBEE9,0xFD7B,0x9F50,0x3E05,
	X	0x8000,0x0100,0x0050,0x7F05,0xBBDF,0xBD6F,0xEF50,0xFF85,
	X	0x8000,0x0100,0x0051,0xC1C5,0xBFEF,0xFD7E,0xFF51,0x8045,
	X	0x800C,0x4D00,0x0053,0x2165,0xB6ED,0x057B,0xF352,0x52A5,
	X	0x8009,0x6500,0x0052,0x2125,0xBFEA,0x657C,0xFF52,0x0C25,
	X	0x8008,0x8500,0x0052,0x0025,0xBDCF,0x257B,0xBF51,0x3E45,
	X	0x8008,0x0500,0x0050,0x9C85,0xB7EB,0xF57F,0xCF50,0x4105,
	X	0x800A,0x7500,0x0050,0xBE85,0xA7AB,0xB57E,0xEF51,0x0045,
	X	0x800A,0xDD00,0x0052,0x0025,0xBCEF,0xFD6F,0xDF5F,0xFFFD,
	X	0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
SHAR_EOF
if test 1933 -ne "`wc -c < 'news.icon'`"
then
	echo shar: error transmitting "'news.icon'" '(should have been 1933 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'nonews.icon'" '(1933 characters)'
if test -f 'nonews.icon'
then
	echo shar: will not over-write existing file "'nonews.icon'"
else
sed 's/^	X//' << \SHAR_EOF > 'nonews.icon'
	X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
	X */
	X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
	X	0x8000,0x0000,0x0000,0x0001,0x8E70,0x0079,0xC000,0x0001,
	X	0x8720,0x001C,0x8000,0x0001,0x8720,0x001C,0x8000,0x0001,
	X	0x85A0,0xC016,0x870C,0x63E1,0x85A1,0x2016,0x8C8C,0x6421,
	X	0x84E3,0x3013,0x98CC,0x6601,0x84E3,0x3013,0x9FCD,0x63C1,
	X	0x8463,0x3011,0x980D,0x61E1,0x8463,0x3011,0x980F,0xE431,
	X	0x8421,0x2010,0x8C4E,0xE611,0x8E20,0xC078,0x878C,0x65E1,
	X	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
	X	0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
	X	0xBFFF,0xFD75,0xD346,0x0001,0xA000,0x0524,0x9B49,0x24A1,
	X	0xA000,0x0500,0x0045,0x24D1,0xA000,0x0500,0x0042,0x2491,
	X	0xA000,0x0500,0x0049,0x2C91,0xA000,0x0500,0x0046,0x1491,
	X	0xA000,0x0500,0x0040,0x0001,0xA000,0x0500,0x0040,0x0001,
	X	0xA000,0x0500,0x0040,0x0001,0xA000,0x0500,0x0040,0x0001,
	X	0xA000,0x0500,0x0040,0x0001,0xBFFF,0xFD00,0x0040,0x0001,
	X	0x8000,0x0100,0x0040,0x0001,0xA828,0x0100,0x0040,0x0001,
	X	0xBB3B,0x5500,0x0040,0x0001,0xAB2B,0x7500,0x0040,0x0001,
	X	0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
	X	0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
	X	0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x0040,0x0001,
	X	0x8000,0x0100,0x0040,0x0001,0x8000,0x0100,0x005F,0xFFFD,
	X	0x8000,0x0100,0x0050,0x0005,0x8000,0x0100,0x0050,0x0005,
	X	0x8000,0x0100,0x0050,0x0005,0x8000,0x0100,0x0050,0x0005,
	X	0x8000,0x0100,0x0050,0x0005,0x800F,0xFD00,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x8008,0x0500,0x0050,0x0005,
	X	0x8008,0x0500,0x0050,0x0005,0x800F,0xFD00,0x005F,0xFFFD,
	X	0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
SHAR_EOF
if test 1933 -ne "`wc -c < 'nonews.icon'`"
then
	echo shar: error transmitting "'nonews.icon'" '(should have been 1933 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0