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


C++ set_option函数代码示例

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


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

示例1: recdirectory

static bool recdirectory(void)
{
    static const struct opt_items names[] = {
        { rec_base_directory, -1 },
        { STR(LANG_RECORD_CURRENT_DIR) }
    };
    return set_option(str(LANG_RECORD_DIRECTORY),
                      &global_settings.rec_directory, INT,
                      names, 2, NULL );
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:10,代码来源:sound_menu.c

示例2: recchannels

static bool recchannels(void)
{
    static const struct opt_items names[] = {
        { STR(LANG_CHANNEL_STEREO) },
        { STR(LANG_CHANNEL_MONO) }
    };
    return set_option(str(LANG_RECORDING_CHANNELS),
                      &global_settings.rec_channels, INT,
                      names, 2, NULL );
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:10,代码来源:sound_menu.c

示例3: main

int main(int argc, char *argv[])
{
	int i=1;
	for (;i<argc; ++i)
		set_option(argv[i]);

	load_configure();
	nodenet_startup();
	return 0;
}
开发者ID:huairen,项目名称:nodenet,代码行数:10,代码来源:main.c

示例4: imap_wait_keepalive

int imap_wait_keepalive (pid_t pid)
{
  struct sigaction oldalrm;
  struct sigaction act;
  sigset_t oldmask;
  int rc;

  short imap_passive = option (OPTIMAPPASSIVE);

  set_option (OPTIMAPPASSIVE);
  set_option (OPTKEEPQUIET);

  sigprocmask (SIG_SETMASK, NULL, &oldmask);

  sigemptyset (&act.sa_mask);
  act.sa_handler = alrm_handler;
#ifdef SA_INTERRUPT
  act.sa_flags = SA_INTERRUPT;
#else
  act.sa_flags = 0;
#endif

  sigaction (SIGALRM, &act, &oldalrm);

  alarm (ImapKeepalive);
  while (waitpid (pid, &rc, 0) < 0 && errno == EINTR)
  {
    alarm (0); /* cancel a possibly pending alarm */
    imap_keepalive ();
    alarm (ImapKeepalive);
  }

  alarm (0);	/* cancel a possibly pending alarm */

  sigaction (SIGALRM, &oldalrm, NULL);
  sigprocmask (SIG_SETMASK, &oldmask, NULL);

  unset_option (OPTKEEPQUIET);
  if (!imap_passive)
    unset_option (OPTIMAPPASSIVE);

  return rc;
}
开发者ID:jakobmatthes,项目名称:mutt-debian,代码行数:43,代码来源:util.c

示例5: options_menu

//{{{
void options_menu(void)
{
	int choice;
	int old_value, new_value;
	int change_made = 0;
	
	setTabStops(options_menu_tabs);
	UI_Menu_Set_Persist(1);
	while(1) {
#ifdef OPTIONS_SUBMENUS
		choice = UI_Menu_Pick(options_rect, count_options()+OPTIONS_SUBMENUS,
		                      &cb_options_menu);
		if(choice>=0 && choice<OPTIONS_SUBMENUS) {
			pick_submenu(choice);
			change_made = 1;
			continue;
		} else {
			choice -= OPTIONS_SUBMENUS;
		}
#else
		choice = UI_Menu_Pick(options_rect, count_options(), &cb_options_menu);
#endif
		
		if(choice<0)
			break;
		old_value = get_option(options[choice].key);
		new_value = (old_value+1) % count_choices(options[choice].choices);
		set_option(options[choice].key, new_value);
		change_made = 1;
		
#ifdef IS_CALCULATOR
		if(options[choice].key == OPTION_GRAYSCALE)
		{
			if(get_option(OPTION_GRAYSCALE) == OPTION_GRAY_ON)
				GrayOnThrow();
			else
				GrayOff();
			if(w->level) // Only if game is started
				full_redraw();
		}
#endif
#ifdef PALMOS
		if(options[choice].key == OPTION_INVERSE)
			init_colors();
#endif
#ifdef REALCOMPUTER
		if(options[choice].key == OPTION_COLOR)
			init_colors();
#endif
	}
	UI_Menu_Set_Persist(0);
	
	if(change_made)
		save_options();
}
开发者ID:flyingfisch,项目名称:PrizmSDK-libfxcg-games,代码行数:56,代码来源:options.c

示例6: start_civetweb

static void start_civetweb(int argc, char *argv[]) {
  struct mg_callbacks callbacks;
  char *options[MAX_OPTIONS];
  int i;

  // Edit passwords file if -A option is specified
  if (argc > 1 && !strcmp(argv[1], "-A")) {
    if (argc != 6) {
      show_usage_and_exit();
    }
    exit(mg_modify_passwords_file(argv[2], argv[3], argv[4], argv[5]) ?
         EXIT_SUCCESS : EXIT_FAILURE);
  }

  // Show usage if -h or --help options are specified
  if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
    show_usage_and_exit();
  }

  options[0] = NULL;
  set_option(options, "document_root", ".");

  // Update config based on command line arguments
  process_command_line_arguments(argv, options);

  // Make sure we have absolute paths for files and directories
  set_absolute_path(options, "document_root", argv[0]);
  set_absolute_path(options, "put_delete_auth_file", argv[0]);
  set_absolute_path(options, "cgi_interpreter", argv[0]);
  set_absolute_path(options, "access_log_file", argv[0]);
  set_absolute_path(options, "error_log_file", argv[0]);
  set_absolute_path(options, "global_auth_file", argv[0]);
  set_absolute_path(options, "ssl_certificate", argv[0]);

  // Make extra verification for certain options
  verify_existence(options, "document_root", 1);
  verify_existence(options, "cgi_interpreter", 0);
  verify_existence(options, "ssl_certificate", 0);

  // Setup signal handler: quit on Ctrl-C
  signal(SIGTERM, signal_handler);
  signal(SIGINT, signal_handler);

  // Start Civetweb
  memset(&callbacks, 0, sizeof(callbacks));
  callbacks.log_message = &log_message;
  ctx = mg_start(&callbacks, NULL, (const char **) options);
  for (i = 0; options[i] != NULL; i++) {
    free(options[i]);
  }

  if (ctx == NULL) {
    die("%s", "Failed to start Civetweb.");
  }
}
开发者ID:DIVYPRAKASH,项目名称:civetweb,代码行数:55,代码来源:main.c

示例7: read_environment

/* Examines any relevant environment variables.  Must be called when in
 * single-thread mode.
 */
static void read_environment ()
{
  Option *o;

  for (o = vars; o->env; o++)
  {
    char *val;
    if ((val = (char *) getenv (o->env)))
      set_option (o, val, "Environment variable", o->env);
  }
}
开发者ID:bringhurst,项目名称:tompi,代码行数:14,代码来源:options.c

示例8: bind_and_listen

 void bind_and_listen(const std::string& port,bool reuse_addr) {
     boost::asio::ip::tcp::resolver resolver(get_io_service());
     boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(),port);
     boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
     open(endpoint.protocol());
     if(reuse_addr) {
         set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
     }
     bind(endpoint);
     listen(boost::asio::socket_base::max_connections);
 }
开发者ID:CuriousBoy0822,项目名称:orchid,代码行数:11,代码来源:acceptor.hpp

示例9: autoloadbookmark

static bool autoloadbookmark(void)
{
    static const struct opt_items names[] = {
        { STR(LANG_SET_BOOL_NO) },
        { STR(LANG_SET_BOOL_YES) },
        { STR(LANG_RESUME_SETTING_ASK) }
    };
    return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOLOAD),
                       &global_settings.autoloadbookmark, INT,
                       names, 3, NULL );
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:11,代码来源:settings_menu.c

示例10: dotogglepickup

int
dotogglepickup(void)
{
    union nh_optvalue val;

    val.b = !flags.pickup;
    set_option("autopickup", val, FALSE);

    pline("Autopickup: %s.", flags.pickup ? "ON" : "OFF");
    return 0;
}
开发者ID:eatnumber1,项目名称:bingehack4,代码行数:11,代码来源:options.c

示例11: set_parameters

static void set_parameters (struct _options *opts, int flags,
			    int argc, const char **argv)
{
    opts->opt_silent                = flags & PAM_SILENT;
    opts->opt_disallow_null_authtok = flags & PAM_DISALLOW_NULL_AUTHTOK;

    while (argc-- > 0) {
	set_option (opts, *argv);
	++argv;
    }
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:11,代码来源:pam_rhosts_auth.c

示例12: useMRB

static bool useMRB(void)
{
    static const struct opt_items names[] = {
        { STR(LANG_SET_BOOL_NO) },
        { STR(LANG_SET_BOOL_YES) },
        { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY) }
    };
    return set_option( str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS),
                       &global_settings.usemrb, INT,
                       names, 3, NULL );
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:11,代码来源:settings_menu.c

示例13: nh_set_option

boolean nh_set_option(const char *name, union nh_optvalue value, boolean isstring)
{
	boolean rv;
	
	if (!api_entry_checkpoint())
	    return FALSE;
	
	rv = set_option(name, value, isstring);
	
	api_exit();
	return rv;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:12,代码来源:options.c

示例14: process_startup_options

/*
 * Process any command-line switches and any additional GUC variable
 * settings passed in the startup packet.
 */
static void process_startup_options(struct session *port, bool am_superuser)
{
	enum guc_ctx gucctx;
	struct list_cell* gucopts;

	gucctx = am_superuser ? PGC_SUSET : PGC_BACKEND;

	/*
	 * First process any command-line switches that were included in the
	 * startup packet, if we are in a regular backend.
	 */
	if (port->cmdline_options != NULL) {
		/*
		 * The maximum possible number of commandline arguments that could
		 * come from port->cmdline_options is (strlen + 1) / 2; see
		 * pg_split_opts().
		 */
		char **av;
		int maxac;
		int ac;

		maxac = 2 + (strlen(port->cmdline_options) + 1) / 2;
		av = (char**) palloc(maxac * sizeof(char *));
		ac = 0;
		av[ac++] = "postgres";

		/* Note this mangles port->cmdline_options */
		pg_split_opts(av, &ac, port->cmdline_options);
		av[ac] = NULL;

		ASSERT(ac < maxac);

		(void) process_postgres_switches(ac, av, gucctx);
	}

	/*
	 * Process any additional GUC variable settings passed in startup packet.
	 * These are handled exactly like command-line variables.
	 */
	gucopts = list_head(port->guc_options);
	while (gucopts) {
		char *name;
		char *value;

		name = lfirst(gucopts);
		gucopts = lnext(gucopts);

		value = lfirst(gucopts);
		gucopts = lnext(gucopts);

		set_option(name, value, gucctx, PGC_S_CLIENT);
	}
}
开发者ID:colinet,项目名称:sqlix,代码行数:57,代码来源:init_post.c

示例15: avc

static bool avc(void)
{
    static const struct opt_items names[] = {
        { STR(LANG_OFF) },
        { "20ms", TALK_ID(20, UNIT_MS) },
        { "2s", TALK_ID(2, UNIT_SEC) },
        { "4s", TALK_ID(4, UNIT_SEC) },
        { "8s", TALK_ID(8, UNIT_SEC) }
    };
    return set_option(str(LANG_DECAY), &global_settings.avc, INT,
                      names, 5, set_avc);
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:12,代码来源:sound_menu.c


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