#include "header.h"
static char copyright[]="Larn is copyrighted 1986 by Noah Morgan.\n";
extern int c[];
static char logname[20];
extern char mail601[],mail602[],mail603[],mail604[],mail605[];
static char mail600[] = "/tmp/#mail600";
/*
 *	function to mail the tax bill to the user
 */
makebill()
{
/* strcpy(logname,getlogin()); */

if (lcreat(mail600) < 0) { write(1,"can't write 600 letter\n",23); return; }
lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
lprcat("\nFrom:  the LRS (Larn Revenue Service)\n");
lprcat("\nSubject:  undeclared income\n");
lprcat("\n   We heard you survived the caverns of Larn.  Let me be the");
lprcat("\nfirst to congratulate you on your success.  It is quite a feat.");
lprcat("\nIt must also have been very profitable for you.");
lprcat("\n\n   The Dungeon Master has informed us that you brought");
lprintf("\n%d gold pieces back with you from your journey.  As the",c[GOLD]);
lprcat("\ncounty of Larn is in dire need of funds, we have spared no time");
lprintf("\nin preparing your tax bill.  You owe %d gold pieces as",c[GOLD]*TAXRATE);
lprcat("\nof this notice, and is due within 5 days.  Failure to pay will");
lprcat("\nmean penalties.  Once again, congratulations, We look forward");
lprcat("\nto your future successful expeditions.\n");
lwclose();

sprintf(lpbuf,"sleep 30 ; mail %s < %s ; sleep 30 ; mail %s < %s ; sleep 30 ;\
mail %s < %s ; sleep 30 ; mail %s < %s ; sleep 30 ; mail %s < %s ; sleep 30 ;\
mail %s < %s ; sleep 30 ; /bin/rm %s",
logname,mail600,logname,mail601,logname,mail602,logname,mail603,logname,mail604,logname,mail605,mail600);
}

mailbill()
	{
	makebill();		wait(0);	if (fork() == 0) system(lpbuf);
	}
