llreplace/llreplace.cpp
// ---------------------------------------------------------------------------
// Validate option matchs and optionally report problem to user.
Validate option matchs and optionally report problem to user.
Validate option matchs and optionally report problem to user .
bool ValidOption(const char* validCmd, const char* possibleCmd, bool reportErr = true)
{
    size_t validLen = strlen(validCmd);
    size_t possibleLen = strlen(possibleCmd);
    if ( strncasecmp(validCmd, possibleCmd, std::min(validLen, possibleLen)) == 0)
        return true;
    if (reportErr)
    {
        std::cerr << "Unknown option:'" << possibleCmd << "', expect:'" << validCmd << "'\n";
        optionErrCnt++;
    }
    return false;
}
bool ValidOption ( const char * validCmd , const char * possibleCmd , bool reportErr = true ) { size_t validLen = strlen ( validCmd ) ; size_t possibleLen = strlen ( possibleCmd ) ; if ( strncasecmp ( validCmd , possibleCmd , std :: min ( validLen , possibleLen ) ) == 0 ) return true ; if ( reportErr ) { std :: cerr << " " << possibleCmd << " " << validCmd << " \n " ; optionErrCnt ++ ; } return false ; }
Validate option matchs and optionally report problem to user.
Validate option matchs and optionally report problem to user .
// Starts with validCmd else mark error