comparison tools/fanalyze.c @ 2408:60e119262c67

Option index re-ordering cleanup work.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 21:21:25 +0200
parents b7cd5dd0b82e
children bc05bcfc4598
comparison
equal deleted inserted replaced
2407:c5a32812dd97 2408:60e119262c67
162 162
163 /* Arguments 163 /* Arguments
164 */ 164 */
165 static const DMOptArg optList[] = 165 static const DMOptArg optList[] =
166 { 166 {
167 { 0, '?', "help", "Show this help", OPT_NONE }, 167 { 0, '?', "help" , "Show this help", OPT_NONE },
168 { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, 168 { 2, 'v', "verbose" , "Be more verbose", OPT_NONE },
169 { 2, 'g', "grep", "Binary grep <val>[,<val2>...][:<le|be>[8|16|32]]", OPT_ARGREQ }, 169
170 { 3, 'o', "offset", "Show data in offset <offs>[,<offs2>...][:<le|be>[8|16|32][d|x]]", OPT_ARGREQ }, 170 { 10, 'g', "grep" , "Binary grep <val>[,<val2>...][:<le|be>[8|16|32]]", OPT_ARGREQ },
171 { 4, 'm', "match", "Find matching sequences minimum of <n> bytes long", OPT_NONE }, 171 { 12, 'o', "offset" , "Show data in offset <offs>[,<offs2>...][:<le|be>[8|16|32][d|x]]", OPT_ARGREQ },
172 { 5, 'n', "minmatch", "Minimum match sequence length", OPT_ARGREQ }, 172 { 14, 'm', "match" , "Find matching sequences minimum of <n> bytes long", OPT_NONE },
173 { 16, 'n', "minmatch" , "Minimum match sequence length", OPT_ARGREQ },
173 }; 174 };
174 175
175 static const int optListN = sizeof(optList) / sizeof(optList[0]); 176 static const int optListN = sizeof(optList) / sizeof(optList[0]);
176 177
177 178
481 } 482 }
482 483
483 484
484 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) 485 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
485 { 486 {
486 (void) optArg;
487
488 switch (optN) 487 switch (optN)
489 { 488 {
490 case 0: 489 case 0:
491 argShowHelp(); 490 argShowHelp();
492 exit(0); 491 exit(0);
494 493
495 case 1: 494 case 1:
496 dmVerbosity++; 495 dmVerbosity++;
497 break; 496 break;
498 497
499 case 2: 498 case 10:
500 return argParseGrepValue(optArg, FA_GREP) == DMERR_OK; 499 return argParseGrepValue(optArg, FA_GREP) == DMERR_OK;
501 500
502 case 3: 501 case 12:
503 return argParseGrepValue(optArg, FA_OFFSET) == DMERR_OK; 502 return argParseGrepValue(optArg, FA_OFFSET) == DMERR_OK;
504 503
505 case 4: 504 case 14:
506 setMode = FA_MATCHES; 505 setMode = FA_MATCHES;
507 break; 506 break;
508 507
509 case 5: 508 case 16:
510 optMinMatchLen = atoi(optArg); 509 optMinMatchLen = atoi(optArg);
511 if (optMinMatchLen < 2 || optMinMatchLen > 16*1024) 510 if (optMinMatchLen < 2 || optMinMatchLen > 16*1024)
512 { 511 {
513 dmErrorMsg("Invalid minimum match length '%s'.\n", 512 dmErrorMsg("Invalid minimum match length '%s'.\n",
514 optArg); 513 optArg);