blob: 7f26dfd1b4c5f5b491fc95580f0ef28bf182fc6b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <ctype.h>
#include <string.h>
#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]);
}
|