/* ctype.c */
#include "ctype.h"

/* Test if given character is alpha (including underscore) */
int alpha(char c)
{
	c = c & 127;
	return (((c >= 'a') & (c <= 'z')) | ((c >= 'A') & (c <= 'Z')) | (c == '_'));
}

/* Test if given character is numeric */
int numeric(char c)
{
	c = c & 127;
	return((c >= '0') & (c <= '9'));
}

/* Test if given character is alphanumeric */
int an(char c)
{
	return((alpha(c)) | (numeric(c)));
}

/* Convert lower case to upper */
char toupperi(char c)
{
	if ((c >= 'a') & (c <= 'z'))
		c = c - 'a' + 'A';
	return(c);
}