In the function;
235 static void arg_parse_tagged(int argc, char argv, struct arg_hdr table, struct arg_end endtable) {
236 struct longoptions longoptions;
237 char shortoptions;
238 int copt;
239
240 /printf("arg_parse_tagged(%d,%p,%p,%p)\n",argc,argv,table,endtable);/
241
242 / allocate short and long option arrays for the given opttable[]. /
243 / if the allocs fail then put an error msg in the last table entry. /
244 longoptions = alloc_longoptions(table);
245 shortoptions = alloc_shortoptions(table);
246
247 /dump_longoptions(longoptions);/
248
249 / reset getopts internal option-index to zero, and disable error reporting */
250 optind = 0;
251 opterr = 0;
308 default: {
309 / getopt_long() found a valid short option /
310 int tabindex = find_shortoption(table, (char)copt);
311 /printf("short option detected from argtable[%d]\n", tabindex);/
312 if (tabindex == -1) {
313 / should never get here - but handle it just in case /
314 /printf("unrecognised short option %d\n",copt);/
/ This function should not be called since the table index is -1 /
315 arg_register_error(endtable, endtable, copt, NULL);
316 } else {
317 if (table[tabindex]->scanfn) {
318 void* parent = table[tabindex]->parent;
319 int errorcode = table[tabindex]->scanfn(parent, optarg);
320 if (errorcode != 0)
321 arg_register_error(endtable, parent, errorcode, optarg);
322 }
323 }
324 break;
325 }
326 }
327 }
In the function; 235 static void arg_parse_tagged(int argc, char argv, struct arg_hdr table, struct arg_end endtable) { 236 struct longoptions longoptions; 237 char shortoptions; 238 int copt; 239 240 /printf("arg_parse_tagged(%d,%p,%p,%p)\n",argc,argv,table,endtable);/ 241 242 / allocate short and long option arrays for the given opttable[]. / 243 / if the allocs fail then put an error msg in the last table entry. / 244 longoptions = alloc_longoptions(table); 245 shortoptions = alloc_shortoptions(table); 246 247 /dump_longoptions(longoptions);/ 248 249 / reset getopts internal option-index to zero, and disable error reporting */ 250 optind = 0; 251 opterr = 0;
308 default: { 309 / getopt_long() found a valid short option / 310 int tabindex = find_shortoption(table, (char)copt); 311 /printf("short option detected from argtable[%d]\n", tabindex);/ 312 if (tabindex == -1) { 313 / should never get here - but handle it just in case / 314 /printf("unrecognised short option %d\n",copt);/ / This function should not be called since the table index is -1 / 315 arg_register_error(endtable, endtable, copt, NULL); 316 } else { 317 if (table[tabindex]->scanfn) { 318 void* parent = table[tabindex]->parent; 319 int errorcode = table[tabindex]->scanfn(parent, optarg); 320 if (errorcode != 0) 321 arg_register_error(endtable, parent, errorcode, optarg); 322 } 323 } 324 break; 325 } 326 } 327 }