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


C++ config_get_value函数代码示例

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


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

示例1: load_config

int load_config(char *config)
{
	char buffer[512];
	int ret;

	if ((ret = config_open(config)) < 0)
	{
		// failed to load
		printf("\x1B[31mFailed to read config %s [%d]\033[0m\n", config, ret);
		return -2;
	}

	// read Router id
	config_get_value("router-id", buffer);
	router_id = atoi(buffer);

	// read Input ports
	config_get_value("input-ports", input_ports);

	// read outputs
	config_get_value("outputs", output_dest);

	// close config file and destroy memory
	config_close();

	return 0;

}
开发者ID:eamars,项目名称:Rip-Router-Simulator,代码行数:28,代码来源:router.c

示例2: config_get_logfiles

void config_get_logfiles(serverConfig_t *config, const char * const service)
{
	field_t val;

	/* logfile */
	config_get_value("logfile", service, val);
	if (! strlen(val))
		g_strlcpy(config->log,DEFAULT_LOG_FILE, FIELDSIZE);
	else
		g_strlcpy(config->log, val, FIELDSIZE);
	assert(config->log);

	/* errorlog */
	config_get_value("errorlog", service, val);
	if (! strlen(val))
		g_strlcpy(config->error_log,DEFAULT_ERROR_LOG, FIELDSIZE);
	else
		g_strlcpy(config->error_log, val, FIELDSIZE);
	assert(config->error_log);

	/* pid directory */
	config_get_value("pid_directory", service, val);
	if (! strlen(val))
		g_strlcpy(config->pid_dir, DEFAULT_PID_DIR, FIELDSIZE);
	else
		g_strlcpy(config->pid_dir, val, FIELDSIZE);
	assert(config->pid_dir);
}
开发者ID:alniaky,项目名称:dbmail,代码行数:28,代码来源:dm_config.c

示例3: set_tab_miscellaneous_settings

static void set_tab_miscellaneous_settings(GuPrefsGui* prefs)
{
  GtkTreeModel* combo_lang = 0;
  GtkTreeIter iter;
  const gchar* lang = 0;
  gint count = 0;
  gboolean valid = FALSE;

  combo_lang = gtk_combo_box_get_model(GTK_COMBO_BOX(prefs->combo_languages));
  lang = config_get_value("spell_language");
  valid = gtk_tree_model_get_iter_first(combo_lang, &iter);

  while (valid) {
    const gchar* str_value;
    gtk_tree_model_get(combo_lang, &iter, 0, &str_value, -1);
    if (STR_EQU(lang, str_value)) {
      gtk_combo_box_set_active(GTK_COMBO_BOX(prefs->combo_languages), count);
      break;
    }
    ++count;
    valid = gtk_tree_model_iter_next(combo_lang, &iter);
  }

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs->autoexport),
                               TO_BOOL(config_get_value("autoexport")));

}
开发者ID:aitjcize,项目名称:Gummi,代码行数:27,代码来源:gui-prefs.c

示例4: sort_sieve_get_config

static void sort_sieve_get_config(struct sort_sieve_config *sieve_config)
{
	field_t val;

	assert(sieve_config != NULL);

	sieve_config->vacation = 0;
	sieve_config->notify = 0;
	sieve_config->debug = 0;

	config_get_value("SIEVE_VACATION", "DELIVERY", val);
	if (strcasecmp(val, "yes") == 0) {
		sieve_config->vacation = 1;
	}

	config_get_value("SIEVE_NOTIFY", "DELIVERY", val);
	if (strcasecmp(val, "yes") == 0) {
		sieve_config->notify= 1;
	}

	config_get_value("SIEVE_DEBUG", "DELIVERY", val);
	if (strcasecmp(val, "yes") == 0) {
		sieve_config->debug = 1;
	}
}
开发者ID:alniaky,项目名称:dbmail,代码行数:25,代码来源:sortsieve.c

示例5: project_create_new

gboolean project_create_new(const gchar* filename)
{
  const gchar* version = g_strdup("0.6.0");
  const gchar* csetter = config_get_value("typesetter");
  const gchar* csteps = config_get_value("compile_steps");
  const gchar* rootfile = g_active_editor->filename;
  // TODO: do we need to encode this text?
  const gchar* content = g_strdup_printf("version=%s\n"
                                         "typesetter=%s\n"
                                         "steps=%s\n"
                                         "root=%s\n",
                                         version, csetter, csteps, rootfile);

  if (!STR_EQU(filename + strlen(filename) - 6, ".gummi")) {
    filename = g_strdup_printf("%s.gummi", filename);
  }

  statusbar_set_message(g_strdup_printf("Creating project file: %s",
                                        filename));
  utils_set_file_contents(filename, content, -1);

  gummi->project->projfile = g_strdup(filename);

  return TRUE;
}
开发者ID:aitjcize,项目名称:Gummi,代码行数:25,代码来源:project.c

示例6: fetch_config_values

/*
 * Get current configuration parameters.
 */
static void fetch_config_values (void)
{
  db_host = config_get_value("db_host");
  db_name = config_get_value("db_name");
  db_user = config_get_value("db_user");
  db_passwd = config_get_value("db_passwd");
  ticker_home = config_get_value("ticker_home");
  pid_file = config_get_value("pid_file");
  ticker_state = config_get_value("ticker_state");
  debug_logfile = config_get_value("debug_logfile");
  error_logfile = config_get_value("error_logfile");
  msg_logfile = config_get_value("msg_logfile");
  tick_interval = config_get_long_value("tick_interval");
  sleep_time = config_get_long_value("sleep_time");
}
开发者ID:microlefes,项目名称:Game,代码行数:18,代码来源:ticker.c

示例7: publish_handle_periodic_timer_expire

/**
 * This function will check if wee need to send refresh PUBLISH. 
 * If so, it will send refresh PUBLISH
 *
 * @param[in] none
 *
 * @return none
 */
void publish_handle_periodic_timer_expire (void)
{
    static const char fname[] = "publish_handle_periodic_timer_expire";
    int                 delta = 0;
    ccsip_publish_cb_t *pcb_p;
    pub_req_t           msg;

    config_get_value(CFGID_TIMER_SUBSCRIBE_DELTA, &delta,
                     sizeof(delta));
    pcb_p = (ccsip_publish_cb_t *)sll_next(s_PCB_list, NULL);
    while (pcb_p != NULL) {
        if (pcb_p->outstanding_trxn == FALSE) {
            if (pcb_p->hb.expires >= TMR_PERIODIC_PUBLISH_INTERVAL) {
                pcb_p->hb.expires -= TMR_PERIODIC_PUBLISH_INTERVAL;
            }
            if (pcb_p->hb.expires <= (delta + TMR_PERIODIC_PUBLISH_INTERVAL)) {
                CCSIP_DEBUG_TASK(DEB_F_PREFIX"sending REFRESH PUBLISH", DEB_F_PREFIX_ARGS(SIP_PUB, fname));
                memset (&msg, 0, sizeof(msg));
                /* refresh is triggered by NULL event data and non-zero expires value */
                msg.pub_handle = pcb_p->pub_handle;
                msg.expires = pcb_p->hb.orig_expiration;
                (void)publish_handle_ev_app_publish(&msg);               
            }
        }
        pcb_p = (ccsip_publish_cb_t *)sll_next(s_PCB_list, pcb_p);
    }
}
开发者ID:LyeSS,项目名称:mozilla-central,代码行数:35,代码来源:ccsip_publish.c

示例8: dp_init_dialing_data

/*
 *  Function: dp_start_dialing()
 *
 *  Parameters: line - line number
 *                                call_id - call indentification
 *
 *  Description: Start dialing and initilize dialing data.
 *
 *  Returns: none
 */
static void
dp_init_dialing_data (line_t line, callid_t call_id)
{
    const char fname[] = "dp_init_dialing_data";

    DPINT_DEBUG(DEB_F_PREFIX"line=%d call_id=%d\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line, call_id);

    g_dp_int.call_id = call_id;
    g_dp_int.line = line;
    g_dp_int.gDialplanDone = FALSE;
    g_dp_int.url_dialing = FALSE;
    g_dp_int.gTimerType = DP_NONE_TIMER;

    memset(g_dp_int.gDialed, 0, sizeof(g_dp_int.gDialed));

    /* get offhook timeout */
    g_dp_int.offhook_timeout = DIAL_TIMEOUT;

    config_get_value(CFGID_OFFHOOK_TO_FIRST_DIGIT_TIMER,
                     &g_dp_int.offhook_timeout,
                     sizeof(g_dp_int.offhook_timeout));

    /* Flush any collected KPML digits on this line */
    kpml_flush_quarantine_buffer(line, call_id);
}
开发者ID:LyeSS,项目名称:mozilla-central,代码行数:35,代码来源:dialplanint.c

示例9: config_get_platform_file

inline const char *
config_get_platform_file(void)
{
    const char *request = "/config/global/file[@type=\"platform\"]/text()";
    //const char *ko = "XPathError: /config/global/file[@type=\"platform\"]/text()";
    const char *platform_file = config_get_value(request);
    
#ifdef VERBOSE
    fprintf(stderr, "Platform file : ");
#endif
    if (!platform_file) {
#ifdef VERBOSE
        fprintf(stderr, "failed\n");
        //fprintf(stderr, ko);
#endif
        
        free(config);
        exit(2);
    } else {
#ifdef VERBOSE
        fprintf(stderr, "%s\n", platform_file);
#endif
        return platform_file;
    }    
}
开发者ID:frs69wq,项目名称:Simbatch,代码行数:25,代码来源:simbatch_config.c

示例10: config_get_deployment_file

inline const char *
config_get_deployment_file(void)
{
    const char *deployment_file;
    const char *request = "/config/global/file[@type=\"deployment\"]/text()";
    //char *ko = "XPathError: /config/global/file[@type=\"deployment\"]/text()";
#ifdef VERBOSE
    fprintf(stderr, "Deployment file : ");
#endif
    
    deployment_file = config_get_value(request);
    if (!deployment_file) {
#ifdef VERBOSE
        fprintf(stderr, "failed\n");
        //fprintf(stderr, ko);
#endif
        free(config);
        exit(2);
    } else {
#ifdef VERBOSE
        fprintf(stderr, "%s\n", deployment_file);
#endif
        return deployment_file;
    }    
}
开发者ID:frs69wq,项目名称:Simbatch,代码行数:25,代码来源:simbatch_config.c

示例11: scan_start

int scan_start()
{
  pthread_mutex_lock(&scan_mutex);
  if (thread_running) {
    /* Signal the scan thread to restart scanning */
    musicd_log(LOG_VERBOSE, "scan", "signaling to restart scan");
    restart = 1;
    interrupted = 1;
    pthread_mutex_unlock(&scan_mutex);
    return 0;
  }
  pthread_mutex_unlock(&scan_mutex);

  if (!config_get_value("music-directory")) {
    musicd_log(LOG_WARNING, "scan", "music-directory not set, no scanning");
    return 0;
  }

  thread_running = true;

  if (pthread_create(&scan_thread, NULL, scan_thread_func, NULL)) {
    musicd_perror(LOG_ERROR, "scan", "could not create thread");
    return -1;
  }
  pthread_detach(scan_thread);
  
  return 0;
}
开发者ID:EQ4,项目名称:musicd,代码行数:28,代码来源:scan.c

示例12: send_alert

int send_alert(uint64_t user_idnr, char *subject, char *body)
{
	DbmailMessage *new_message;
	Field_T postmaster;
	char *from;
	int msgflags[IMAP_NFLAGS];

	// Only send each unique alert once a day.
	char *tmp = g_strconcat(subject, body, NULL);
	char *userchar = g_strdup_printf("%" PRIu64 "", user_idnr);
	char handle[FIELDSIZE];

	memset(handle, 0, sizeof(handle));
       	dm_md5(tmp, handle);
	if (db_replycache_validate(userchar, "send_alert", handle, 1) != DM_SUCCESS) {
		TRACE(TRACE_INFO, "Already sent alert [%s] to user [%" PRIu64 "] today", subject, user_idnr);
		g_free(userchar);
		g_free(tmp);
		return 0;
	} else {
		TRACE(TRACE_INFO, "Sending alert [%s] to user [%" PRIu64 "]", subject, user_idnr);
		db_replycache_register(userchar, "send_alert", handle);
		g_free(userchar);
		g_free(tmp);
	}

	// From the Postmaster.
	if (config_get_value("POSTMASTER", "DBMAIL", postmaster) < 0) {
		TRACE(TRACE_NOTICE, "no config value for POSTMASTER");
	}
	if (strlen(postmaster))
		from = postmaster;
	else
		from = DEFAULT_POSTMASTER;

	// Set the \Flagged flag.
	memset(msgflags, 0, sizeof(msgflags));
	msgflags[IMAP_FLAG_FLAGGED] = 1;

	// Get the user's login name.
	char *to = auth_get_userid(user_idnr);

	new_message = dbmail_message_new(NULL);
	new_message = dbmail_message_construct(new_message, to, from, subject, body);

	// Pre-insert the message and get a new_message->id
	dbmail_message_store(new_message);
	uint64_t tmpid = new_message->id;

	if (sort_deliver_to_mailbox(new_message, user_idnr,
			"INBOX", BOX_BRUTEFORCE, msgflags, NULL) != DSN_CLASS_OK) {
		TRACE(TRACE_ERR, "Unable to deliver alert [%s] to user [%" PRIu64 "]", subject, user_idnr);
	}

	g_free(to);
	db_delete_message(tmpid);
	dbmail_message_free(new_message);

	return 0;
}
开发者ID:cDoru,项目名称:dbmail,代码行数:60,代码来源:sortsieve.c

示例13: latex_method_active

gboolean latex_method_active(gchar* method)
{
  if (STR_EQU(config_get_value("compile_steps"), method)) {
    return TRUE;
  }
  return FALSE;
}
开发者ID:aitjcize,项目名称:Gummi,代码行数:7,代码来源:latex.c

示例14: platform_get_ipv4_address

/**
 * give the platform IPV4 IP address.
 *
 * @param[in/out] ip_addr - pointer to the cpr_ip_addr_t. The
 *                          result IP address will be populated in this
 *                          structure.
 *
 * @return  None.
 */
void
platform_get_ipv4_address (cpr_ip_addr_t *ip_addr)
{
    config_get_value(CFGID_MY_IP_ADDR, ip_addr, sizeof(cpr_ip_addr_t));
    ip_addr->type = CPR_IP_ADDR_IPV4;

    return;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:17,代码来源:misc.c

示例15: config_get_adaptorlist

WFTK_ADAPTORLIST * config_get_adaptorlist (void * session, int adaptor_class)
{
   const char * spec = "";
   int adaptors = 1;
   int i;
   const char * mark;
   char * mark2;
   char adaptorbuffer[256]; /* TODO: another dang static buffer.  Fix it. */
   WFTK_ADAPTORLIST * list;

   switch (adaptor_class) {
      case TASKINDEX:
         spec = config_get_value (session, "taskindex.always");
         break;
      case NOTIFY:
         spec = config_get_value (session, "notify.always");
         break;
      default:
         return (WFTK_ADAPTORLIST *) 0;
   }

   if (!*spec) return (WFTK_ADAPTORLIST *) 0;

   /* First pass: count semicolons, so we know how large a list structure to allocate. */
   mark = spec;
   do {
      mark = strchr (mark, ';');
      if (!mark) break;
      adaptors++; mark++;
   } while (mark);

   list = (WFTK_ADAPTORLIST *) malloc (sizeof (WFTK_ADAPTOR_LIST) + adaptors * sizeof (WFTK_ADAPTOR *));
   list->count = adaptors;

   for (i=0, mark = spec; i < adaptors; i++) {
      strcpy (adaptorbuffer, mark);
      mark = strchr(mark, ';');
      if (mark) { mark++; while (*mark == ' ') mark++; }
      mark2 = strchr (adaptorbuffer, ';');
      if (mark2) *mark2 = '\0';

      list->ads[i] = wftk_get_adaptor (session, adaptor_class, adaptorbuffer);
   }

   return (list);
}
开发者ID:luxpir,项目名称:vivtek.github.com,代码行数:46,代码来源:config.c


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