.fp 3 CW
.CW
.nr cW \n(.f
.ft P
.nr cE \n(.f
.br
.ft 3
.cs 3 24
\(de	usage:	merge src1 src2 [ dest ]
\(de	merge two f\&iles, every other line.
\(de	the f\&irst argument starts of\&f\& the merge,
\(de	excess lines of\& the longer f\&ile are appended to
\(de	the end of\& the resultant f\&ile
exec 4\(fi$1 5\(fi$2
dest=$\(Fl3-$1.m\(Fi		\(de def\&ault destination f\&ile is named $1.m
while true 
do
			\(de alternate reading f\&rom the f\&iles;
			\(de 'more' represents the f\&ile descriptor
			\(de of\& the longer f\&ile
	line \(fi&4 \(fl\(fl$dest || \(Fl more=5; break ;\(Fi
	line \(fi&5 \(fl\(fl$dest || \(Fl more=4; break ;\(Fi
done
ed - $dest \(fi\(fi\(rgeof\&
	H		\(de delete the last line of\& destination
	$d		\(de f\&ile, because it is blank.
	w
	q
eof\&
while line \(fi&$more \(fl\(fl $dest
do :; done		\(de read the remainder of\& the longer
			\(de f\&ile - the body of\& the 'while' loop
			\(de does nothing; the work of\& the loop
			\(de is done in the command list f\&ollowing
			\(de 'while'
.br
.cs 3
.ft \n(cE
.ft \n(cW
.CN
