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

C++ poptStrerror函数代码示例

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

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



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

示例1: parse_opt

static
void parse_opt(int argc, char **argv)
{
	int c;
	poptContext optCon;
	const char *no_arg;

	struct poptOption optionsTable[] = {
		{ "loops"  , 'n', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_loops , 0, "pp loops", "count" },
		{ "time"  , 't', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_maxtime, 0, "max time", "ms" },
		{ "maxsize"  , 0, POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_maxmsize , 0, "maximal messagesize", "size" },

		{ "nokill" , 'k', POPT_ARGFLAG_OR | POPT_ARG_VAL,
		  &arg_nokill, 1, "Dont kill the server afterwards", NULL },

		{ "port" , 'p', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_STRING,
		  &arg_port, 0, "server port to use", "port" },

		{ "verbose"	, 'v', POPT_ARG_NONE,
		  NULL		, 'v', "increase verbosity", NULL },
		POPT_AUTOHELP
		POPT_TABLEEND
	};

	optCon = poptGetContext(NULL, argc, (const char **) argv, optionsTable, 0);

	poptSetOtherOptionHelp(optCon, "[serveraddr]");

	while ((c = poptGetNextOpt(optCon)) >= 0) {
		switch (c) { // c = poptOption.val;
		case 'v': arg_verbose++; break;
		}
	}

	if (c < -1) { /* an error occurred during option processing */
		fprintf(stderr, "%s: %s\n",
			poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
			poptStrerror(c));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

//	arg_1 = poptGetArg(optCon);
//	arg_2 = poptGetArg(optCon);
	arg_servername = poptGetArg(optCon);
	is_server = !arg_servername;

	no_arg = poptGetArg(optCon); // should return NULL
	if (no_arg) {
		fprintf(stderr, "%s: %s\n",
			no_arg, poptStrerror(POPT_ERROR_BADOPT));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

	poptFreeContext(optCon);
}
开发者ID:ParaStation,项目名称:pscom,代码行数:60,代码来源:extoll_pp_velo.c


示例2: parse_opt

static
void parse_opt(int argc, char **argv)
{
	int c;
	poptContext optCon;
	const char *no_arg;

	struct poptOption optionsTable[] = {
		{ "loops"  , 'n', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_loops , 0, "pp loops", "count" },
		{ "time"  , 't', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_maxtime, 0, "max time", "ms" },
		{ "maxsize"  , 0, POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_maxmsize , 0, "maximal messagesize", "size" },

		{ "once" , '1', POPT_ARGFLAG_OR | POPT_ARG_VAL,
		  &arg_run_once, 1, "stop after one client", NULL },

		{ "verbose"	, 'v', POPT_ARG_NONE,
		  NULL		, 'v', "increase verbosity", NULL },
		POPT_AUTOHELP
		POPT_TABLEEND
	};

	optCon = poptGetContext(NULL, argc, (const char **) argv, optionsTable, 0);

	poptSetOtherOptionHelp(optCon, "[serveraddr]");

	while ((c = poptGetNextOpt(optCon)) >= 0) {
		switch (c) { // c = poptOption.val;
		case 'v': arg_verbose++; break;
		//default: fprintf(stderr, "unhandled popt value %d\n", c); break;
		}
	}

	if (c < -1) { /* an error occurred during option processing */
		fprintf(stderr, "%s: %s\n",
			poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
			poptStrerror(c));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

//	arg_1 = poptGetArg(optCon);
//	arg_2 = poptGetArg(optCon);
	/* if (arg_client)*/ {
		const char *server = poptGetArg(optCon);
		if (server) arg_server_addr = server;
	}

	no_arg = poptGetArg(optCon); // should return NULL
	if (no_arg) {
		fprintf(stderr, "%s: %s\n",
			no_arg, poptStrerror(POPT_ERROR_BADOPT));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

	poptFreeContext(optCon);
}
开发者ID:JonBau,项目名称:pscom,代码行数:60,代码来源:dapl_pp.c


示例3: parse_opt

void parse_opt(int argc, char **argv)
{
	int c;
	poptContext optCon;
	const char *no_arg;

	struct poptOption optionsTable[] = {
		{ "send" , 's', POPT_ARGFLAG_OR | POPT_ARG_VAL,
		  &arg_send, 1, "first send", NULL },

		{ "lport"	, 'l', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_INT,
		  &arg_listenport, 0, "listen on port", "port" },

		{ "lname"	, 'n', POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_STRING,
		  &arg_listenname, 0, "listen on name", "name" },

		{ "verbose"	, 'v', POPT_ARG_NONE,
		  NULL		, 'v', "increase verbosity", NULL },
		POPT_AUTOHELP
		POPT_TABLEEND
	};

	optCon = poptGetContext(NULL, argc, (const char **) argv, optionsTable, 0);

	poptSetOtherOptionHelp(optCon, "[peer address]");

	while ((c = poptGetNextOpt(optCon)) >= 0) {
		switch (c) { // c = poptOption.val;
		case 'v': arg_verbose++; break;
		//default: fprintf(stderr, "unhandled popt value %d\n", c); break;
		}
	}

	if (c < -1) { /* an error occurred during option processing */
		fprintf(stderr, "%s: %s\n",
			poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
			poptStrerror(c));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

	{
		const char *s;
		s = poptGetArg(optCon);
		if (s) {
			arg_peer_str = s;
		}
	}

	no_arg = poptGetArg(optCon); // should return NULL
	if (no_arg) {
		fprintf(stderr, "%s: %s\n",
			no_arg, poptStrerror(POPT_ERROR_BADOPT));
		poptPrintHelp(optCon, stderr, 0);
		exit(1);
	}

	poptFreeContext(optCon);
}
开发者ID:ParaStation,项目名称:pscom,代码行数:59,代码来源:pscom_ondemand.c


示例4: args_execute

void args_execute(int argc, char *argv[])
{
	poptContext con;
	int nextopt;

	if (iopt_tables == NULL)
		return;

	con = poptGetContext(PACKAGE, argc, argv,
			     (struct poptOption *) (iopt_tables->data), 0);
	poptReadDefaultConfig(con, TRUE);

	while ((nextopt = poptGetNextOpt(con)) > 0) ;

	if (nextopt != -1) {
		printf("Error on option %s: %s.\n"
		       "Run '%s --help' to see a full list of "
		       "available command line options.\n",
		       poptBadOption(con, 0), poptStrerror(nextopt), argv[0]);
		exit(1);
	}

	g_array_free(iopt_tables, TRUE);
	iopt_tables = NULL;

        poptFreeContext(con);
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:27,代码来源:args.c


示例5: main

int
main(int argc, char *argv[])
{
	poptContext pc;
	const char **extra_args;
	int opt;

	pc = poptGetContext(PROGRAM, argc, (const char **)argv,
			    long_options, 0);
	while ((opt = poptGetNextOpt(pc)) != -1) {
		switch (opt) {
		case 'h':
			tls_usage(0);
		default:
			fprintf(stderr,
			        "%s: %s\n",
				poptBadOption(pc, POPT_BADOPTION_NOALIAS),
				poptStrerror(opt));
			tls_usage(1);
		}
	}

	extra_args = poptGetArgs(pc);
	if (!extra_args || *extra_args == NULL)
		tls_usage(1);

	for (; *extra_args; extra_args++)
		list_file(*extra_args);
	poptFreeContext(pc);

	return 0;
}
开发者ID:Distrotech,项目名称:rsync,代码行数:32,代码来源:tls.c


示例6: main

int main(int argc, const char *argv[])
{
    poptContext pc;
    int opt;
    int rv;
    struct poptOption long_options[] = {
        POPT_AUTOHELP
        SSSD_DEBUG_OPTS
        POPT_TABLEEND
    };

    const struct CMUnitTest tests[] = {
        cmocka_unit_test(test_deskprofile_get_filename_path),
    };

    /* Set debug level to invalid value so we can decide if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\nInvalid option %s: %s\n\n",
                    poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }
    poptFreeContext(pc);

    DEBUG_CLI_INIT(debug_level);

    rv = cmocka_run_group_tests(tests, NULL, NULL);
    return rv;
}
开发者ID:SSSD,项目名称:sssd,代码行数:35,代码来源:test_deskprofile_utils.c


示例7: parse_options

/*
   parse options
 */
static isc_result_t parse_options(struct dlz_bind9_data *state,
				  unsigned int argc, char *argv[],
				  struct b9_options *options)
{
	int opt;
	poptContext pc;
	struct poptOption long_options[] = {
		{ "url", 'H', POPT_ARG_STRING, &options->url, 0, "database URL", "URL" },
		{ "debug", 'd', POPT_ARG_STRING, &options->debug, 0, "debug level", "DEBUG" },
		{ NULL }
	};

	pc = poptGetContext("dlz_bind9", argc, (const char **)argv, long_options,
			POPT_CONTEXT_KEEP_FIRST);
	while ((opt = poptGetNextOpt(pc)) != -1) {
		switch (opt) {
		default:
			state->log(ISC_LOG_ERROR, "dlz_bind9: Invalid option %s: %s",
				   poptBadOption(pc, 0), poptStrerror(opt));
			return ISC_R_FAILURE;
		}
	}

	return ISC_R_SUCCESS;
}
开发者ID:sprymak,项目名称:samba,代码行数:28,代码来源:dlz_bind9.c


示例8: main

int main(int argc, char *argv[])
{
    poptContext optCon;   /* context for parsing command-line options */
    int rc;

    struct poptOption optionsTable[] = {
	{ "np", '\0', POPT_ARG_INT | POPT_ARGFLAG_ONEDASH,
	  &arg_np, 0, "number of processes to start", "num"},
	POPT_AUTOHELP
	{ NULL, '\0', 0, NULL, 0, NULL, NULL}
    };

    //printf(__DATE__" "__TIME__"\n");

    optCon = poptGetContext(NULL, argc, (const char **)argv, optionsTable, 0);
    rc = poptGetNextOpt(optCon);

    if (rc < -1) {
	/* an error occurred during option processing */
	poptPrintUsage(optCon, stderr, 0);
	fprintf(stderr, "%s: %s\n",
		poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
		poptStrerror(rc));
	return 1;
    }

    if (arg_np <= 0) {
	fprintf(stderr,"missing arg -np\n");
	exit(1);
    }

    run(argc,argv,arg_np);
    return 0;
}
开发者ID:ParaStation,项目名称:psmgmt,代码行数:34,代码来源:test_pse.c


示例9: main

int main(int argc, const char *argv[])
{
    int opt;
    poptContext pc;
    struct main_context *main_ctx;
    int ret;
    uid_t uid;
    gid_t gid;

    struct poptOption long_options[] = {
        POPT_AUTOHELP
        SSSD_MAIN_OPTS
        SSSD_SERVER_OPTS(uid, gid)
        POPT_TABLEEND
    };

    /* Set debug level to invalid value so we can decide if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    umask(DFL_RSP_UMASK);

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\nInvalid option %s: %s\n\n",
                  poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }

    poptFreeContext(pc);

    DEBUG_INIT(debug_level);

    /* set up things like debug, signals, daemonization, etc... */
    debug_log_file = "sssd_pac";

    ret = server_setup("sssd[pac]", 0, uid, gid,
                       CONFDB_PAC_CONF_ENTRY, &main_ctx);
    if (ret != EOK) return 2;

    ret = die_if_parent_died();
    if (ret != EOK) {
        /* This is not fatal, don't return */
        DEBUG(SSSDBG_OP_FAILURE, "Could not set up to exit when parent process does\n");
    }

    ret = pac_process_init(main_ctx,
                           main_ctx->event_ctx,
                           main_ctx->confdb_ctx);
    if (ret != EOK) return 3;

    /* loop on main */
    server_loop(main_ctx);

    return 0;
}
开发者ID:lejonet,项目名称:sssd,代码行数:59,代码来源:pacsrv.c


示例10: main

int main(int argc, const char *argv[])
{
    int rv;
    int no_cleanup = 0;
    poptContext pc;
    int opt;
    struct poptOption long_options[] = {
        POPT_AUTOHELP
        SSSD_DEBUG_OPTS
        {"no-cleanup", 'n', POPT_ARG_NONE, &no_cleanup, 0,
         _("Do not delete the test database after a test run"), NULL },
        POPT_TABLEEND
    };

    const UnitTest tests[] = {
        /* Utility functions unit test */
        unit_test(dyndns_test_get_ifaddr),

        /* Dynamic DNS update unit tests*/
        unit_test_setup_teardown(dyndns_test_ok,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_error,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_timeout,
                                 dyndns_test_setup, dyndns_test_teardown),
        unit_test_setup_teardown(dyndns_test_interval,
                                 dyndns_test_setup, dyndns_test_teardown),
    };

    /* Set debug level to invalid value so we can deside if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\nInvalid option %s: %s\n\n",
                    poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }
    poptFreeContext(pc);

    DEBUG_CLI_INIT(debug_level);

    /* Even though normally the tests should clean up after themselves
     * they might not after a failed run. Remove the old db to be sure */
    tests_set_cwd();
    test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_SYSDB_FILE);
    test_dom_suite_setup(TESTS_PATH);

    rv = run_tests(tests);
    if (rv == 0 && !no_cleanup) {
        test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_DB, TEST_SYSDB_FILE);
    }
    return rv;
}
开发者ID:mmsrubar,项目名称:thesis,代码行数:58,代码来源:test_dyndns.c


示例11: main

int
main(int argc, const char *argv[])
{
  Socket* serverSock, *controlSock;
  int c;

  poptContext optCon = poptGetContext(NULL, argc, argv, options, 0);
  poptSetOtherOptionHelp(optCon, "configFile");

  while ((c = poptGetNextOpt(optCon)) >= 0) {
    switch (c) {
    case 'v':
      printf(V_STRING, VERSION);
      printf(COPYRIGHT);
      return 0;
    }
  }

  setup_logging (logfile_name, log_level);

  if (c < -1) {
    /* an error occurred during option processing */
    fprintf(stderr, "%s: %s\n",
      poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
      poptStrerror(c));
    return -1;
  }

  loginfo (V_STRING, VERSION);
  loginfo (COPYRIGHT);

  struct sigaction new_action, old_action;
  new_action.sa_handler = sigpipe_handler;
  sigemptyset (&new_action.sa_mask);
  new_action.sa_flags = 0;
  sigaction (SIGPIPE, NULL, &old_action);
  if (old_action.sa_handler != SIG_IGN)
    sigaction (SIGPIPE, &new_action, NULL);

  prepare_stdin(NULL);

  eventloop_init();
  session = (Session*) malloc(sizeof(Session));
  memset(session, 0, sizeof(Session));

  session->state = ProxyState_PAUSED;

  serverSock = socket_server_new("proxy_server", listen_port, on_connect, NULL);
  controlSock = socket_server_new("proxy_server_control", listen_port + 1, on_control_connect, NULL);

  eventloop_on_stdin(stdin_handler, session);
  eventloop_run();

  socket_free(serverSock);
  socket_free(controlSock);

  return(0);
}
开发者ID:stojadin,项目名称:oml,代码行数:58,代码来源:oml2-proxy-server.c


示例12: main

/*
  main program
*/
int main(int argc, const char *argv[])
{
    struct ctdb_context *ctdb;
    struct ctdb_db_context *ctdb_db;

    struct poptOption popt_options[] = {
        POPT_AUTOHELP
        POPT_CTDB_CMDLINE
        { "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" },
        { "base-rec", 'b', POPT_ARG_INT, &base_rec, 0, "base_rec", "integer" },
        { "delete-pct", 'p', POPT_ARG_INT, &delete_pct, 0, "delete_pct", "integer" },
        POPT_TABLEEND
    };
    int opt;
    const char **extra_argv;
    int extra_argc = 0;
    poptContext pc;
    struct event_context *ev;

    pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);

    while ((opt = poptGetNextOpt(pc)) != -1) {
        switch (opt) {
        default:
            fprintf(stderr, "Invalid option %s: %s\n",
                    poptBadOption(pc, 0), poptStrerror(opt));
            exit(1);
        }
    }

    /* setup the remaining options for the main program to use */
    extra_argv = poptGetArgs(pc);
    if (extra_argv) {
        extra_argv++;
        while (extra_argv[extra_argc]) extra_argc++;
    }

    ev = event_context_init(NULL);

    ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));

    if (ctdb == NULL) {
        printf("failed to connect to daemon\n");
        exit(1);
    }

    /* attach to a specific database */
    ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb",
                          false, 0);
    if (!ctdb_db) {
        printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
        exit(1);
    }

    store_records(ctdb, ev);

    return 0;
}
开发者ID:hef,项目名称:samba,代码行数:61,代码来源:ctdb_randrec.c


示例13: main

int main(int argc, const char *argv[])
{
    poptContext pc;
    int opt;
    struct poptOption long_options[] = {
        POPT_AUTOHELP
        SSSD_DEBUG_OPTS
        POPT_TABLEEND
    };

    const struct CMUnitTest tests[] = {
        cmocka_unit_test_setup_teardown(test_add_domain,
                                        test_sss_idmap_setup,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_map_id,
                                        test_sss_idmap_setup_with_domains,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_map_id_external,
                                        test_sss_idmap_setup_with_external_mappings,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_check_sid_id,
                                        test_sss_idmap_setup_with_domains,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_check_sid_id,
                                        test_sss_idmap_setup_with_external_mappings,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_has_algorithmic,
                                        test_sss_idmap_setup_with_both,
                                        test_sss_idmap_teardown),
        cmocka_unit_test_setup_teardown(test_has_algorithmic_by_name,
                                        test_sss_idmap_setup_with_both,
                                        test_sss_idmap_teardown),
        cmocka_unit_test(test_sss_idmap_check_collision_ex),
    };

    /* Set debug level to invalid value so we can deside if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\nInvalid option %s: %s\n\n",
                    poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }
    poptFreeContext(pc);

    DEBUG_CLI_INIT(debug_level);

    tests_set_cwd();

    return cmocka_run_group_tests(tests, NULL, NULL);
}
开发者ID:abbra,项目名称:sssd,代码行数:56,代码来源:test_sss_idmap.c


示例14: bad_option

static void bad_option(poptContext opcon, int error)
{
    char       msgbuf[1000];
    
    snprintf(msgbuf, sizeof msgbuf-1, "%s: %s: %s",
             PROGRAM, poptStrerror(error), poptBadOption(opcon, 0));
    rdiff_usage(msgbuf);
    
    exit(RS_SYNTAX_ERROR);
}
开发者ID:Estevo-Aleixo,项目名称:librsync,代码行数:10,代码来源:rdiff.c


示例15: RTparseOptions

void RTparseOptions(const char* argline,int *argc_p,char***argv_p){
    int len=strlen(argline)+8;
    char cmdline[len];
    sprintf(cmdline,"fake %s",argline);
    int res=poptParseArgvString(cmdline,argc_p,(const char ***)argv_p);
    if (res){
        Fatal(1,error,"could not parse %s: %s",cmdline,poptStrerror(res));
    }
    (*argv_p)[0]=strdup(HREgetApplication());
}
开发者ID:alaarman,项目名称:ltsmin,代码行数:10,代码来源:hre_popt.c


示例16: main

/*
  main program
*/
int main(int argc, const char *argv[])
{
	struct poptOption popt_options[] = {
		POPT_AUTOHELP
		{ "socket", 0, POPT_ARG_STRING, &globals.socketname, 0, "local socket name", "filename" },
		POPT_TABLEEND
	};
	int opt;
	const char **extra_argv;
	int extra_argc = 0;
	poptContext pc;

	DEBUGLEVEL = DEBUG_INFO;

	pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);

	while ((opt = poptGetNextOpt(pc)) != -1) {
		switch (opt) {
		default:
			fprintf(stderr, "Invalid option %s: %s\n",
				poptBadOption(pc, 0), poptStrerror(opt));
			exit(1);
		}
	}

	/* setup the remaining options for the main program to use */
	extra_argv = poptGetArgs(pc);
	if (extra_argv) {
		extra_argv++;
		while (extra_argv[extra_argc]) extra_argc++;
	}

	if (globals.socketname == NULL) {
		DEBUG(DEBUG_CRIT,("Socket name is undefined\n"));
		exit(1);
	}
	if (socket_server_create()) {
		DEBUG(DEBUG_CRIT,("Socket error: exiting\n"));
		exit(1);
	}
	if (fork_helper()) {
		DEBUG(DEBUG_CRIT,("Forking error: exiting\n"));
		exit(1);
	}
	/* FIXME: Test tcp_checksum6, tcp_checksum */
	/* FIXME: Test ctdb_sys_send_arp, ctdb_sys_send_tcp */
	/* FIXME: Test ctdb_sys_{open,close}_capture_socket, ctdb_sys_read_tcp_packet */
	test_ctdb_sys_check_iface_exists();
	test_ctdb_get_peer_pid();

	socket_server_close();

	DEBUG(DEBUG_INFO,("%d/%d tests successfull\n", globals.successcount, globals.testcount));
	return 0;
}
开发者ID:bhanug,项目名称:samba,代码行数:58,代码来源:ctdb_porting_tests.c


示例17: main

int main(int argc, const char *argv[])
{
    int opt;
    poptContext pc;
    int opt_version = 0;
    char *opt_config_file = NULL;
    int opt_debug = 0;
    struct gt_config cfg = {0};
    int ret;
    AUTOCLEAN(int werr, waitchildren) = 0;

    struct poptOption long_options[] = {
        POPT_AUTOHELP
        {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \
         _("Specify a non-default config file"), NULL}, \
        {"debug", 'd', POPT_ARG_NONE, &opt_debug, 0, \
         _("Enable debugging"), NULL}, \
         {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \
          _("Print version number and exit"), NULL }, \
        POPT_TABLEEND
    };

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) {
        switch(opt) {
        default:
            fprintf(stderr, "\n%s %s: %s\n\n", err_string(ERR_BADOPT),
                    poptBadOption(pc, 0), poptStrerror(opt));
            poptPrintUsage(pc, stderr, 0);
            return 1;
        }
    }

    if (opt_version) {
        puts(VERSION""DISTRO_VERSION""PRERELEASE_VERSION);
        return 0;
    }

    ret = load_config(opt_config_file, &cfg);
    if (ret) {
        fprintf(stderr, "Failed to load config file '%s': %s\n",
                opt_config_file, err_string(ret));
        return 2;
    }

    for (int i = 0; i < cfg.num_svcs; i++) {
        ret = runsvc(&cfg.svcs[i]);
        if (ret) {
            fprintf(stderr, "Service terminated: %s\n", err_string(ret));
            return 3;
        }
    }

    return 0;
}
开发者ID:frenche,项目名称:gss-tunnel,代码行数:55,代码来源:gsstunnel.c


示例18: setKickstartNfs

void setKickstartNfs(struct loaderData_s * loaderData, int argc,
                     char ** argv) {
    char * host = NULL, * dir = NULL, * mountOpts = NULL;
    char *substr = NULL;
    poptContext optCon;
    int rc;
    struct poptOption ksNfsOptions[] = {
        { "server", '\0', POPT_ARG_STRING, &host, 0, NULL, NULL },
        { "dir", '\0', POPT_ARG_STRING, &dir, 0, NULL, NULL },
        { "opts", '\0', POPT_ARG_STRING, &mountOpts, 0, NULL, NULL},
        { 0, 0, 0, 0, 0, 0, 0 }
    };

    logMessage(INFO, "kickstartFromNfs");
    optCon = poptGetContext(NULL, argc, (const char **) argv, ksNfsOptions, 0);
    if ((rc = poptGetNextOpt(optCon)) < -1) {
        startNewt();
        newtWinMessage(_("Kickstart Error"), _("OK"),
                       _("Bad argument to NFS kickstart method "
                         "command %s: %s"),
                       poptBadOption(optCon, POPT_BADOPTION_NOALIAS), 
                       poptStrerror(rc));
        return;
    }

    if (!host || !dir) {
        logMessage(ERROR, "host and directory for nfs kickstart not specified");
        return;
    }

    loaderData->method = METHOD_NFS;

    substr = strstr(dir, ".img");
    if (!substr || (substr && *(substr+4) != '\0')) {
        if (asprintf(&(loaderData->instRepo), "nfs:%s:%s", host, dir) == -1) {
            logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
            abort();
        }

        logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
                   host, dir, mountOpts);
    } else {
        loaderData->stage2Data = calloc(sizeof(struct nfsInstallData *), 1);
        ((struct nfsInstallData *)loaderData->stage2Data)->host = host;
        ((struct nfsInstallData *)loaderData->stage2Data)->directory = dir;
        ((struct nfsInstallData *)loaderData->stage2Data)->mountOpts = mountOpts;

        logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
                   ((struct nfsInstallData *) loaderData->stage2Data)->host,
                   ((struct nfsInstallData *) loaderData->stage2Data)->directory,
                   ((struct nfsInstallData *) loaderData->stage2Data)->mountOpts);
    }
}
开发者ID:redoop,项目名称:installer-redoop,代码行数:53,代码来源:nfsinstall.c


示例19: setKickstartUrl

void setKickstartUrl(struct loaderData_s * loaderData, int argc,
		    char ** argv) {

    char *url = NULL, *substr = NULL;
    poptContext optCon;
    int rc;
    struct poptOption ksUrlOptions[] = {
        { "url", '\0', POPT_ARG_STRING, &url, 0, NULL, NULL },
        { 0, 0, 0, 0, 0, 0, 0 }
    };

    logMessage(INFO, "kickstartFromUrl");
    optCon = poptGetContext(NULL, argc, (const char **) argv, ksUrlOptions, 0);
    if ((rc = poptGetNextOpt(optCon)) < -1) {
        startNewt();
        newtWinMessage(_("Kickstart Error"), _("OK"),
                       _("Bad argument to Url kickstart method "
                         "command %s: %s"),
                       poptBadOption(optCon, POPT_BADOPTION_NOALIAS), 
                       poptStrerror(rc));
        return;
    }

    if (!url) {
        newtWinMessage(_("Kickstart Error"), _("OK"),
                       _("Must supply a --url argument to Url kickstart method."));
        return;
    }

    /* determine install type */
    if (strstr(url, "http://") || strstr(url, "ftp://"))
	loaderData->method = METHOD_URL;
    else {
        newtWinMessage(_("Kickstart Error"), _("OK"),
                       _("Unknown Url method %s"), url);
        return;
    }

    substr = strstr(url, ".img");
    if (!substr || (substr && *(substr+4) != '\0')) {
        loaderData->instRepo = strdup(url);
    } else {
        if ((loaderData->stage2Data = calloc(sizeof(struct urlInstallData *), 1)) == NULL)
            return;

        ((struct urlInstallData *)loaderData->stage2Data)->url = url;
    }

    logMessage(INFO, "results of url ks, url %s", url);
}
开发者ID:redoop,项目名称:installer-redoop,代码行数:50,代码来源:urlinstall.c


示例20: parse_libs_private

static void
parse_libs_private (Package *pkg, const char *str, const char *path)
{
  /*
    List of private libraries.  Private libraries are libraries which
    are needed in the case of static linking or on platforms not
    supporting inter-library dependencies.  They are not supposed to
    be used for libraries which are exposed through the library in
    question.  An example of an exposed library is GTK+ exposing Glib.
    A common example of a private library is libm.
    
    Generally, if include another library's headers in your own, it's
    a public dependency and not a private one.
  */
  
  char *trimmed;
  char **argv = NULL;
  int argc = 0;
  int result;
  
  if (pkg->libs_private_num > 0)
    {
      verbose_error ("Libs.private field occurs twice in '%s'\n", path);

      exit (1);
    }
  
  trimmed = trim_and_sub (pkg, str, path);

  if (trimmed && *trimmed)
    {
      result = poptParseArgvString (trimmed, &argc, &argv);

      if (result < 0)
        {
          verbose_error ("Couldn't parse Libs.private field into an argument vector: %s\n",
                         poptStrerror (result));

          exit (1);
        }
    }

  _do_parse_libs(pkg, argc, argv);

  g_free (argv);
  g_free (trimmed);

  pkg->libs_private_num++;
}
开发者ID:bennoleslie,项目名称:pkg-config,代码行数:49,代码来源:parse.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ poptab函数代码示例发布时间:2022-05-30
下一篇:
C++ poptSetOtherOptionHelp函数代码示例发布时间: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