+ Fixes
[opsoft.git] / silentbob / src / opts_funcs.cxx
blobab16d2499f27068d80e34fafb2ea0da9e8ff63f7
1 /*
2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
5 */
7 #include <head.h>
8 #include <wit.h>
9 #include <mod.h>
11 void dumpOptions ()
13 char * S;
14 ENV->listOptions->first ();
15 while ((S = ENV->listOptions->get ())) {
16 printf ("%s ", S);
17 ENV->listOptions->next ();
19 printf ("\n");
22 int opts_funcs (DArray * d_opts, int & i)
24 char * opt;
26 if (! d_opts)
27 return -1;
29 opt = d_opts->get (i);
31 if (EQ (opt, "--help") || EQ (opt, "-h")) {
32 usage ();
33 exit (0);
36 if (EQ (opt, "-V") || EQ (opt, "--version")) {
37 printf ("Silent Bob 1.7.2\n");
38 exit (0);
41 if (EQ (opt, "--file")) {
42 ENV->sb_cmd = cmd_file;
43 return 0;
46 if (EQ (opt, "--the-tt")) {
47 ENV->sb_cmd = cmd_the_tt;
48 return 0;
51 if (EQ (opt, "--structs")) {
52 ENV->sb_cmd = cmd_give_structs;
53 return 0;
56 if (EQ (opt, "--indent")) {
57 ENV->sb_cmd = cmd_indent;
58 return 0;
61 if (EQ (opt, "--tags")) {
62 ENV->sb_cmd = cmd_tags;
63 return 0;
66 if (EQ (opt, "--make-ctags") ||
67 EQ (opt, "-c")) {
68 ENV->sb_cmd = cmd_makectags;
69 return 0;
72 if (EQ (opt, "--call-tags") ||
73 EQ (opt, "-ct")) {
74 SB_FLSET (SB_FLTAGSTYLE);
75 ENV->sb_cmd = cmd_call_tags;
76 return 0;
79 if (EQ (opt, "--cgrep")) {
80 if (++i >= d_opts->get_size ())
81 return 0;
83 ENV->sb_cmd = cmd_cgrep;
84 ENV->cgrep_exp = d_opts->get (i);
85 return 0;
88 if (EQ (opt, "--tags")) {
89 ENV->sb_cmd = cmd_tags;
90 return 0;
93 if (EQ (opt, "-i")) {
94 tags_interactive ();
95 exit (0);
98 if (EQ (opt, "--cfiles") ||
99 EQ (opt, "-f")) {
100 bob_cfiles ();
101 exit (0);
104 if (EQ (opt, "--time-test"))
105 Dtimer ();
107 if (EQ (opt, "--plugins-viewer")) {
108 plugins_viewer ();
109 exit (0);
112 if (EQ (opt, "--options")) {
113 dumpOptions ();
114 exit (0);
117 return -1;