本文整理汇总了C++中parse_commandline函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_commandline函数的具体用法?C++ parse_commandline怎么用?C++ parse_commandline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_commandline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例7: main
int main(int argc, const char **argv)
{
clioptions opts;
parse_commandline(argc, argv, &opts);
run_server(&opts);
return 0;
}
示例8: main
int
main (int argc,
char *argv[])
{
parse_commandline(argc, argv);
mclget();
exit(0);
}
示例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 */
}
示例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);
}
示例11: main
int main(int argc, char* argv[])
{
char* prmfname = NULL;
parse_commandline(argc, argv, &prmfname);
gridgen_generategrid(prmfname);
return 0;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}