#include #include #include "getch.h" #include "word.h" char getword(char *word, int lim) { char *w = word; if (isalpha(*w = getch())) { while ((isalnum(*++w = getch()) || *w == '_') && --lim > 0) ; ungetch(*w--); } *++w = '\0'; return word[0]; } void ungetword(char *word) { int len; for (len = strlen(word); len >= 0; --len) ungetch(word[len]); }