2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
14 ENV
->listOptions
->first ();
15 while ((S
= ENV
->listOptions
->get ())) {
17 ENV
->listOptions
->next ();
22 int bob_options (DArray
* d_opts
, int & i
)
30 opt
= d_opts
->get (i
);
31 argc
= d_opts
->get_size ();
34 ENV
->d_files
->add (strdup (opt
));
38 if (EQ (opt
, "--help") || EQ (opt
, "-h")) {
43 if (EQ (opt
, "-V") || EQ (opt
, "--version")) {
44 printf ("Silent Bob 2.0\n");
48 if (EQ (opt
, "--perl")) {
49 ENV
->language
= strdup ("Perl");
53 if (EQ (opt
, "--file")) {
54 ENV
->sb_cmd
= cmd_file
;
58 if (EQ (opt
, "--files")) {
59 if (builtin_language ()) {
60 ENV
->sb_cmd
= cmd_files
;
66 if (EQ (opt
, "--the-tt")) {
67 ENV
->sb_cmd
= cmd_the_tt
;
71 if (EQ (opt
, "--structs")) {
72 ENV
->sb_cmd
= cmd_give_structs
;
76 if (EQ (opt
, "--indent")) {
77 ENV
->sb_cmd
= cmd_indent
;
81 if (EQ (opt
, "--tags")) {
82 ENV
->sb_cmd
= cmd_tags
;
86 if (EQ (opt
, "--make-ctags") ||
88 ENV
->sb_cmd
= cmd_makectags
;
92 if (EQ (opt
, "--call-tags") ||
94 SB_FLSET (SB_FLTAGSTYLE
);
95 ENV
->sb_cmd
= cmd_call_tags
;
99 if (EQ (opt
, "--cgrep")) {
100 if (++i
>= d_opts
->get_size ())
103 ENV
->sb_cmd
= cmd_cgrep
;
104 ENV
->cgrep_exp
= d_opts
->get (i
);
108 if (EQ (opt
, "--tags")) {
109 ENV
->sb_cmd
= cmd_tags
;
113 if (EQ (opt
, "-i")) {
118 if (EQ (opt
, "--cfiles") ||
124 if (EQ (opt
, "--time-test"))
127 if (EQ (opt
, "--plugins-viewer")) {
132 if (EQ (opt
, "--options")) {
137 if (EQ (opt
, "--verbose")) {
138 SB_FLSET (SB_FLVERBOSE
);
142 if (EQ (opt
, "-u")) {
143 SB_FLSET (SB_FLRTREE
);
147 if (EQ (opt
, "--linear") ||
149 SB_FLSET (SB_FLLINEAR
);
153 if (EQ (opt
, "-C") && i
< argc
) {
155 chdir (d_opts
->get (i
));
159 if (EQ (opt
, "--linux")) {
160 chdir ("/usr/src/linux");
164 if (EQ (opt
, "--debug")) {
165 SB_FLSET (SB_FLDEBUG
);
169 if (EQ (opt
, "--simulate")) {
171 SB_FLSET (SB_FLSIMULATE
);
175 if (EQ (opt
, "--no-links")) {
176 SB_FLSET (SB_FLNOLINKS
);
180 if (EQ (opt
, "-a") || EQ (opt
, "--all")) {
185 if (EQ (opt
, "--test") || EQ (opt
, "-t")) {
186 SB_FLSET (SB_FLTEST
);
190 if (EQ (opt
, "--ctags-append")) {
191 SB_FLSET (SB_FLCTAGSAPPEND
);
195 if (EQ (opt
, "-A")) {
199 ENV
->cgrep_A
= atoi (d_opts
->get (i
));
203 if (EQ (opt
, "-B")) {
207 ENV
->cgrep_B
= atoi (d_opts
->get (i
));
211 if (EQ (opt
, "-j")) {
214 ENV
->max_proc
= atoi (d_opts
->get (i
));
218 if (EQ (opt
, "--tag-style") || EQ (opt
, "-ts")) {
219 SB_FLSET (SB_FLTAGSTYLE
);
223 if (EQ (opt
, "-L") && ((i
+1) < argc
)) {
225 ENV
->d_files
->from_file (d_opts
->get (i
));
226 ENV
->d_files
->foreach ((Dfunc_t
) chomp
);
230 if (EQ (opt
, "--depth")) {
234 ENV
->d_depth
= atoi (d_opts
->get (i
));
238 if (EQ (opt
, "-fn")) {
239 SB_FLSET (SB_FLFNAMES
);
243 if (EQ (opt
, "--lang")) {
247 ENV
->language
= strdup (d_opts
->get (i
));
248 if (EQ (ENV
->language
, "cpp") ||
249 EQ (ENV
->language
, "cxx") ||
250 EQ (ENV
->language
, "c++")) {
251 delete ENV
->language
;
252 ENV
->language
= strdup ("C++");
258 if (EQ (opt
, "--thread")) {
259 SB_FLSET (SB_FLTHREAD
);