#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/commands/ledg.c,v 2.0 1995/01/25 19:23:25 empire Exp $";
#endif /* not lint */

/*
 * ledg.c
 *
 * get a report of the current ledger
 * (loans from and to other countries)
 *
 * from PSL Empire, 1985
 */

#include "misc.h"
#include "player.h"
#include "loan.h"
#include "file.h"
#include "xy.h"
#include "nsc.h"
#include "nat.h"

ledg()
{
	struct	nstr_item nstr;
	struct	lonstr loan;
	int	nloan;

	if (!snxtitem(&nstr, EF_LOAN, player->argp[1]))
		return RET_SYN;
	pr("\n... %s Ledger ...\n", cname(player->cnum));
	nloan = 0;
	while (nxtitem(&nstr, (s_char *)&loan)) {
		if (disloan(nstr.cur, &loan) > 0)
			nloan++;
	}
	if (!nloan)
		pr("No loans found\n");
	else
		pr("%d loan%s outstanding.\n", nloan, splur(nloan));
	return RET_OK;
}
