Exemplo n.º 1
0
/* main routine */
int main(int argc, char **argv){
  g_progname = argv[0];
  g_dbgfd = -1;
  const char *ebuf = getenv("TCDBGFD");
  if(ebuf) g_dbgfd = tcatoix(ebuf);
  if(argc < 2) usage();
  int rv = 0;
  if(!strcmp(argv[1], "create")){
    rv = runcreate(argc, argv);
  } else if(!strcmp(argv[1], "inform")){
    rv = runinform(argc, argv);
  } else if(!strcmp(argv[1], "put")){
    rv = runput(argc, argv);
  } else if(!strcmp(argv[1], "out")){
    rv = runout(argc, argv);
  } else if(!strcmp(argv[1], "get")){
    rv = runget(argc, argv);
  } else if(!strcmp(argv[1], "list")){
    rv = runlist(argc, argv);
  } else if(!strcmp(argv[1], "optimize")){
    rv = runoptimize(argc, argv);
  } else if(!strcmp(argv[1], "importtsv")){
    rv = runimporttsv(argc, argv);
  } else if(!strcmp(argv[1], "version") || !strcmp(argv[1], "--version")){
    rv = runversion(argc, argv);
  } else {
    usage();
  }
  return rv;
}
Exemplo n.º 2
0
/* main routine */
int main(int argc, char **argv){
  g_progname = argv[0];
  if(argc < 2) usage();
  int rv = 0;
  if(!strcmp(argv[1], "create")){
    rv = runcreate(argc, argv);
  } else if(!strcmp(argv[1], "inform")){
    rv = runinform(argc, argv);
  } else if(!strcmp(argv[1], "put")){
    rv = runput(argc, argv);
  } else if(!strcmp(argv[1], "out")){
    rv = runout(argc, argv);
  } else if(!strcmp(argv[1], "get")){
    rv = runget(argc, argv);
  } else if(!strcmp(argv[1], "list")){
    rv = runlist(argc, argv);
  } else if(!strcmp(argv[1], "optimize")){
    rv = runoptimize(argc, argv);
  } else if(!strcmp(argv[1], "misc")){
    rv = runmisc(argc, argv);
  } else if(!strcmp(argv[1], "map")){
    rv = runmap(argc, argv);
  } else if(!strcmp(argv[1], "version") || !strcmp(argv[1], "--version")){
    rv = runversion(argc, argv);
  } else {
    usage();
  }
  return rv;
}
Exemplo n.º 3
0
/* main routine */
int main(int argc, char **argv) {
    int32_t i, rv;
    g_progname = argv[0];
    srand(time(NULL));
    if (argc < 2) usage();
    rv = 0;
    if (!strcmp(argv[1], "order")) {
        rv = runorder(argc, argv);
    } else if (!strcmp(argv[1], "index")) {
        rv = runindex(argc, argv);
    } else if (!strcmp(argv[1], "map")) {
        rv = runmap(argc, argv);
    } else if (!strcmp(argv[1], "list")) {
        rv = runlist(argc, argv);
    } else {
        usage();
    }
    if (rv != 0) {
        oprintf("FAILED:");
        for (i = 0; i < argc; i++) {
            oprintf(" %s", argv[i]);
        }
        oprintf("\n\n");
    }
    return rv;
}
Exemplo n.º 4
0
/* main routine */
int main(int argc, char **argv){
  g_progname = argv[0];
  g_dbgfd = INVALID_HANDLE_VALUE;
  const char *ebuf = getenv("TCDBGFD");
  if (ebuf) {
	  int debugfd = tcatoix(ebuf);
#ifdef __MINGW32__
	  g_dbgfd = (HANDLE) _get_osfhandle(debugfd);
#else
	  g_dbgfd = debugfd;
#endif
  }
  if(argc < 2) usage();
  int rv = 0;
  if(!strcmp(argv[1], "create")){
    rv = runcreate(argc, argv);
  } else if(!strcmp(argv[1], "inform")){
    rv = runinform(argc, argv);
  } else if(!strcmp(argv[1], "put")){
    rv = runput(argc, argv);
  } else if(!strcmp(argv[1], "out")){
    rv = runout(argc, argv);
  } else if(!strcmp(argv[1], "get")){
    rv = runget(argc, argv);
  } else if(!strcmp(argv[1], "list")){
    rv = runlist(argc, argv);
  } else if(!strcmp(argv[1], "search")){
    rv = runsearch(argc, argv);
  } else if(!strcmp(argv[1], "optimize")){
    rv = runoptimize(argc, argv);
  } else if(!strcmp(argv[1], "setindex")){
    rv = runsetindex(argc, argv);
  } else if(!strcmp(argv[1], "importtsv")){
    rv = runimporttsv(argc, argv);
  } else if(!strcmp(argv[1], "version") || !strcmp(argv[1], "--version")){
    rv = runversion(argc, argv);
  } else {
    usage();
  }
  return rv;
}
Exemplo n.º 5
0
void split(char *inFileList= "Run15pAl200MBPro104.Lst"){
  //split file to different run #
  char cc[100];
  ofstream lstfile[10000];
  int tmprun[10000];
  
  for(int irun=0;irun<10000;irun++){
    tmprun[irun]=0;
  }

  //get the list of run
  ofstream runlist("run15pAl200MBPro104.Lst");

  ifstream filelist(inFileList);
  char cntfile[1000];

  int nrun=0;
  int ifile=0;
  while (filelist.getline(cntfile, 1000)) {    
    int run=0;
    ifile++;
    //if(ifile>10) continue;

    cout<<cntfile<<endl;

    int index=0;
    //get run number
    for(int i=0; i<200; i++){
      if(cntfile[i]=='r'&&cntfile[i+1]=='o'&&cntfile[i+2]=='o'&&cntfile[i+3]=='t'){
	cout<<"i= "<<i<<endl;
	index=9-9;
      }
    }

    //int index=104-12;

    for(int j=index;j<index+6;j++){
      run=run*10+(int)cntfile[j]-48;
    }
    //}
    //}
    cout<<run<<endl;

    bool runflag=true;
    for(int irun=0;irun<nrun;irun++){
      if(run==tmprun[irun]) {
	runflag=false;
	lstfile[irun]<<cntfile<<endl;
      }
    }
    if(runflag) {
      //split
      tmprun[nrun]=run;
      sprintf(cc,"%s%s%d%s","lst/run2","_",run,".lst");
      cout<<cc<<endl;
      lstfile[nrun].open(cc);
      lstfile[nrun]<<cntfile<<endl;
      //store the run #
      runlist<<run<<endl;
      nrun++;
    }

  }//end of while
  runlist.close();
}