MCPcopy Create free account
hub / github.com/dds-bridge/dds / read_args

Function read_args

library/tests/args.cpp:183–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183void read_args(
184 int argc,
185 char * argv[])
186{
187 for (unsigned i = 0; i < DTEST_NUM_OPTIONS; i++)
188 {
189 shortOptsAll += optList[i].shortName;
190 if (optList[i].numArgs)
191 shortOptsWithArg += optList[i].shortName;
192 }
193
194 if (argc == 1)
195 {
196 usage(argv[0]);
197 exit(0);
198 }
199
200 SetDefaults();
201
202 int c, m = 0;
203 bool errFlag = false, matchFlag;
204 string stmp;
205 char * ctmp;
206 struct stat buffer;
207
208 while ((c = GetNextArgToken(argc, argv)) > 0)
209 {
210 switch(c)
211 {
212 case 'f':
213 if (stat(optarg, &buffer) == 0)
214 {
215 options.fname_ = string(optarg);
216 break;
217 }
218
219 stmp = "../hands/list" + string(optarg) + ".txt";
220 if (stat(stmp.c_str(), &buffer) == 0)
221 {
222 options.fname_ = stmp;
223 break;
224 }
225
226 cout << "Input file '" << optarg << "' not found\n";
227 cout << "Input file '" << stmp << "' not found\n";
228 nextToken -= 2;
229 errFlag = true;
230 break;
231
232 case 's':
233 matchFlag = false;
234 stmp = optarg;
235 transform(stmp.begin(), stmp.end(), stmp.begin(),
236 [](unsigned char c) { return static_cast<char>(::tolower(c)); });
237
238 for (unsigned i = 0; i < static_cast<unsigned>(Solver::DTEST_SOLVER_SIZE) && ! matchFlag; i++)
239 {
240 string s = solverList[i];

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 5

usageFunction · 0.85
SetDefaultsFunction · 0.85
GetNextArgTokenFunction · 0.85
statClass · 0.85
endMethod · 0.80

Tested by

no test coverage detected