summaryrefslogtreecommitdiff
path: root/other/Kermit/src/findsym.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/Kermit/src/findsym.cpp')
-rw-r--r--other/Kermit/src/findsym.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/other/Kermit/src/findsym.cpp b/other/Kermit/src/findsym.cpp
new file mode 100644
index 0000000..cceefab
--- /dev/null
+++ b/other/Kermit/src/findsym.cpp
@@ -0,0 +1,74 @@
1/*
2 * findsym.cpp:
3 * written by palmers / teso
4 */
5#include <DevMemPatt.hpp>
6#include <SymbolFingp.hpp>
7#include <iostream>
8
9
10#define PROGRAM "findsym"
11#define AUTHOR "palmers / teso"
12#define VERSION "0.0.2"
13
14
15void usage (char *s)
16{
17 cout << PROGRAM << VERSION << " by " << AUTHOR << endl;
18 cout << "Usage: " << s << " [Options] name0 [name1 ... nameN]" << endl;
19 cout << "Options:" << endl;
20 cout << "\t-s:\t\t silent mode" << endl;
21 cout << "\t-f <file>:\t set config file to <file>" << endl;
22 cout << endl;
23 exit (0);
24}
25
26
27int main (int argc, char **argv)
28{
29 bool silent = false;
30 int x = 1;
31 DevMemPatt *a = new DevMemPatt ();
32 SymbolFingp *b = new SymbolFingp ();
33
34 if (argc < 2)
35 usage (argv[0]);
36
37 cout.setf (ios::hex, ios::basefield);
38 while (x < argc)
39 {
40 if (argv[x][0] == '-')
41 {
42 switch (argv[x][1])
43 {
44 case 's':
45 if (silent == false)
46 silent = true;
47 else
48 silent = false;
49 break;
50 case 'f':
51 if (b != NULL)
52 delete b;
53 b = new SymbolFingp (string (argv[++x]));
54 break;
55 default:
56 cerr << "Illegal option!" << endl;
57 usage (argv[0]);
58 break;
59 }
60 }
61 else
62 {
63 if (silent)
64 cout << a->find_patt (b->getFinger (string (argv[x]))) << endl;
65 else
66 cout << argv[x] << '\t' << a->find_patt (b->getFinger (string (argv[x]))) << endl;
67 }
68 x++;
69 }
70
71 delete a;
72 delete b;
73 return 0;
74}