#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "struct.h"

/*
 *	User name/validation code
 */

char *Is_Legal_Name(x,u)
char *x;
int u;
{
	char *xb=x;
	if(strlen(x)<1||strlen(x)>10)
		return("Names must be between 1 and 10 characters long.");
	while(*x)
	{
		if(isupper(*x))
			*x=tolower(*x);
		if(*x<'a'||*x>'z')
		{
			return("Names must be alphabetic.");
		}
		x++;
	}
	if(FindWord(xb,0))
		return("That name might be confused with something else... try another.");
	AddWord(xb,28000+u,3);
	*xb=toupper(*xb);
	return(NULL);
}