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


C++ process_args函数代码示例

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


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

示例1: exec_pipe

int exec_pipe(char *cmd)
{
  int num_pipes = 0;
  int fd[2];
  int bgfg = 0; // Never run background commands with pipes.
  char original_cmd[255];
  char *tok, prog1[256], prog2[256], *arg_list1[255], *arg_list2[255];

  strcpy(original_cmd, cmd);
  num_pipes = count_pipes(cmd);

  // Only support for singly piped commands.
  if (num_pipes > 1)
  {
    printf("The shell currently doesn't support multiple pipes! Sorry!\n");
    return 0;
  }
  else
  {
    // Get our two programs
    // They have arguments.
    tok = strtok(original_cmd, "|");
    strcpy(prog1, tok);
    tok = strtok(NULL, " |");
    strcpy(prog2, tok);

    // Process our arguments
    process_args(prog1, arg_list1, &bgfg);
    process_args(prog2, arg_list2, &bgfg);

    pipe(fd);
    // Execute prog1
    if (fork() > 0)
    {
      close(fd[0]);
      dup2(fd[1], 1);
      execvp(arg_list1[0], arg_list1);
      exit(22);
    }
    else
    {
      close(fd[1]);
      dup2(fd[0], 0);
      execvp(arg_list2[0], arg_list2);
      exit(22);
    }
  }

  return 1;
}
开发者ID:LainIwakura,项目名称:Assignments,代码行数:50,代码来源:myshell2.c

示例2: main

int main(int argc, char **argv)
{
	if(sizeof(int) != 4) {
		fprintf(stderr, "Your machine's ints are not 4 bytes.  "
				"You need to adjust generate_data() and check_data().\n");
		exit(2);
	}

	process_args(argc, argv);
	init_genrand(opt_seed);

	if(opt_check) {
		check_data(0, opt_size);
	} else {
		generate_data(1, opt_size);
	}

	/*
	int i;
	printf("1000 outputs of genrand_int32()\n");
	for (i=0; i<1000; i++) {
		printf("%10lu ", genrand_int32());
		if (i%5==4) printf("\n");
	}
	*/

	return 0;
}
开发者ID:aurora,项目名称:rzh,代码行数:28,代码来源:randfile.c

示例3: main

int main(int argc, char *argv[]) {
  startCatchingSignals();
 {
  astlocMarker markAstLoc(0, "<internal>");
  initFlags();
  initChplProgram();
  initPrimitive();
  initPrimitiveTypes();
  initTheProgram();
  setupOrderedGlobals(argv[0]);
  compute_program_name_loc(argv[0], &(arg_state.program_name),
                           &(arg_state.program_loc));
  process_args(&arg_state, argc, argv);
  initCompilerGlobals(); // must follow argument parsing
  setupDependentVars();
  setupModulePaths();
  recordCodeGenStrings(argc, argv);
 } // astlocMarker scope
  printStuff(argv[0]);
  if (rungdb)
    runCompilerInGDB(argc, argv);
  if (fdump_html || strcmp(log_flags, ""))
    init_logs();
  compile_all();
  if (fEnableTimers) {
    printf("timer 1: %8.3lf\n", timer1.elapsed());
    printf("timer 2: %8.3lf\n", timer2.elapsed());
    printf("timer 3: %8.3lf\n", timer3.elapsed());
    printf("timer 4: %8.3lf\n", timer4.elapsed());
    printf("timer 5: %8.3lf\n", timer5.elapsed());
  }
  free_args(&arg_state);
  clean_exit(0);
  return 0;
}
开发者ID:aroonsharma1,项目名称:Chapel_Masters_Work,代码行数:35,代码来源:driver.cpp

示例4: main

int main(int argc, char *argv[])
{
	char fsname[8 + 1];
	int rc;

	process_args(argc, argv);
	if (lustre_dir == NULL)
		lustre_dir = "/mnt/lustre";

	rc = llapi_search_mounts(lustre_dir, 0, fsmountdir, fsname);
	if (rc != 0) {
		fprintf(stderr, "Error: '%s': not a Lustre filesystem\n",
			lustre_dir);
		return EXIT_FAILURE;
	}

	/* Play nice with Lustre test scripts. Non-line buffered output
	 * stream under I/O redirection may appear incorrectly. */
	setvbuf(stdout, NULL, _IOLBF, 0);

	/* Create a test filename and reuse it. Remove possibly old files. */
	rc = snprintf(mainpath, sizeof(mainpath), "%s/%s", lustre_dir, maindir);
	ASSERTF(rc > 0 && rc < sizeof(mainpath), "invalid name for mainpath");
	cleanup();

	atexit(cleanup);

	PERFORM(test10);
	PERFORM(test11);
	PERFORM(test12);
	PERFORM(test20);
	PERFORM(test30);

	return EXIT_SUCCESS;
}
开发者ID:Xyratex,项目名称:lustre-stable,代码行数:35,代码来源:group_lock_test.c

示例5: init

static void
init(int *argc, char ***argv)
{
	process_args(argc, argv);

	if (!ev_init())
		C("failed to initialize eval/dispatch");
	
	if (s_sercommd) {
		if (!s_dev)
			s_dev = strdup(DEF_TRG);

		if (!s_baud)
			s_baud = DEF_PORT;

		if (!sc_init_tcp(s_dev, (uint16_t)s_baud))
			C("failed to initialize sercomm (trg: '%s', port: %d)",
			    s_dev, s_baud);
	} else {
		if (!s_dev)
			s_dev = strdup(DEF_DEV);

		if (!s_baud)
			s_baud = DEF_BAUD;

		if (!sc_init(s_dev, s_baud))
			C("failed to initialize sercomm (dev: '%s', baud: %d)",
			    s_dev, s_baud);
	}

	if (*argc)
		s_stdin = false;
}
开发者ID:fstd,项目名称:imme,代码行数:33,代码来源:immectl.c

示例6: main

int main(int argc, char **argv)
{
   if(argc < 3)
      exp_help();
   else
      process_args(argc, argv);

   printf("[+] Connecting target %s\n", target_host);
   connect_host(inet_addr(target_host), 139);

   printf("[+] Setting up SMB Session\n");
   session_setup();

   printf("[+] Triggering up DCERPC reassembly\n");
   build_trigger();
   pwn();

   printf("[+] Triggering overflow\n");
   build_pwnage();
   pwn();
   disconnect_host();
   
   sleep(1);
   printf("[+] Attempting to join shell\n");
   connect_host(inet_addr(target_host), 4444);
   join_shell(sock);

   return 0;
}
开发者ID:abhisek,项目名称:eos-india,代码行数:29,代码来源:snort_dcerpc_pwn-v0.1.c

示例7: main

int main (int ac, char *av[])
{
	int i;
	double timeout = 1.0;

	log_msg_init (basename (av[0]));

	process_args (ac, av);

	log_verbose ("Stressing io-watchdog API for %d iterations.\n",
			iterations);

	for (i = 0; i < iterations; i++) {
		iow_err_t err = io_watchdog_set_timeout (timeout);

		if (err != EIOW_SUCCESS)
			log_fatal (1, "io_watchdog_set_timeout (%3fs): %s\n",
					timeout, io_watchdog_strerror (err));

		check_expected_timeout ((int) timeout);
		log_verbose ("io_watchdog_set_timeout (%.3fs): Success\n", timeout);
		timeout += 10;
	}

	log_msg_fini ();
	return (0);
}
开发者ID:grondo,项目名称:io-watchdog,代码行数:27,代码来源:api-stress.c

示例8: main

int
main (int argc, char **argv)
{
  // Set exit routines
  atexit (GC_gcollect);
  atexit (close_libs);
  atexit (thread_cleanup);

  // Start the garbage collector
  GC_INIT ();

  // Set up GMP library
  mp_set_memory_functions (&FACT_malloc,
			   &gmp_realloc_wrapper,
			   &gmp_free_wrapper);

  // Start the main thread
  root_thread = FACT_malloc (sizeof (FACT_thread_t));
  root_thread->tid = pthread_self ();
  root_thread->exited  = false;
  root_thread->destroy = false;
  root_thread->next = NULL;
  root_thread->prev = NULL;
  root_thread->root = NULL;
  root_thread->nid  = 0;
  pthread_mutex_init (&root_thread->queue_lock, NULL);

  // Process the arguments and start the interpreter.
  process_args (argc, argv);

  // Exit.
  exit (0);
}
开发者ID:netspencer,项目名称:FACT,代码行数:33,代码来源:main.c

示例9: hpx_main

int hpx_main(boost::program_options::variables_map & vm)
{
    params p(process_args(vm));
    print_header("OSU HPX Scatter Latency Test");
    run_benchmark(p);
    return hpx::finalize();
}
开发者ID:vamatya,项目名称:hpx_benchmarks,代码行数:7,代码来源:osu_scatter.cpp

示例10: main

/**
 * Entry point for the program.
 */
int main(int argc, char **argv)
{
    Color_t *original;
    int width, height;
    int n_polygons           = N_POLYGONS;
    int n_sides              = DEFAULT_POLYGON_POINTS;
    double target_percentage = -1.0f;
    char *filename           = INPUT_IMAGE;

    /* Check for any command-line arguments. */
    process_args(argc, argv, &filename, &n_sides, &n_polygons,
            &target_percentage);

    /* Seed the random number generated with the current time. */
    srand(time(NULL));

    /* Read in the original image. */
    original = readPNG(filename, &width, &height);

    /* Kick off the polygon loop. */
    main_loop(original, width, height, n_sides, n_polygons, target_percentage);

    free(original);
    return 0;
}
开发者ID:jonathanfisher,项目名称:polygon-renderer,代码行数:28,代码来源:source.c

示例11: main

int main(int argc, char **argv)
{
    process_args(argc, argv);
    if (to_process == NULL)
        usage();

    lily_options *options = lily_new_default_options();
    if (gc_threshold != 0)
        options->gc_threshold = gc_threshold;

    options->argc = argc;
    options->argv = argv;

    lily_parse_state *parser = lily_new_parse_state(options);
    lily_lex_mode mode = (do_tags ? lm_tags : lm_no_tags);

    int result;
    if (is_file == 1)
        result = lily_parse_file(parser, mode, to_process);
    else
        result = lily_parse_string(parser, "[cli]", mode, to_process);

    if (result == 0) {
        fputs(lily_build_error_message(parser), stderr);
        exit(EXIT_FAILURE);
    }

    lily_free_parse_state(parser);
    lily_free(options);
    exit(EXIT_SUCCESS);
}
开发者ID:cgbystrom,项目名称:scriptorium,代码行数:31,代码来源:lily.c

示例12: main

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

    int64 nside = 4096;
    double radius_arcsec = -1;
    int64 maxmatch=1;
    int print_dist=0;
    int verbose=0;

    const char* file = process_args(argc, argv, &nside, &radius_arcsec, 
                                    &maxmatch, &print_dist, &verbose);

    if (verbose) {
        if (radius_arcsec > 0)
            wlog("radius:    %0.1lf arcsec\n", radius_arcsec);
        wlog("nside:     %ld\n", nside);
        wlog("maxmatch:  %ld\n", maxmatch);
        wlog("file:      %s\n", file);
    }

    struct cat* cat = read_cat(file, nside, radius_arcsec, verbose);

    if (verbose) wlog("processing stream\n");

    struct matchstack* matches = matchstack_new();
    size_t index=0;
    double ra=0, dec=0;
    while (2 == fscanf(stdin,"%lf %lf", &ra, &dec)) {
        process_radec(cat, ra, dec, matches);
        print_matches(index, matches, maxmatch, print_dist);
        index++;
    }

    if (verbose) wlog("processed %lu from stream.\n", index);
}
开发者ID:esheldon,项目名称:misc,代码行数:34,代码来源:smatch.c

示例13: main

int main(int argc, char **argv)
{
	if(process_args(argc, argv))
	{
		if(load_exports())
		{
			if(g_verbose)
			{
				dump_exports();
			}
			switch(g_outputmode)
			{
				case PSP_BUILD_EXPORTS: build_exports();
										break;
										/* Do the same for both */
				case PSP_BUILD_STUBS_NEW: 
				case PSP_BUILD_STUBS  : build_stubs();
										break;
				default				  : /* Argh */
										break;
			};
		}

		free_lib_data();
	}
	else
	{
		print_help();
	}

	return 0;
}
开发者ID:SamRH,项目名称:pspsdk,代码行数:32,代码来源:psp-build-exports.c

示例14: main

int main(int argc, char** argv) {
    int64 nside=4096;
    double rad_radians=-1;
    int rad_in_file=0;
    process_args(argc, argv, &nside, &rad_radians, &rad_in_file);

    struct healpix* hpix = hpix_new(nside);

    VEC(int64) pixlist = VEC_NEW(int64);

    double ra=0, dec=0;
    while (2 == fscanf(stdin,"%lf %lf", &ra, &dec)) {
        if (rad_in_file) {
            if (1 != fscanf(stdin,"%lf", &rad_radians)) {
                fprintf(stderr,"failed to read radius\n");
                exit(EXIT_FAILURE);
            }
            rad_radians *= D2R/3600.;
        }

        hpix_disc_intersect_radec(hpix, ra, dec, rad_radians, pixlist);

        printf("%.16g %.16g %lu", ra, dec, VEC_SIZE(pixlist);
        VEC_FOREACH(pix_ptr, pixlist) {
            printf(" %ld", *pix_ptr);
        }
        printf("\n");
    }
开发者ID:esheldon,项目名称:misc,代码行数:28,代码来源:intersect.c

示例15: main

int main(int argc, char **argv)
{
    ArgumentSet args;
    ArgumentMap kwargs;

    process_args(argc, argv, args, kwargs);
    
    if(kwargs.count("help"))
    {
        usage(argc, argv);
        return 0;
    }

    if(kwargs.count("list"))
    {
        UnitTestDriver::s_driver().list_tests();
        return 0;
    }
    
    if(kwargs.count("sizes"))
    {
        set_test_sizes(kwargs["sizes"]);
    }
    else
    {
        set_test_sizes("default");
    }

    bool passed = UnitTestDriver::s_driver().run_tests(args, kwargs);

    if (kwargs.count("concise"))
        std::cout << ((passed) ? "PASSED" : "FAILED") << std::endl;
   
    return (passed) ? EXIT_SUCCESS : EXIT_FAILURE;
}
开发者ID:unvirtual,项目名称:thrust,代码行数:35,代码来源:testframework.cpp


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