当前位置: 首页>>代码示例>>C++>>正文


C++ process_options函数代码示例

本文整理汇总了C++中process_options函数的典型用法代码示例。如果您正苦于以下问题:C++ process_options函数的具体用法?C++ process_options怎么用?C++ process_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了process_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    process_options(argc, argv);
    if (boost::algorithm::ends_with(input, ".rmf2") &&
        boost::filesystem::exists(boost::filesystem::path(input) / "file")) {
      boost::filesystem::rename(
          boost::filesystem::path(input) / "file",
          boost::filesystem::path(input) / "file.rmf2info");
      std::cout << "Updated" << std::endl;
    } else {
      std::cout << "Nothing to do" << std::endl;
    }
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
  return 0;
}
开发者ID:salilab,项目名称:imp,代码行数:19,代码来源:rmf_update.cpp

示例2: main

int main(int argc, char **argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    process_options(argc, argv);


    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    for (unsigned int i = 0; i < rh.get_number_of_frames(); ++i) {
      rh.set_current_frame(i);
      std::string cmt = rh.get_current_frame().get_name();
      if (!cmt.empty()) {
        std::cout << i << ": " << cmt << std::endl;
      }
    }
    return 0;
  } catch (const std::exception &e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}
开发者ID:drussel,项目名称:imp,代码行数:19,代码来源:rmf_frames.cpp

示例3: main

/*********************************************************
 Start here.
**********************************************************/
int main(int argc, char **argv)
{	
	TALLOC_CTX *frame = talloc_stackframe();
	int local_flags = 0;
	int ret;

#if defined(HAVE_SET_AUTH_PARAMETERS)
	set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */

	if (getuid() == 0) {
		local_flags = LOCAL_AM_ROOT;
	}

	load_case_tables();

	local_flags = process_options(argc, argv, local_flags);

	setup_logging("smbpasswd", DEBUG_STDERR);

	/*
	 * Set the machine NETBIOS name if not already
	 * set from the config file. 
	 */ 

	if (!init_names())
		return 1;

	/* Check the effective uid - make sure we are not setuid */
	if (is_setuid_root()) {
		fprintf(stderr, "smbpasswd must *NOT* be setuid root.\n");
		exit(1);
	}

	if (local_flags & LOCAL_AM_ROOT) {
		secrets_init();
		ret = process_root(local_flags);
	} else {
		ret = process_nonroot(local_flags);
	}
	TALLOC_FREE(frame);
	return ret;
}
开发者ID:ebrainte,项目名称:Samba,代码行数:46,代码来源:smbpasswd.c

示例4: ltrace_init

void
ltrace_init(int argc, char **argv)
{
	setlocale(LC_ALL, "");

	struct opt_p_t *opt_p_tmp;

	atexit(normal_exit);
	signal(SIGINT, signal_exit);	/* Detach processes when interrupted */
	signal(SIGTERM, signal_exit);	/*  ... or killed */

	argv = process_options(argc, argv);
	init_global_config();

	if (command) {
		/* Check that the binary ABI is supported before
		 * calling execute_program.  */
		{
			struct ltelf lte;
			if (ltelf_init(&lte, command) == 0)
				ltelf_destroy(&lte);
			else
				exit(EXIT_FAILURE);
		}

		pid_t pid = execute_program(command, argv);
		struct process *proc = open_program(command, pid);
		if (proc == NULL) {
			fprintf(stderr, "couldn't open program '%s': %s\n",
				command, strerror(errno));
			exit(EXIT_FAILURE);
		}

		trace_set_options(proc);
		continue_process(pid);
	}
	opt_p_tmp = opt_p;
	while (opt_p_tmp) {
		open_pid(opt_p_tmp->pid);
		opt_p_tmp = opt_p_tmp->next;
	}
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_ltrace,代码行数:42,代码来源:libltrace.c

示例5: parse_argv

/*-----------------------------------------------------------------------------
*   Parse command line, set options, including opts.files with list of
*	input files, including parsing of '@' lists
*----------------------------------------------------------------------------*/
void parse_argv( int argc, char *argv[] )
{
    int arg;

    init_module();

    if ( argc == 1 )
        exit_copyright();				/* exit if no arguments */

    process_options( &arg, argc, argv );	/* process all options, set arg to next */

    if ( arg >= argc )
        error_no_src_file();			/* no source file */

    if ( opts.verbose )
        display_options();				/* display status messages of select assembler options */

    if ( ! get_num_errors() )
        process_files( arg, argc, argv );	/* process each source file */
}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:24,代码来源:options.c

示例6: main

/*
 * Main program
 */
int main(int argc, char **argv)
{
	int fd;

	process_options(argc, argv);

	/* Open the input file */
	if ((fd = open(img, O_RDONLY)) == -1) {
		perror("open input file");
		exit(1);
	}
	
	// get image length
   	imglen = lseek(fd, 0, SEEK_END);
	lseek (fd, 0, SEEK_SET);

	data = malloc (imglen);
	if (!data) {
		perror("out of memory");
		close (fd);
		exit(1);
	}
	
	// read image data
	read (fd, data, imglen);
		
	// Close the input file
	close(fd);

	if (dumpcontent)
		do_dumpcontent ();

	if (convertendian)
		do_endianconvert ();
	
	// free memory
	free (data);

	// Return happy 
	exit (0);
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:44,代码来源:jffs2dump.c

示例7: process_table

void process_table(table_input &in)
{
  options *opt = 0;
  format *form = 0;
  table *tbl = 0;
  if ((opt = process_options(in)) != 0 
      && (form = process_format(in, opt)) != 0
      && (tbl = process_data(in, form, opt)) != 0) {
    tbl->print();
    delete tbl;
  }
  else {
    error("giving up on this table");
    while (in.get() != EOF)
      ;
  }
  delete opt;
  delete form;
  if (!in.ended())
    error("premature end of file");
}
开发者ID:att,项目名称:uwin,代码行数:21,代码来源:main.cpp

示例8: main

int main(int argc, char * const argv[])
{
	int fd;
	struct blkpg_partition part;
	struct blkpg_ioctl_arg arg;

	process_options(argc, argv);

	fd = open(mtddev, O_RDWR | O_CLOEXEC);
	if (fd == -1)
		sys_errmsg_die("Cannot open %s", mtddev);

	memset(&part, 0, sizeof(part));

	memset(&arg, 0, sizeof(arg));
	arg.datalen = sizeof(part);
	arg.data = &part;

	switch (command) {
		case COMMAND_ADD:
			part.start = start_addr;
			part.length = length;
			strncpy(part.devname, part_name, sizeof(part.devname));
			arg.op = BLKPG_ADD_PARTITION;
			break;
		case COMMAND_DEL:
			part.pno = part_no;
			arg.op = BLKPG_DEL_PARTITION;
			break;
	}

	if (ioctl(fd, BLKPG, &arg))
		sys_errmsg_die("Failed to issue BLKPG ioctl");

	close(fd);

	/* Exit happy */
	return EXIT_SUCCESS;
}
开发者ID:sigma-star,项目名称:mtd-utils,代码行数:39,代码来源:mtdpart.c

示例9: main

int main(int argc, char** argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    RMF_ADD_OUTPUT_FILE("pdb");
    RMF_ADD_FRAMES;
    process_options(argc, argv);

    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    std::ostream* out;
    std::ofstream fout;
    if (!output.empty()) {
      fout.open(output.c_str());
      if (!fout) {
        std::cerr << "Error opening file " << output << std::endl;
        return 1;
      }
      out = &fout;
    } else {
      out = &std::cout;
    }
    RMF::decorator::IntermediateParticleFactory ipf(rh);
    RMF::decorator::AtomFactory af(rh);
    RMF::decorator::ChainFactory cf(rh);
    RMF::decorator::ResidueFactory rf(rh);
    RMF::NodeConstHandle rn = rh.get_root_node();
    for (unsigned int input_frame = start_frame, output_frame = 0;
         input_frame < rh.get_number_of_frames();
         input_frame += step_frame, ++output_frame) {
      rh.set_current_frame(RMF::FrameID(input_frame));
      *out << (boost::format("MODEL%1$9d") % (output_frame + 1)) << std::endl;
      write_atoms(*out, 0, rn, ipf, af, cf, rf);
      *out << "ENDMDL" << output_frame + 1 << std::endl;
    }
    return 0;
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:39,代码来源:rmf_pdb.cpp

示例10: main

/**
 * \brief Entry point.
 * \param argc The number of input parameters.
 * \param argv The input parameters.
 */
int main(int argc, char *argv[]) {
	/* the resource manager must be initialized before any
	 * further actions are implemented */
	rm_init(&resource_mgr);

	if (process_options(argc, argv) == 1) {
		rm_cleanup_resources(&resource_mgr);
		exit(EXIT_FAILURE);
	}
	printf("Input: %s\n", cc_options.input_file);
	printf("Output: %s\n", cc_options.output_file);
	printf("IR: %s\n", cc_options.ir_file);

	yyin = fopen(cc_options.input_file, "r");

	if (!yyin) {
		printf("FAIL");
		exit(1);
	}

	//  yyparse();

	do {
		yyparse();
	} while (!feof(yyin));

	fclose(yyin);
	printallstart(cc_options.output_file);
	if (cc_options.print_ir == 1) {
		FILE * ir_file = fopen(cc_options.ir_file, "w");
		ir_set_file(ir_file);
		generate_ir_code();
		fclose(ir_file);
	}

	rm_cleanup_resources(&resource_mgr);
	return 0;
}
开发者ID:hagenduk,项目名称:Compilerbau,代码行数:43,代码来源:main.c

示例11: main

int main(int argc, char **argv){
	pthread_t *threads;
	int i=0;
	void *ret;
	
	process_options(argc, argv);
	
	ccsm_fd = ccsm_open();
	if (ccsm_fd < 0) {
		perror("ccsm_fd");
		return 1;
	}

	ccsm_create_set(ccsm_fd, "main", 0);
		
	threads = malloc(sizeof(pthread_t) * pipeline_len);
	if (!threads){
		fprintf(stderr, "can't initialise threads\n");
		exit(1);
	}

	printf("Creating the required set of threads.....\n");
	for(i=0;i<pipeline_len;i++){
		if (pthread_create(&threads[i],NULL,&thread_function_run, (void *)i)){
		       	fprintf(stderr, "failed creating thread");
        		exit(1);
        	}
	}
	
	for(i=0;i<pipeline_len;i++){
		pthread_join(threads[i], &ret);
	}

	ccsm_destroy_set(ccsm_fd, "main");
//	ccsm_close(ccsm_fd);
	
	return 0;
}
开发者ID:dillonhicks,项目名称:ipymake,代码行数:38,代码来源:multithreadsA.c

示例12: main

int main(int argc, char *argv[])
{
	int i;
	signal(SIGPIPE, SIG_IGN);

	openlog("flexd", LOG_ERR , LOG_INFO);
	syslog(LOG_WARNING, "Starting flexd");

	if (ax25_config_load_ports() == 0) {
		fprintf(stderr, "flexd error: No AX25 port data configured\n");
		return 1;
	}

	process_options(argc, argv);

	if ((i = read_conf()) == -1)
		return 1;

	if ((is_daemon) && (!daemon_start(TRUE)) ) {
		fprintf(stderr, "flexd: cannot become a daemon\n");
		return 1;
	}

	if ((i = update_flex()) == -1) {
		fprintf(stderr, "\nStopping application. Restart flexd after changing the configuration\n");
		signal(SIGKILL, hup_handler);
		return (i);
	}

	signal(SIGHUP, hup_handler);
	signal(SIGALRM, alarm_handler);
	alarm(poll_time);

	for (;;)
		pause();

	return 0;
}
开发者ID:ve7fet,项目名称:fpac,代码行数:38,代码来源:flexd.c

示例13: main

int main(int argc, char **argv)
{
	int ret;
	char ch;

	process_options(argc, argv);

	ret = mkfifo(STATUS_PIPE, 0666);

	if (ret == -1 && errno != EEXIST)
		errx(1, "Error creating named pipe");

	do {
		ch = action();

		if (ch == 'm')
			mem_map();
	} while (ch != 'x');

	remove(STATUS_PIPE);

	return 0;
}
开发者ID:AbhiramiP,项目名称:ltp,代码行数:23,代码来源:mem_process.c

示例14: main

/*! \addtogroup executables
 *  @{
 * \addtogroup client_FFTtoFile client_FFTtoFile
 * client_FFTtoBC_main
 * - @ref FFTProcessor with output to files
 * - configuration using command-line / XML
 * 
 * @{
 */
int main(int argc, char* argv[])
{
  boost::program_options::variables_map vm;
  try {
    vm = process_options("config/FFTProcessor.xml", argc, argv);
  } catch (const std::exception &e) {
    std::cerr << e.what() << std::endl;
    return 1;
  }

  boost::filesystem::path p(vm["config"].as<std::string>());
  LOGGER_INIT("./Log", p.stem().native());
  try {
    boost::property_tree::ptree config;
    read_xml(vm["config"].as<std::string>(), config, boost::property_tree::xml_parser::no_comments);

    const std::string stream_name("DataIQ");

    network::client::client<network::iq_adapter<repack_processor<FFTProcessorToFile<float> > > >
      c(config.get_child("FFTProcessor"));
    const std::set<std::string> streams(c.ls());
    if (streams.find(stream_name) != streams.end())
      ASSERT_THROW(c.connect_to(stream_name) == true);
    else
      throw std::runtime_error(str(boost::format("stream '%s' is not available")
                                   % stream_name));
    
    c.start();
    run_in_thread(network::get_io_service());
  } catch (const std::exception &e) {
    LOG_ERROR(e.what()); 
    std::cerr << e.what() << std::endl;
    return 1;
  }
  return 0;
}
开发者ID:hcab14,项目名称:HFMonitor,代码行数:45,代码来源:client_FFTtoFile_main.cpp

示例15: main

int main(int argc, const char* argv[])
{
  FILE *log = get_log(NULL);

  switch (process_options(argc, argv, log))
    {
      case 0:
        break;
      case -1:
        exit(EXIT_SUCCESS);
      default:
        exit(EXIT_FAILURE);
    }

  install_termination_signal_handlers (log);
  install_rotate_signal_handlers (log);
  install_log_rotate_signal_handlers (log, 0, SIGUSR1);

  int r = xport_to_queue (log);

  close_log (log);

  return r;
}
开发者ID:lwes,项目名称:lwes-journaller,代码行数:24,代码来源:xport_to_queue_main.c


注:本文中的process_options函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。