[comp.text] To Do list - troff recursion

friedman@chekov.UU.NET (Barry Friedman) (01/23/91)

Here is an interesting and perhaps useful example for compulsive list
makers. It should be formatted without any macro package specified.
If any problems are encountered, remove comments and try again.

I hope no one objects to the use of net.bandwith for this.

#---------------------------------- cut here ----------------------------------
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Barry Friedman <friedman@lab360> on Tue Jan 22 21:27:02 1991
#
# This archive contains:
#	net-todo	
#
# Existing files will not be overwritten.
# Error checking via wc(1) will be performed.

LANG=""; export LANG
PATH=/bin:/usr/bin:$PATH; export PATH

if test -f net-todo
then
	echo Ok to overwrite existing file net-todo\?
	read answer
	case "$answer" in
	[yY]*)	echo Proceeding;;
	*)	echo Aborting; exit 1;;
	esac
	rm -f net-todo
	if test -f net-todo
	then
		echo Error: could not remove net-todo, aborting
		exit 1
	fi
fi
echo x - net-todo
sed 's/^@//' >net-todo <<'@EOF'
'''\"     
'''\"    Demonstration of Recursive Loop control in troff 
'''\"    This script will print 2-up TODO lists 
'''\"     
.de BP                                \" loop initialization
.nr Aa \\$1 1                         \" rep cnt
.Br
@..
.de Br                                \" Recursively called
\(sq	\s11\l'3.0i'\s0
.br
.if \\n-(Aa .Br
@..
.de Td                                \" Print heading
.ft HB
\s11Project: \l'2.5i'
.ps 24
.vs 26
.sp
THINGS
.br
TO DO       \s11DATE:\l'1.5i'
.sp
.vs 34
.ps 18
.BP 18                               \"  Call BP to repeat Br 18 times
@..
'''\"       Mainline
.po 0
.ll 8.5i
.br
.rs
.sp |.3i
.mk
.Td  \" Left hand copy
.rt
.in +4.25i
.Td  \" Right hand copy
.br
@EOF
set `wc -lwc <net-todo`
if test $1$2$3 != 39104709
then
	echo ERROR: wc results of net-todo are $* should be 39 104 709
fi

chmod 666 net-todo

exit 0
--
Barry Friedman                INTERNET: friedman%chekov@uunet.uu.net
Phone: (613) 782-2389         UUCP: ...!uunet!chekov!friedman
Emax Computer Systems Inc.  440 Laurier Ave. W., Ottawa, Ont. Canada K1R 5C4