blob: 90bc87e506ca02a7ee5ed46bd3f14ca2962a3633 (
plain) (
tree)
|
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "word.h"
#include "hash.h"
#define MAXWORD 100
#define HASHSIZE 100
struct nlist *hashtab[HASHSIZE];
int main(void)
{
char word[MAXWORD];
char *name;
while (getword(word, MAXWORD) != EOF) {
if (!strcmp(word, "#define")) {
getword(word, MAXWORD);
name = strdup(word);
getword(word, MAXWORD);
install(hashtab, HASHSIZE, name, word);
free(name);
} else if (!strcmp(word, "#undef")) {
getword(word, MAXWORD);
undef(hashtab, HASHSIZE, word);
}
}
phashtab(hashtab, HASHSIZE);
hashfree(hashtab, HASHSIZE);
return 0;
}
|