gpAux/extensions/gps3ext/bin/gpcheckcloud/gpcheckcloud.cpp
// check if command line arguments are valid
check if command line arguments are valid
check if command line arguments are valid
void validateCommandLineArgs(map<char, string> &optionPairs) {
    uint64_t count = optionPairs.count('f') + optionPairs.count('u');
    if ((count == 2) && (optionPairs.size() == 2)) {
        return;
    } else if (count == 1) {
        fprintf(stderr, "Failed. Option \'-u\' must work with \'-f\'.\n\n");
        printUsage(stderr);
        exit(EXIT_FAILURE);
    }
    if (optionPairs.size() > 1) {
        stringstream ss;
        ss << "Failed. Can't set options ";
        for (map<char, string>::iterator i = optionPairs.begin(); i != optionPairs.end(); i++) {
            ss << "'-" << i->first << "' ";
        }
        ss << "at the same time.";
        fprintf(stderr, "%s\n\n", ss.str().c_str());
        printUsage(stderr);
        exit(EXIT_FAILURE);
    }
}
void validateCommandLineArgs ( map < char , string > & optionPairs ) { uint64_t count = optionPairs . count ( ' ' ) + optionPairs . count ( ' ' ) ; if ( ( count == 2 ) && ( optionPairs . size ( ) == 2 ) ) { return ; } else if ( count == 1 ) { fprintf ( stderr , " \' \' \' \' \n \n " ) ; printUsage ( stderr ) ; exit ( EXIT_FAILURE ) ; } if ( optionPairs . size ( ) > 1 ) { stringstream ss ; ss << " " ; for ( map < char , string > :: iterator i = optionPairs . begin ( ) ; i != optionPairs . end ( ) ; i ++ ) { ss << " " << i -> first << " " ; } ss << " " ; fprintf ( stderr , " \n \n " , ss . str ( ) . c_str ( ) ) ; printUsage ( stderr ) ; exit ( EXIT_FAILURE ) ; } }
check if command line arguments are valid
check if command line arguments are valid
// concatenate all option names // e.g. if we have -c and -d, insert "-c, -d" into the stream. // example message: "Failed. Can't set options '-c' '-d' at the same time."