@@ -134,25 +134,26 @@ void CommandLine::DumpHelp(const char* program)
134
134
printf (" Note: Inputs are case insensitive.\n " );
135
135
}
136
136
137
- // Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the command line.
138
- // Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might have issues...
139
- // Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass in negatives.. :-|
137
+ // Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the
138
+ // command line. Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might
139
+ // have issues... Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass
140
+ // in negatives.. :-|
140
141
bool CommandLine::Parse (int argc, char * argv[], /* OUT */ Options* o)
141
142
{
142
- size_t argLen = 0 ;
143
+ size_t argLen = 0 ;
143
144
size_t tempLen = 0 ;
144
145
145
- bool foundVerb = false ;
146
+ bool foundVerb = false ;
146
147
bool foundFile1 = false ;
147
148
bool foundFile2 = false ;
148
149
149
- if (argc == 1 ) // Print help when no args are passed
150
+ if (argc == 1 ) // Print help when no args are passed
150
151
{
151
152
DumpHelp (argv[0 ]);
152
153
return false ;
153
154
}
154
155
155
- for (int i = 1 ; i< argc; i++)
156
+ for (int i = 1 ; i < argc; i++)
156
157
{
157
158
bool isASwitch = (argv[i][0 ] == ' -' );
158
159
#ifndef FEATURE_PAL
@@ -162,98 +163,97 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
162
163
}
163
164
#endif // !FEATURE_PAL
164
165
165
- // Process a switch
166
+ // Process a switch
166
167
if (isASwitch)
167
168
{
168
169
argLen = strlen (argv[i]);
169
170
170
- if (argLen >1 )
171
- argLen--; // adjust for leading switch
171
+ if (argLen > 1 )
172
+ argLen--; // adjust for leading switch
172
173
else
173
174
{
174
175
DumpHelp (argv[0 ]);
175
176
return false ;
176
177
}
177
178
178
- if ((_strnicmp (&argv[i][1 ], " help" , argLen) == 0 ) ||
179
- (_strnicmp (&argv[i][1 ], " ?" , argLen) == 0 ))
179
+ if ((_strnicmp (&argv[i][1 ], " help" , argLen) == 0 ) || (_strnicmp (&argv[i][1 ], " ?" , argLen) == 0 ))
180
180
{
181
181
DumpHelp (argv[0 ]);
182
182
return false ;
183
183
}
184
184
else if ((_strnicmp (&argv[i][1 ], " ASMDump" , argLen) == 0 ))
185
185
{
186
- tempLen = strlen (argv[i]);
187
- foundVerb = true ;
186
+ tempLen = strlen (argv[i]);
187
+ foundVerb = true ;
188
188
o->actionASMDump = true ;
189
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
189
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
190
190
goto processMCL;
191
191
}
192
192
else if ((_strnicmp (&argv[i][1 ], " concat" , argLen) == 0 ))
193
193
{
194
- tempLen = strlen (argv[i]);
195
- foundVerb = true ;
194
+ tempLen = strlen (argv[i]);
195
+ foundVerb = true ;
196
196
o->actionConcat = true ;
197
197
}
198
198
else if ((_strnicmp (&argv[i][1 ], " copy" , argLen) == 0 ))
199
199
{
200
- tempLen = strlen (argv[i]);
201
- foundVerb = true ;
200
+ tempLen = strlen (argv[i]);
201
+ foundVerb = true ;
202
202
o->actionCopy = true ;
203
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
203
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
204
204
goto processMCL;
205
205
}
206
206
else if ((_strnicmp (&argv[i][1 ], " dump" , argLen) == 0 ))
207
207
{
208
- tempLen = strlen (argv[i]);
209
- foundVerb = true ;
208
+ tempLen = strlen (argv[i]);
209
+ foundVerb = true ;
210
210
o->actionDump = true ;
211
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
211
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
212
212
goto processMCL;
213
213
}
214
214
else if ((_strnicmp (&argv[i][1 ], " fracture" , argLen) == 0 ))
215
215
{
216
- tempLen = strlen (argv[i]);
217
- foundVerb = true ;
216
+ tempLen = strlen (argv[i]);
217
+ foundVerb = true ;
218
218
o->actionFracture = true ;
219
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
219
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
220
220
goto processMCL;
221
221
}
222
222
else if ((_strnicmp (&argv[i][1 ], " dumpmap" , argLen) == 0 ))
223
223
{
224
- tempLen = strlen (argv[i]);
225
- foundVerb = true ;
224
+ tempLen = strlen (argv[i]);
225
+ foundVerb = true ;
226
226
o->actionDumpMap = true ;
227
227
}
228
228
else if ((_strnicmp (&argv[i][1 ], " dumptoc" , argLen) == 0 ))
229
229
{
230
- tempLen = strlen (argv[i]);
231
- foundVerb = true ;
230
+ tempLen = strlen (argv[i]);
231
+ foundVerb = true ;
232
232
o->actionDumpToc = true ;
233
233
}
234
234
else if ((_strnicmp (&argv[i][1 ], " ildump" , argLen) == 0 ))
235
235
{
236
- tempLen = strlen (argv[i]);
237
- foundVerb = true ;
236
+ tempLen = strlen (argv[i]);
237
+ foundVerb = true ;
238
238
o->actionILDump = true ;
239
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
239
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
240
240
goto processMCL;
241
241
}
242
242
else if ((_strnicmp (&argv[i][1 ], " merge" , argLen) == 0 ))
243
243
{
244
- tempLen = strlen (argv[i]);
245
- foundVerb = true ;
244
+ tempLen = strlen (argv[i]);
245
+ foundVerb = true ;
246
246
o->actionMerge = true ;
247
247
}
248
248
else if ((_strnicmp (&argv[i][1 ], " recursive" , argLen) == 0 ))
249
249
{
250
- tempLen = strlen (argv[i]);
250
+ tempLen = strlen (argv[i]);
251
251
o->recursive = true ;
252
252
}
253
253
else if ((_strnicmp (&argv[i][1 ], " toc" , argLen) == 0 ))
254
254
{
255
- tempLen = strlen (argv[i]);
256
- foundVerb = true ;
255
+ tempLen = strlen (argv[i]);
256
+ foundVerb = true ;
257
257
o->actionTOC = true ;
258
258
}
259
259
else if ((_strnicmp (&argv[i][1 ], " input" , argLen) == 0 ))
@@ -294,8 +294,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
294
294
}
295
295
else if ((_strnicmp (&argv[i][1 ], " integ" , argLen) == 0 ))
296
296
{
297
- tempLen = strlen (argv[i]);
298
- foundVerb = true ;
297
+ tempLen = strlen (argv[i]);
298
+ foundVerb = true ;
299
299
o->actionInteg = true ;
300
300
}
301
301
else if ((_strnicmp (&argv[i][1 ], " mcl" , argLen) == 0 ))
@@ -316,24 +316,24 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
316
316
}
317
317
else if ((_strnicmp (&argv[i][1 ], " removeDup" , argLen) == 0 ))
318
318
{
319
- tempLen = strlen (argv[i]);
320
- foundVerb = true ;
319
+ tempLen = strlen (argv[i]);
320
+ foundVerb = true ;
321
321
o->actionRemoveDup = true ;
322
322
}
323
323
else if ((_strnicmp (&argv[i][1 ], " stat" , argLen) == 0 ))
324
324
{
325
- tempLen = strlen (argv[i]);
326
- foundVerb = true ;
325
+ tempLen = strlen (argv[i]);
326
+ foundVerb = true ;
327
327
o->actionStat = true ;
328
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
328
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
329
329
goto processMCL;
330
330
}
331
331
else if ((_strnicmp (&argv[i][1 ], " strip" , argLen) == 0 ))
332
332
{
333
- tempLen = strlen (argv[i]);
334
- foundVerb = true ;
333
+ tempLen = strlen (argv[i]);
334
+ foundVerb = true ;
335
335
o->actionStrip = true ;
336
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
336
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
337
337
goto processMCL;
338
338
}
339
339
else if ((_strnicmp (&argv[i][1 ], " thin" , argLen) == 0 ))
@@ -346,10 +346,10 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
346
346
}
347
347
else if ((_strnicmp (&argv[i][1 ], " smarty" , argLen) == 0 ))
348
348
{
349
- tempLen = strlen (argv[i]);
349
+ tempLen = strlen (argv[i]);
350
350
o->actionSmarty = true ;
351
- foundVerb = true ;
352
- if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
351
+ foundVerb = true ;
352
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
353
353
goto processMCL;
354
354
}
355
355
else if ((_strnicmp (&argv[i][1 ], " verbosity" , argLen) == 0 ))
@@ -378,12 +378,11 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
378
378
DumpHelp (argv[0 ]);
379
379
return false ;
380
380
}
381
-
382
381
}
383
- // Process an input filename
382
+ // Process an input filename
384
383
else
385
384
{
386
- char * lastdot = strrchr (argv[i], ' .' );
385
+ char * lastdot = strrchr (argv[i], ' .' );
387
386
if (lastdot != nullptr )
388
387
{
389
388
if (_stricmp (lastdot, " .mcl" ) == 0 )
0 commit comments