#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/commands/supp.c,v 2.1 1995/09/26 18:41:00 empire Exp $";
#endif /* not lint */

/*
 * supp.c
 *
 */

#include "misc.h"
#include "player.h"
#include "var.h"
#include "xy.h"
#include "sect.h"
#include "land.h"
#include "nat.h"
#include "nsc.h"
#include "deity.h"
#include "file.h"

supp()
{
	int	nunits;
	struct	nstr_item ni;
	struct	lndstr land;

	if (!snxtitem(&ni, EF_LAND, player->argp[1]))
		return RET_SYN;

	nunits = 0;
	while (nxtitem(&ni, (s_char *)&land)) {
		if (!player->owner || land.lnd_own == 0)
			continue;
		nunits++;
		resupply_all(&land);
		putland(land.lnd_uid,&land);
		if (has_supply(&land))
			pr("%s has supplies\n", prland(&land));
		else
			pr("%s is out of supply\n", prland(&land));
	}
	if (nunits == 0) {
		if (player->argp[1])
			pr("%s: No unit(s)\n", player->argp[1]);
		else
			pr("%s: No unit(s)\n", "");
		return RET_FAIL;
	}else
		pr("%d unit%s\n", nunits, splur(nunits));
	return RET_OK;
}
