#include #include #include #include #include #define VERBOSE const char * sdoc[] = { "This executable concatenates replicas of itself with itself.", " ", "Sample usage: replicate.x ", " CWPROOT=$CWPROOT ", " in=input.su ", " out=output.su ", " N=2 ", " ", "Required parameters:", " CWPROOT = path to SU root directory", " in = input filename", " out = output filename", " N = number replicas", NULL}; using RVL::RVLException; using RVL::valparse; int xargc; char **xargv; //----------------------------------------------------------------------------------- int main(int argc, char ** argv) { //----------------------------------------------------------------------------------- try { xargc=argc; xargv=argv; requestdoc(1); PARARRAY * par = ps_new(); if ( ps_createargs(par, argc - 1, argv + 1) ) { printf("Error parsing input data. ABORT.\n"); exit(1); } cerr << "Inside replicate:\n"; ps_printall(*par,stderr); //Reading in parameters from command line std::string cwp = valparse(*par,"CWPROOT"); int N = valparse(*par,"N"); std::string in = valparse(*par,"in"); std::string out = valparse(*par,"out"); //set up paths to SU commands std::string sushw = cwp + "/bin/sushw"; std::string suresamp = cwp + "/bin/suresamp"; //concatenating for(int n=0; n> tmp.su"; #ifdef VERBOSE cerr << cmd.str() << endl; #endif system(cmd.str().c_str()); } //numbering traces for final output su std::stringstream cmd; cmd << sushw << " "<< out << " && /bin/rm tmp.su"; #ifdef VERBOSE cerr << cmd.str() << endl; #endif system(cmd.str().c_str()); } catch (RVLException & e) { e.write(cerr); exit(1); } }