/******************************************************************************* * * * (cc) 2005 Mikolaj Swidzinski * * this work is licensed under a creative commons license * * see http://creativecommons.org/licenses/by-sa/2.0/ * * * *******************************************************************************/ #include #include #include #include int main(int argc, char *argv[]) { char *mergepath; // assumption: ccperl should be in path... std::string perlcall("ccperl.exe "); // Get the value of the MMERGE environment variable. mergepath = getenv("MMERGE" ); if( mergepath == NULL ) { // send the thing to stderr, so that it will be shown in clearcase std::cerr << "The environment variable MMERGE not found."; return 1; } // put the whole thing in quotes, just in case MMERGE env variable contains spaces and whatnot perlcall+="\""; perlcall+=mergepath; perlcall+="\""; // pass all arguments to the script for (int i = 1; i < argc; i++) { perlcall+=" "; // These argv thingies are too smart and remove the quotes for a quoted argument. I put them back... if (std::string(argv[i]).find(" ",0)) { perlcall+="\""; perlcall+=argv[i]; perlcall+="\""; } else perlcall+=argv[i]; } return system(perlcall.c_str()); }