• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parse_commandline函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int
main(int argc, char *argv[])
{
    struct hooks_t hooks;
    struct files_t files;
    //int c;

    /* TODO: Parse command line arguments */
    parse_commandline(argc, argv);
    
    /* TODO: Initialize hooks and files lists */
    TAILQ_INIT(&hooks);
    TAILQ_INIT(&files);
        
    /* TODO: Load hooks */
    set_hooks(&hooks);
    
     // TODO: Continuously check directory and timestamps
    //while(true){
        char *timestamp = timestamp_string();
        check_directory(directory, &hooks, &files, recursive,(time_t) timestamp);
        sleep(1);
    //}
    
    return (EXIT_SUCCESS);
}
开发者ID:droessmj,项目名称:cs388,代码行数:26,代码来源:rorschach.c


示例2: main

int main(int argc, char *argv[])
{
   double         clock;
   struct buffer  buf;
   char          *pattern = NULL;
   char          *infile  = NULL;
   char          *outdir = strdup(".");

   parse_commandline(argc, argv, &pattern, &infile, &outdir);
   if(infile == NULL)
      return EXIT_FAILURE;

   MPI_Init(&argc, &argv);

   tic(&clock);

   load_file(infile, &buf);
   toc(&clock, "Read input:");

   transfer_partials(pattern, &buf);
   toc(&clock, "Transfer:");

   write_chunks(infile, outdir, &buf);
   toc(&clock, "Write chunks:");

   MPI_Finalize();
   free(buf.data);
   free(pattern);
   free(infile);
   return EXIT_SUCCESS;
}
开发者ID:eduffy,项目名称:divvy,代码行数:31,代码来源:divvy.c


示例3: main_configure

    /* configuration-dependent initialization */
int main_configure(char *arg1, char *arg2) {
    if(parse_commandline(arg1, arg2))
        return 1;
    str_canary_init(); /* needs prng initialization from parse_commandline */
#if !defined(USE_WIN32) && !defined(__vms)
    /* syslog_open() must be called before change_root()
     * to be able to access /dev/log socket */
    syslog_open();
#endif /* !defined(USE_WIN32) && !defined(__vms) */
    if(bind_ports())
        return 1;

#ifdef HAVE_CHROOT
    /* change_root() must be called before drop_privileges()
     * since chroot() needs root privileges */
    if(change_root())
        return 1;
#endif /* HAVE_CHROOT */

#if !defined(USE_WIN32) && !defined(__vms) && !defined(USE_OS2)
    if(drop_privileges(1))
        return 1;
#endif /* standard Unix */

    /* log_open() must be be called after drop_privileges()
     * or logfile rotation won't be possible */
    /* log_open() must be be called before daemonize()
     * since daemonize() invalidates stderr */
    log_open();
    return 0;
}
开发者ID:davean,项目名称:stunnel-xforwardfor,代码行数:32,代码来源:stunnel.c


示例4: WinMain

int PASCAL WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR szCmdLine,int sw)
{
	char		szModuleName[260];
	GetModuleFileName(hInst,szModuleName,sizeof(szModuleName));
	parse_commandline(szModuleName,szCmdLine,&argc,argv,MAX_ARGV);
	return main(argc,argv);
}
开发者ID:OS2World,项目名称:LIB-VIDEO-MGL,代码行数:7,代码来源:winmain.c


示例5: main

/*---------------------------------------------------------------*/
int main(int argc, char *argv[]) {
  int nargs;

  nargs = handle_version_option (argc, argv, vcid, "$Name: stable5 $");
  if (nargs && argc - nargs == 1) exit (0);
  argc -= nargs;
  cmdline = argv2cmdline(argc,argv);
  uname(&uts);
  getcwd(cwd,2000);

  Progname = argv[0] ;
  argc --;
  argv++;
  ErrorInit(NULL, NULL, NULL) ;
  DiagInit(NULL, NULL, NULL) ;
  if (argc == 0) usage_exit();
  parse_commandline(argc, argv);
  check_options();
  if (checkoptsonly) return(0);
  dump_options(stdout);

  SUBJECTS_DIR = getenv("SUBJECTS_DIR");
  if (SUBJECTS_DIR == NULL) {
    printf("ERROR: SUBJECTS_DIR not defined in environment\n");
    exit(1);
  }

  return 0;
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:30,代码来源:mris_fbirn_annot.c


示例6: main

int
main(int argc, char **argv)
{

	/* Init configuration */
	init_config();
	parse_commandline(argc, argv);

	switch(config.command) {
	case WDCTL_STATUS:
		wdctl_status();
		break;

	// 停掉 wifidog进程
	case WDCTL_STOP:
		wdctl_stop();
		break;

	case WDCTL_KILL:
		wdctl_reset();
		break;

	case WDCTL_RESTART:
		wdctl_restart();
		break;

	default:
		/* XXX NEVER REACHED */
		fprintf(stderr, "Oops\n");
		exit(1);
		break;
	}
	exit(0);
}
开发者ID:canyuxin,项目名称:openwrt-mt7620,代码行数:34,代码来源:wdctl.c


示例7: main

int main(int argc, const char **argv)
{
  clioptions opts;
  parse_commandline(argc, argv, &opts);
  run_server(&opts);
  return 0;
}
开发者ID:LlsDimple,项目名称:latency-benchmark,代码行数:7,代码来源:main.c


示例8: main

int
main (int	argc,
      char	*argv[])
{
	parse_commandline(argc, argv);
	mclget();
	exit(0);
}
开发者ID:jcable,项目名称:mcl,代码行数:8,代码来源:mclrecv.c


示例9: main

/** Reads the configuration file and then starts the main loop */
int main(int argc, char **argv) {

	s_config *config = config_get_config();
	config_init();

	parse_commandline(argc, argv);

	/* Initialize the config */
	config_read(config->configfile);
	config_validate();

	/* Initializes the linked list of connected clients */
	client_list_init();

	/* Init the signals to catch chld/quit/etc */
	init_signals();


	if (restart_orig_pid) {
		/*
		 * We were restarted and our parent is waiting for us to talk to it over the socket
		 */
		get_clients_from_parent();

		/*
		 * At this point the parent will start destroying itself and the firewall. Let it finish it's job before we continue
		 */
		while (kill(restart_orig_pid, 0) != -1) {
			debug(LOG_INFO, "Waiting for parent PID %d to die before continuing loading", restart_orig_pid);
			sleep(1);
		}

		debug(LOG_INFO, "Parent PID %d seems to be dead. Continuing loading.");
	}

	if (config->daemon) {

		debug(LOG_INFO, "Forking into background");

		switch(safe_fork()) {
			case 0: /* child */
				setsid();
				append_x_restartargv();
				main_loop();
				break;

			default: /* parent */
				exit(0);
				break;
		}
	}
	else {
		append_x_restartargv();
		main_loop();
	}

	return(0); /* never reached */
}
开发者ID:GaomingPan,项目名称:wifidog,代码行数:59,代码来源:gateway.c


示例10: main

int main (int argc, char *argv[])
{
	srand (time (NULL));
	omp_set_nested (1);
	omp_set_num_threads (16);
	// process command line
	parse_commandline (&argc, &argv);
	LOG (INFO) << "rtrt init";
	Window win (FLAGS_width, FLAGS_height, FLAGS_fullscreen, "Real-time Ray Tracer", FLAGS_interval);
	Image front (win.width(), win.height()), back (win.width(), win.height()); // create the images
	Image *front_p = &front, *back_p = &back;
	World world;
	//world.fill(75, 4);
	world.demo0();
	RayTracer rt (world);
	#pragma omp parallel
	{
		#pragma omp single nowait
		{
			while (win.is_running())
			{
				// update frame
				PerformanceMonitor::instance().RT_FPS.count();
				//win.update_frame_rate();
				win.clearXY();
				// render the new back buffer
				rt.render (back_p);
				// swap buffers
				std::swap (front_p, back_p);
			}
		}
		#pragma omp master
		{
			while (win.is_running())
			{
				// main rendering loop, keep rendering the front buffer
				PerformanceMonitor::instance().GL_FPS.count();
				win.clear(); // clear the render windows back buffer

				if (FLAGS_fps)
				{
					win.update_title_with_frame_rate();    // show the frame rate in the window title
				}

				win.render_image (*front_p); // render the image to the back buffer
				win.update(); // swap the back buffer with the front buffer
				PerformanceMonitor::instance().update();
			}
		}
	}
	LOG (INFO) << "shutting down";
	LOG (INFO) << "Average frame rate was " << win.average_framerate();
	front.destroy_image();
	back.destroy_image();
	win.destroy_window();
	LOG (INFO) << PerformanceMonitor::instance();
	return (0);
}
开发者ID:bheads,项目名称:rtrt_thesis,代码行数:58,代码来源:rtrt.cpp


示例11: main

int main(int argc, char* argv[])
{
    char* prmfname = NULL;

    parse_commandline(argc, argv, &prmfname);
    gridgen_generategrid(prmfname);

    return 0;
}
开发者ID:Chris35Wills,项目名称:gridgen-c,代码行数:9,代码来源:main.c


示例12: main

/******************************************************************************
 *                                                                            *
 * Function:                                                                  *
 *                                                                            *
 * Purpose:                                                                   *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Comments:                                                                  *
 *                                                                            *
 ******************************************************************************/
int main(int argc, char **argv)
{
    progname = get_program_name(argv[0]);
    parse_commandline(argc, argv);
    ja_load_config(CONFIG_FILE);

    START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT);
    exit(SUCCEED);
}
开发者ID:mastering-jaz,项目名称:jobarranger,代码行数:22,代码来源:jobarg_monitor.c


示例13: parse_commandline

void telemetry::parse_input()
{
   if(get_protocol() == protocol_t::command_line){
      parse_commandline();
   }else{
      parse_av_cobs();
      telemetry::parse_frsky_bytestuff();
   }
 //  parse_input_from_FrSky_with_cobs_protocol();
}
开发者ID:hkchindeko,项目名称:quantracker,代码行数:10,代码来源:telemetry.cpp


示例14: main

/**
*
* \brief implements the message server, which spawn the buisness logic process
*
* This is the main entry point for any C program.
*
* \param argc the number of arguments
* \param argv the arguments itselves (including the program name in argv[0])
*
* \return success or failure
*
*/
int main(int argc, const char * const * argv)
{
    
    int sockfd          = -1;  /* listen on sockfd */
    int sockfdchild     = -1;  /* new connection on sockfdchild */
    struct sockaddr_storage their_addr; /* client's address information */
    socklen_t sin_size  = -1;
    pid_t pid = -1;
    
    parse_commandline(argc,argv);
    
	sockfd = get_port(sockfd, argv);
    
    
    while(1) {  /* loop to accept() connections */
        sin_size = sizeof their_addr;
        sockfdchild = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size);
        if (sockfdchild == -1) {
            perror("accept");
            continue;
        }
        
       switch (pid = fork()) /*forking the child....*/
       {
		   case -1: { /*error*/
					close(sockfdchild);
					close(sockfd);
					fprintf(stderr,"error after forking");
					exit(1); /*maybe it would be better not to exit the program here...*/
					break;
			}
		   case 0:{/*child process*/
					close(sockfd);
					if (dup2(sockfdchild,0) == -1){ /*Umwandeln stdin*/
						close(sockfdchild);
						exit(EXIT_FAILURE);
					}
					if (dup2(sockfdchild,1) == -1){ /*Umwandeln stdout*/
						close(sockfdchild);
						exit(EXIT_FAILURE);
					}
                    errno = 0;
                    (void) execlp(PATHBULOGIC,"simple_message_server_logic" ,NULL);
                                        
					fprintf(stderr, "execlp() failed: %s\n", strerror(errno));
					exit(EXIT_FAILURE); 
		   }
		   default:{ /*mother process*/
					close(sockfdchild);  /* parent doesn't need this */
			}
	   }  
    }
    exit(EXIT_SUCCESS);
}
开发者ID:ic11b025,项目名称:bulletinboard,代码行数:66,代码来源:simple_message_server_1404.c


示例15: main

int main(int argc, char* const argv[]) {
    SkTArray<SkString> inputs;
    sk_tools::PictureBenchmark* benchmark = NULL;

    parse_commandline(argc, argv, &inputs, benchmark);

    for (int i = 0; i < inputs.count(); ++i) {
        process_input(inputs[i], *benchmark);
    }

    SkDELETE(benchmark);
}
开发者ID:jetlive,项目名称:skiaming,代码行数:12,代码来源:bench_pictures_main.cpp


示例16: main

int main (int argc, char * const * const argv)
{
    NVQRConnection connection;
    NVQRQueryDataBuffer data;
    pid_t pid = 0;
    GLenum queryType;
    nvqrReturn_t result;

    result = parse_commandline(argc, argv, &pid, &queryType);
    if (result != NVQR_SUCCESS) {
        fprintf(stderr, "%s: invalid command line\n", argv[0]);
        return result;
    }

    result = nvqr_connect(&connection, pid);
    if (result != NVQR_SUCCESS) {
        if (result == NVQR_ERROR_NOT_SUPPORTED &&
            connection.process_name) {
            printf("Resource query not supported for '%s' (pid %ld)\n",
                   connection.process_name, (long) connection.pid);
        } else {
            fprintf(stderr, "Error: failed to open connection to pid %ld\n",
                    (long) connection.pid);
        }
        return result;
    }

    result = nvqr_request_meminfo(connection, queryType, &data);
    if (result == NVQR_SUCCESS) {
        int version = nvqr_get_data_format_version(data.data);
        if (version < NVQR_MIN_DATA_FORMAT_VERSION ||
            version > NVQR_MAX_DATA_FORMAT_VERSION) {
            fprintf(stderr, "Error: unrecognized data format version '%d'. "
                    "(Minimum supported: %d; Maximum supported: %d)\n", version,
                    NVQR_MIN_DATA_FORMAT_VERSION, NVQR_MAX_DATA_FORMAT_VERSION);
        }

        if (connection.process_name) {
            printf("%s, pid = %ld, data format version %d\n",
                   connection.process_name, (long) connection.pid, version);
        }

        print_memory_info(queryType, data.data);
    } else {
        fprintf(stderr, "Error: failed to query resource usage information "
                "for pid %ld.\n", (long) connection.pid);
    }

    result = nvqr_disconnect(&connection);
    return result;
}
开发者ID:NVIDIA,项目名称:nvidia-query-resource-opengl,代码行数:51,代码来源:main.c


示例17: main

int main(int argc, char **argv)
{
	static acs_cli_info_t ai;
	int rc;

	/* Initalise our context object */
	memset(&ai, 0, sizeof(ai));
	ai.wl_ifname	= DEFAULT_WL_IFNAME;
	ai.server_host	= DEFAULT_SERVER_HOST;
	ai.server_port	= DEFAULT_SERVER_PORT;
	ai.socket	= -1;
	for (rc = 0; rc < CMDARG_MAX; ++rc) {
		ai.cmdarg[rc] = "";
	}

	rc = parse_commandline(&ai, argc, argv);
	if (rc != BCME_OK) {
		return rc;
	}

	switch (ai.action) {

	case ACTION_SHOW_COMMANDS:
		rc = show_command_list();
		break;

	case ACTION_SHOW_USAGE:
		rc = BCME_OK;
		usage(argv[0]);
		break;

	case ACTION_REPORT_VARIABLES:
		rc = report_all_variables(&ai);
		break;

	case ACTION_REPORT_EVERYTHING:
		rc = report_everything(&ai);
		break;

	case ACTION_DO_COMMAND:
		rc = connect_to_server(&ai);
		if (rc == BCME_OK) {
			rc = do_command_response(&ai);
			disconnect_from_server(&ai);
		}
		break;
	}
	return rc;
}
开发者ID:gygy,项目名称:asuswrt,代码行数:49,代码来源:acsd_cli.c


示例18: main

int
main(int argc, char *argv[])
{
   parse_commandline(argc, argv);
  
   signal(SIGINT, sigproc);
   signal(SIGQUIT, sigproc);
   
   //infinte loop to pipe input until program is killed
   for(;;) {
	pipeInput();
   }

   return (EXIT_SUCCESS);
}
开发者ID:droessmj,项目名称:cs388,代码行数:15,代码来源:middleman.c


示例19: main

/** Entry point to tor-gencert */
int
main(int argc, char **argv)
{
  int r = 1;
  init_logging(1);

  /* Don't bother using acceleration. */
  if (crypto_global_init(0, NULL, NULL)) {
    fprintf(stderr, "Couldn't initialize crypto library.\n");
    return 1;
  }
  if (crypto_seed_rng()) {
    fprintf(stderr, "Couldn't seed RNG.\n");
    goto done;
  }
  /* Make sure that files are made private. */
  umask(0077);

  if (parse_commandline(argc, argv))
    goto done;
  if (load_identity_key())
    goto done;
  if (reuse_signing_key) {
    if (load_signing_key())
      goto done;
  } else {
    if (generate_signing_key())
      goto done;
  }
  if (generate_certificate())
    goto done;

  r = 0;
 done:
  clear_passphrase();
  if (identity_key)
    EVP_PKEY_free(identity_key);
  if (signing_key)
    EVP_PKEY_free(signing_key);
  tor_free(address);
  tor_free(identity_key_file);
  tor_free(signing_key_file);
  tor_free(certificate_file);
  tor_free(address);

  crypto_global_cleanup();
  return r;
}
开发者ID:Liuchang0812,项目名称:tor,代码行数:49,代码来源:tor-gencert.c


示例20: main

int main(int argc, char* argv[])
{
    char* fname = NULL;
    int ij = 0;
    int compact = 0;
    NODETYPE nt = NT_DD;
    gridnodes* gn = NULL;
    poly* pl = NULL;

    parse_commandline(argc, argv, &fname, &compact, &ij, &nt);

    if (nt == NT_DD) {
        /*
         * read DD grid nodes 
         */
        gridnodes* gndd = gridnodes_read(fname, NT_DD);

        gridnodes_validate(gndd);
        /*
         * get corner grid nodes from DD grid nodes 
         */
        gn = gridnodes_transform(gndd, NT_COR);
        gridnodes_destroy(gndd);
    } else {
        gn = gridnodes_read(fname, NT_COR);
        gridnodes_validate(gn);
    }

    /*
     * build boundary polygon 
     */
    if (!ij)
        pl = poly_formbound(gridnodes_getnce1(gn), gridnodes_getnce2(gn), gridnodes_getx(gn), gridnodes_gety(gn));
    else
        pl = poly_formboundij(gridnodes_getnce1(gn), gridnodes_getnce2(gn), gridnodes_getx(gn));

    if (compact)
        poly_compact(pl, 1.0e-10);

    poly_write(pl, stdout);

    poly_destroy(pl);
    gridnodes_destroy(gn);

    return 0;
}
开发者ID:alessandrostone,项目名称:gridutils-c,代码行数:46,代码来源:getbound.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parse_commit函数代码示例发布时间:2022-05-30
下一篇:
C++ parse_command函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap