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

Function kwdmatch

erpcgen/src/options.cpp:370–390  ·  view source on GitHub ↗

--------------------------------------------------------------------------- ^FUNCTION: kwdmatch - match a keyword ^SYNOPSIS: static kwdmatch_t kwdmatch(src, attempt, len) ^PARAMETERS: char * src -- the actual keyword to match char * attempt -- the possible keyword to compare against "src" int len -- number of character of "attempt" to consider (if 0 then we should use all of "attempt") ^DESCRIP

Source from the content-addressed store, hash-verified

368// Trivial
369// ^^-------------------------------------------------------------------------
370static kwdmatch_t kwdmatch(const char *src, const char *attempt, int len = 0)
371{
372 int i;
373
374 if (src == attempt)
375 return kwdmatch_t::EXACT_MATCH;
376 if ((src == NULL) || (attempt == NULL))
377 return kwdmatch_t::NO_MATCH;
378 if ((!*src) && (!*attempt))
379 return kwdmatch_t::EXACT_MATCH;
380 if ((!*src) || (!*attempt))
381 return kwdmatch_t::NO_MATCH;
382
383 for (i = 0; ((i < len) || (len == 0)) && (attempt[i]) && (attempt[i] != ' '); i++)
384 {
385 if (TOLOWER(src[i]) != TOLOWER(attempt[i]))
386 return kwdmatch_t::NO_MATCH;
387 }
388
389 return (src[i]) ? kwdmatch_t::PARTIAL_MATCH : kwdmatch_t::EXACT_MATCH;
390}
391
392// **************************************************************** OptionSpec
393

Callers 1

match_longoptMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected