MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / match_opt

Method match_opt

erpcgen/src/options.cpp:692–714  ·  view source on GitHub ↗

--------------------------------------------------------------------------- ^FUNCTION: Options::match_opt - match an option ^SYNOPSIS: const char * match_opt(opt, int ignore_case) const ^PARAMETERS: char opt -- the option-character to match int ignore_case -- should we ignore character-case? ^DESCRIPTION: See if "opt" is found in "optvec" ^REQUIREMENTS: - optvec should be non-NULL and termin

Source from the content-addressed store, hash-verified

690// end-for
691// ^^-------------------------------------------------------------------------
692const char *Options::match_opt(char opt, int ignore_case) const
693{
694 if ((optvec == NULL) || (!*optvec))
695 return NULLSTR;
696
697 for (const char *const *optv = optvec; *optv; optv++)
698 {
699 OptionSpec optspec = *optv;
700 char optchar = optspec.OptChar();
701 if (isNullOpt(optchar))
702 continue;
703 if (opt == optchar)
704 {
705 return optspec;
706 }
707 else if (ignore_case && (TOLOWER(opt) == TOLOWER(optchar)))
708 {
709 return optspec;
710 }
711 }
712
713 return NULLSTR; // not found
714}
715
716// ---------------------------------------------------------------------------
717// ^FUNCTION: Options::match_longopt - match a long-option

Callers

nothing calls this directly

Calls 2

isNullOptFunction · 0.85
OptCharMethod · 0.80

Tested by

no test coverage detected