-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.c
83 lines (53 loc) · 1.26 KB
/
main.c
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "main.h"
#include "hash.h"
#include "list.h"
#include "io.h"
#include "stack.h"
#include "unit.h"
#include "dictionary.h"
extern stack_t STACK;
int main(int argc, char *argv[]) {
int iRC;
char pFindWord[80];
iRC=EXIT_SUCCESS;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
iRC=EXIT_FAILURE;
exit(iRC);
}
#ifdef thomas
#endif
init_hash_table();
ReadFile(argv[1]);
// dump_hashtable();
// Now that dictionary is hashed,
// look up some words.
strcpy(pFindWord,"AMMA");
if (0 != lookupWord(pFindWord)) {
printf("%s is not found.\n\n",pFindWord);
}
strcpy(pFindWord,"AMMETER");
if (0 != lookupWord(pFindWord)) {
printf("%s is not found.\n\n",pFindWord);
}
strcpy(pFindWord,"AMPMETER");
if (0 != lookupWord(pFindWord)) {
printf("%s is not found.\n\n",pFindWord);
}
strcpy(pFindWord,"VOLTMETER");
if (0 != lookupWord(pFindWord)) {
printf("%s is not found.\n\n",pFindWord);
}
strcpy(pFindWord,"MAGPIE");
if (0 != lookupWord(pFindWord)) {
printf("%s is not found.\n\n",pFindWord);
}
// Stack final check. This code should never print anything.
while (stack_not_empty(&STACK)) {
printf("main.c->%s",pop(&STACK));
}
exit(iRC);
}