Beispiel #1
1
void ViewerCmdLine::parse()
{
  const CmdLineOption options[] = {
    HELP,
    HELP_SHORT,
    OPTIONS_FILE,
    LISTEN,
    HOST,
    PORT,
    PASSWORD,
    SHOW_CONTROLS,
    VIEW_ONLY,
    USE_CLIPBOARD,
    SCALE,
    FULL_SCREEN,
    WARN_FULL_SCREEN,
    ENCODING,
    COPY_RECT,
    MOUSE_CURSOR,
    MOUSE_LOCAL,
    MOUSE_SWAP,
    JPEG_IMAGE_QUALITY,
    COMPRESSION_LEVEL
  };

  if (!processCmdLine(&options[0], sizeof(options) / sizeof(CmdLineOption))) {
    throw CommandLineFormatException();
  }

  if (isHelpPresent()) {
    throw CommandLineFormatHelp();
  }


  if (m_wpcl.getArgumentsCount() > 2) {
    throw CommandLineFormatException();
  }

  if (m_wpcl.getArgumentsCount() > 1) {
    if (isPresent(ViewerCmdLine::HOST)) {
      throw CommandLineFormatException();
    }
  }

  if (isPresent(ViewerCmdLine::OPTIONS_FILE)) {
    parseOptionsFile();
  } else {
    if (isPresent(ViewerCmdLine::LISTEN)) {
      *m_isListening = true;
    } else {
      if (!parseHost()) {
        throw CommandLineFormatException();
      }
    }
  }
  parsePassword();
  parseEncoding();
  parseMouseShape();
  parseMouseCursor();
  parseScale();
  parseFullScreen();
  parseCompressionLevel();
  parseWarnFullScr();
  parseMouseSwap();
  parseUseClipboard();
  parseShowControl();
  parseCopyRect();
  parseViewOnly();
  parseJpegImageQuality();
}
Beispiel #2
0
int main(int argc, char *argv[]) {

	programName = "firechain";
	c7c88e52_ensureUserIsRoot();

	if (argc == 1) {
		c7c88e52_printUsage(USAGE_MSG);
		exit(EXIT_FAILURE);
	} else if (f6215943_isEqual("help", argv[1])) {
		printHelp(argc, argv);
		exit(EXIT_SUCCESS);
	}

	FirewallParams firewallParams;
	CmdLineParam cmdLineParm;

	d7ad7024_initCmdLineParam(&cmdLineParm, argc, argv, USAGE_MSG);
	processCmdLine(&cmdLineParm, &firewallParams);

	if (firewallParams.action == ADD) {
		processAdd(&firewallParams);
	} else if (firewallParams.action == DELETE) {
		processDelete(&firewallParams);
	} else if (firewallParams.action == VIEW) {
		for (int i=0; i < firewallParams.ruleList.length; i++) {
			puts(firewallParams.ruleList.values[i]);
		}
	}

	b196167f_destroyAllElements(&firewallParams.ruleList);

	// Exit with success
	exit(EXIT_SUCCESS);
}
Beispiel #3
0
int main(int argc, char *argv[]) {

	programName = "nettuner";

	TuningParams tuningParams;
	CmdLineParam cmdLineParm;

	d7ad7024_initCmdLineParam(&cmdLineParm, argc, argv, USAGE_MSG);
	processCmdLine(&cmdLineParm, &tuningParams);

	IPv4Socket ipv4Socket;
	Ethernet ethDevice;
	EthernetRequest ethRequest;

	d3843373_initEthernetRequest(&ethRequest, tuningParams.deviceName);

	a34d4619_open(&ipv4Socket, IPV4_SOCKET_UDP);
	d3843373_getEthernetStatus(&ethDevice, &ethRequest, &ipv4Socket);
	d3843373_getEthernetMTU(&ethDevice, &ethRequest, &ipv4Socket);
	a34d4619_close(&ipv4Socket);

	setTuningParams(&tuningParams, &ethDevice);

	TuningCalcs tuningCalcs;
	EthtoolSettings ethtoolSettings;

	performTuningCalcs(&tuningCalcs, &tuningParams);
	calcEthtoolSettings(&ethtoolSettings, &tuningCalcs, &tuningParams);

	if (tuningParams.generateNetworkdScript) {
		generateNetworkdTuningScript(tuningParams.deviceName, &ethtoolSettings);
	} else if (tuningParams.generateNMScript) {
		generateNetworkManagerTuningScript(tuningParams.deviceName, &ethtoolSettings);
	} else {
		SysctlSettings sysctlSettings;

		calcSysctlSettings(&sysctlSettings, &ethtoolSettings, &tuningCalcs, &tuningParams);
		printNetworkKernelTuningConfig(&sysctlSettings);
	}

	// Exit with success
	exit(EXIT_SUCCESS);
}
Beispiel #4
0
    bool init(int argc, char** argv)
    {
        if (!processCmdLine(argc, argv, &m_params)) {
            fprintf(stderr, "process arguments failed.\n");
            return false;
        }
        m_output.reset(DecodeOutput::create(m_params.renderMode, m_params.renderFourcc, m_params.inputFile, m_params.outputFile.c_str()));
        if (!m_output) {
            fprintf(stderr, "DecodeOutput::create failed.\n");
            return false;
        }
        m_nativeDisplay = m_output->nativeDisplay();
        m_vppInput = createInput(m_params, m_nativeDisplay);

        if (!m_nativeDisplay || !m_vppInput) {
            fprintf(stderr, "DecodeTest init failed.\n");
            return false;
        }
        return true;
    }
int main( int argc, char **argv ) {
	// Process the command line
	if (!processCmdLine(argc, argv)) {
		exit(0);
	}
	// Now process the results file into the model file
	try {
		SchedResults sr(_resultFile, _esmolFile, _abstractFile, _debugOutput);
	} 
	catch( SchedResultsException &ex ) {
		std::cerr << "Exception: " << ex._reason << std::endl;
		exit(1);
	}
	catch ( ... ) {
		std::cerr << "Unkown exception in SchedResults!" << std::endl;
		exit(1);
	}
	// Finish It Up
	return 0;
}
Beispiel #6
0
int
WINAPI
WinMain(
	HINSTANCE /*hInstance*/,
	HINSTANCE /*hPrevInstance*/,
	LPWSTR lpCmdLine,
	int /*nShowCmd*/)
{
	int		result;
	int		argc;
	char**	argv;

	// convert program name and lpCmdLine into argc/argv, and handle I/O redirection
	argc = processCmdLine(lpCmdLine, &argv);

#if _WIN32_WCE < 0x500 || !defined(COREDLL_CORESIOA)
	initStdHandles();	// get environment variables from ChildData
#endif

	//result = main(argc, (char**)argv);

	return result;
}
Beispiel #7
0
int main(int argc,char **argv) {
  int count,j,s;
  int norm;
  bode::Interval *i;
  std::string readsFN;
  std::string inFN;
  std::string outFN;
  std::string inputFN;
  int readsTotal,inputTotal;
  double readsScale,inputScale;
  int *target;
  int bins,binwidth;
  bode::Interval z;
  bode::Flags *fset;

  fset = processCmdLine(argc,argv);
  norm = fset->getInt("norm");
  bins = fset->getInt("bins");
  binwidth = fset->getInt("binwidth");
  inputFN = fset->getStr("input");
  readsFN = fset->positionalArgs()[1];
  inFN = fset->positionalArgs()[2];
  outFN = fset->positionalArgs()[3];

//  width = getBedWidth(inFN);

  target = new int[bins];
  bode::IntervalReader *reads = bode::IntervalReader::open(readsFN);
  bode::CffReader *in = new bode::CffReader(inFN);
  std::ofstream *out = new std::ofstream(outFN.c_str(),std::ofstream::out);
  bode::IntervalReader *input = NULL;
  if (inputFN != "") {
    input = bode::IntervalReader::open(inputFN);
  }

  *out << "GID\tscore\tcoordinates";
  s = 1;
  while (s <= bins) {
    *out << "\t" << s;
    s++;
  }
  *out << std::endl;
  
  fprintf(stderr,"loading reads...\n");
  bode::IntervalSet *is = loadReads(reads,fset);
  readsTotal = is->count();
  fprintf(stderr,"loaded %d reads.\n",readsTotal);
  readsScale = ((double) norm) / (double) readsTotal;
  bode::IntervalSet *background = NULL;
  if (input != NULL) {
    fprintf(stderr,"loading input...\n");
    background = loadReads(input,fset);
    inputTotal = background->count();
    fprintf(stderr,"loaded %d input reads.\n",inputTotal);
    inputScale = ((double) norm) / (double) inputTotal;
  }
    
  reads->close();
  count = 0;
  fprintf(stderr,"processing intervals...\n");
  while ((i=in->nextI())) {
    bode::Bed *bi = static_cast<bode::Bed*>(i);
    count++;
    if (count % 1000 == 0) {
      fprintf(stderr,"%9d\r",count);
    }
    for (j=0;j<bins;j++) {
      target[j] = 0;
    }
    int left = bi->left() - (bins / 2) * binwidth;
    int right = bi->left() + (bins / 2) * binwidth;
//    is->density(i->chrom(),left,right,target);
    (*out) <<bi->name() << "\t"<<bi->score()<<"\t"<<bi->chrom()<<":"<<bi->left();
    s = left;
    while (s < right) {
      z.update(i->chrom(),s,s+binwidth);
      int c = is->overlapping(&z);
      int bk;
      double ncbk;
      if (background != NULL) {
        bk = background->overlapping(&z);
        ncbk = (c * readsScale) - (bk * inputScale);
      } else {
        ncbk = c * readsScale;
      }
      *out << "\t" << ncbk;
      s += binwidth;
    }
/*    for (int j=0;j<right-left;j++) {
      *out << "\t" << target[j];
    }
*/
    *out << std::endl;
  }
  in->close();
  out->close();
  if (input != NULL) {
    input->close();
  }

  std::cerr << "processed " << count << " intervals." << std::endl;
  return 0;
}
Beispiel #8
0
int main(int argc,char **argv) {
  int count,j,s;
  int norm;
  bode::Interval *i;
  bode::Bed *b;
  std::string readsFN;
  std::string inFN;
  std::string outFN;
  int readsTotal;
  double readsScale;
  int *target;
  bode::Flags *fset;

  fset = processCmdLine(argc,argv);
  readsFN = fset->positionalArgs()[1];
  inFN = fset->positionalArgs()[2];
  outFN = fset->positionalArgs()[3];
  norm = fset->getInt("norm");

  target = new int[MAXINTERVAL];
  bode::IntervalReader *reads = bode::IntervalReader::open(readsFN);
  bode::BedReader *in = new bode::BedReader(inFN);
  std::ofstream *out = new std::ofstream(outFN.c_str(),std::ofstream::out);

  fprintf(stderr,"loading reads...\n");
  bode::IntervalSet *is = loadReads(reads,fset);
  readsTotal = is->count();
  fprintf(stderr,"loaded %d reads.\n",readsTotal);
  readsScale = ((double) norm) / (double) readsTotal;
  reads->close();
  count = 0;
  fprintf(stderr,"processing intervals...\n");
  while ((i=in->nextI())) {
    count++;
    if (count % 1000 == 0) {
      fprintf(stderr,"%9d\r",count);
    }
    int width = i->right() - i->left();
    for (j=0;j<width;j++) {
      target[j] = 0;
    }
    is->density(i->chrom(),i->left(),i->right(),target);
    if (i->strand() == '-') {
      for (int k=0;k<width/2;k++) {
        int x = target[k];
        target[k] = target[width-k-1];
        target[width-k-1] = x;
      }
    }
    double nc = target[0] * readsScale;
    b = static_cast<bode::Bed *>(i);
    *out << b->name();
    for (s=0;s<width;s++) {
      nc = target[s] * readsScale;
      *out << "\t" << nc;
    }
    *out << std::endl;
  }
  in->close();
  out->close();

  std::cerr << "processed " << count << " intervals." << std::endl;
  return 0;
}