inline Option<std::size_t> list( Config const& config ) { Option<std::size_t> listedCount; if( config.listTests() ) listedCount = listedCount.valueOr(0) + listTests( config ); if( config.listTags() ) listedCount = listedCount.valueOr(0) + listTags( config ); if( config.listReporters() ) listedCount = listedCount.valueOr(0) + listReporters( config ); return listedCount; }
extern int main (int argc, char **argv) { int options = 0; int actionSupplied = 0; int i; ProgramName = argv [0]; if (argc == 1) { fprintf (stderr, Usage, ProgramName); exit (1); } for (i = 1 ; i < argc ; ++i) { const char *const arg = argv [i]; if (arg [0] != '-') { findTag (arg, options); actionSupplied = 1; } else { size_t j; for (j = 1 ; arg [j] != '\0' ; ++j) { switch (arg [j]) { case 'e': extensionFields = 1; break; case 'i': options |= TAG_IGNORECASE; break; case 'p': options |= TAG_PARTIALMATCH; break; case 'l': listTags (); actionSupplied = 1; break; case 't': if (arg [j+1] != '\0') { TagFileName = arg + j + 1; j += strlen (TagFileName); } else if (i + 1 < argc) TagFileName = argv [++i]; else { fprintf (stderr, Usage, ProgramName); exit (1); } break; case 's': SortOverride = 1; ++j; if (arg [j] == '\0') SortMethod = TAG_SORTED; else if (strchr ("012", arg[j]) != NULL) SortMethod = (sortType) (arg[j] - '0'); else { fprintf (stderr, Usage, ProgramName); exit (1); } break; default: fprintf (stderr, "%s: unknown option: %c\n", ProgramName, arg[j]); exit (1); break; } } } } if (! actionSupplied) { fprintf (stderr, "%s: no action specified: specify tag name(s) or -l option\n", ProgramName); exit (1); } return 0; }
extern int main (int argc, char **argv) { int options = 0; int actionSupplied = 0; int i; int ignore_prefix = 0; ProgramName = argv [0]; if (argc == 1) printUsage(stderr, 1); for (i = 1 ; i < argc ; ++i) { const char *const arg = argv [i]; if (ignore_prefix || arg [0] != '-') { findTag (arg, options); actionSupplied = 1; } else if (arg [0] == '-' && arg [1] == '\0') ignore_prefix = 1; else { size_t j; for (j = 1 ; arg [j] != '\0' ; ++j) { switch (arg [j]) { case 'd': debugMode++; break; case 'h': printUsage (stdout, 0); break; case 'e': extensionFields = 1; break; case 'i': options |= TAG_IGNORECASE; break; case 'p': options |= TAG_PARTIALMATCH; break; case 'l': listTags (); actionSupplied = 1; break; case 'n': allowPrintLineNumber = 1; break; case 't': if (arg [j+1] != '\0') { TagFileName = arg + j + 1; j += strlen (TagFileName); } else if (i + 1 < argc) TagFileName = argv [++i]; else printUsage(stderr, 1); break; case 's': SortOverride = 1; ++j; if (arg [j] == '\0') SortMethod = TAG_SORTED; else if (strchr ("012", arg[j]) != NULL) SortMethod = (sortType) (arg[j] - '0'); else printUsage(stderr, 1); break; #ifdef QUALIFIER case 'Q': if (i + 1 == argc) printUsage(stderr, 1); Qualifier = convertToQualifier (argv[++i]); break; #endif default: fprintf (stderr, "%s: unknown option: %c\n", ProgramName, arg[j]); exit (1); break; } } } } if (! actionSupplied) { fprintf (stderr, "%s: no action specified: specify tag name(s) or -l option\n", ProgramName); exit (1); } return 0; }