aboutsummaryrefslogblamecommitdiff
path: root/6.4/word.c
blob: c5a6381020043b92d1f5ebf99ca2225e94af1556 (plain) (tree)



















                                                                           
#include <ctype.h>
#include "getch.h"
#include "word.h"

char getword(char *word, int lim)
{
	char *w = word;

	while (isblank(*w = getch()))
		;
	
	if (isalpha(*w)) {
		while ((isalnum(*++w = getch()) || *w == '_') && --lim > 0)
			;
		ungetch(*w--);
	}

	*++w = '\0';
	return word[0];
}