#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/player/nat.c,v 2.0 1995/01/23 20:27:48 empire Exp $";
#endif

/*
 * nat.c
 *
 * probably should move this into common
 *
 * Dave Pare, 1994
 */

#include "misc.h"
#include "nat.h"
#include "file.h"
#include <fcntl.h>

int
natbyname(name, result)
	s_char	*name;
	natid	*result;
{
	struct	natstr *np;
	int	i;

	for (i=0; np = getnatp(i); i++) {
		if (strcmp(np->nat_cnam, name) == 0) {
			*result = i;
			return 0;
		}
	}
	*result = 255;
	return -1;
}

int
natpass(cn, pass)
	int	cn;
	s_char	*pass;
{
	struct	natstr *np;

	np = getnatp((natid)cn);
	if (np->nat_stat == VIS)
		return 1;
	if (strcmp(np->nat_pnam, pass) == 0)
		return 1;
	return 0;
}
