blob: 1d581c64705f43a8889767a5b51e0cf679d36336 (
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
27
28
29
30
31
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "word.h"
#include "tree.h"
#define MAXWORD 100
#define DEFLEN 6
int main(int argc, char *argv[])
{
struct tnode *root;
char word[MAXWORD];
int found = NO;
int bar;
bar = (--argc && (**++argv == '-')) ? atoi(argv[0]+1) : DEFLEN;
root = NULL;
while (getword(word, MAXWORD) != EOF) {
if ((isalpha(word[0]) || (word[0] == '#' && isalpha(word[1])))
&& strlen(word) > (size_t) bar)
root = naddtree(root, word, bar, &found);
found = NO;
}
ntreeprint(root);
treefree(root);
return 0;
}
|