#ifndef lint
static char *RCSid = "$Header: /users/empire/EMP/empmain/SUBS/RCS/natarg.c,v 1.3 89/06/25 15:38:51 mr-frog Exp $";
#endif

/*
 * natarg.c
 *
 * return country # given country name or
 * country #.
 *
 * from PSL Empire, 1985
 */

#include <ctype.h>
#include "misc.h"
#include "nat.h"

int
natarg(arg, prompt)
	char	*arg;
	char	*prompt;
{
	int	n;

	arg = getstarg(arg, prompt);
	if (arg == 0 || *arg == 0)
		return -1;
	if (isdigit(*arg))
		n = atoi(arg);
	else
		n = cnumb(arg);
	if (n < 0 || n >= MAXNOC) {
		pr("No such country exists.\n");
		n = -1;
	}
	return n;
}
