Пример #1
0
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;

}
Пример #2
0
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);
}
Пример #3
0
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")));

}
Пример #4
0
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;
	}
}
Пример #5
0
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;
}
Пример #6
0
/*
 * 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");
}
Пример #7
0
/**
 * 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);
    }
}
Пример #8
0
XML * DSREP_localxml_init (WFTK_ADAPTOR * ad, va_list args) {
    struct stat statbuf;
    const char * parms;
    char directory[256];
    char * end;

    parms = xml_attrval (ad->parms, "parm");
    if (!*parms) parms = config_get_value (ad->session, "dsrep.localxml.directory");

    /* Check for existence, return error if the directory doesn't exist or if it isn't a directory. */
    strcpy (directory, parms);
    end = directory + strlen (directory) - 1;
    if (*end == '\\') *end = '\0';

    if (stat (directory, &statbuf) == -1) {
        xml_set (ad->parms, "error", "Directory not found.");
        return (XML *) 0;
    }
    if (!(statbuf.st_mode & S_IFDIR)) {
        xml_set (ad->parms, "error", "Directory not directory.");
        return (XML *) 0;
    }

    strcat (directory, "\\");
    xml_set (ad->parms, "dir", directory);
    strcpy (directory, "localxml:");
    strcat (directory, xml_attrval (ad->parms, "dir"));
    xml_set (ad->parms, "spec", directory);
    return (XML *) 0;
}
Пример #9
0
/*
 *  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);
}
Пример #10
0
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;
    }    
}
Пример #11
0
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;
    }    
}
Пример #12
0
Файл: scan.c Проект: EQ4/musicd
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;
}
Пример #13
0
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;
}
Пример #14
0
gboolean latex_method_active(gchar* method)
{
  if (STR_EQU(config_get_value("compile_steps"), method)) {
    return TRUE;
  }
  return FALSE;
}
Пример #15
0
/**
 * 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;
}
Пример #16
0
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);
}
Пример #17
0
static void set_tab_preview_settings(GuPrefsGui* prefs)
{

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

  if (!config_get_value("compile_status"))
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->compile_timer), FALSE);

  gtk_spin_button_set_value(prefs->compile_timer,
                            atoi(config_get_value("compile_timer")));
  /* compile scheme */
  if (STR_EQU(config_get_value("compile_scheme"), "real_time"))
    gtk_combo_box_set_active(prefs->compile_scheme, 1);

  if (STR_EQU(config_get_value("animated_scroll"), "always")) {
    gtk_combo_box_set_active(prefs->combo_animated_scroll, 0);
  } else if (STR_EQU(config_get_value("animated_scroll"), "never")) {
    gtk_combo_box_set_active(prefs->combo_animated_scroll, 2);
  } else {
    gtk_combo_box_set_active(prefs->combo_animated_scroll, 1);
  }

  gtk_spin_button_set_value(prefs->spin_cache_size,
                            atoi(config_get_value("cache_size")));
}
Пример #18
0
GuLatex* latex_init(void)
{
  GuLatex* l = g_new0(GuLatex, 1);
  l->compilelog = NULL;
  l->modified_since_compile = FALSE;

  l->tex_version = texlive_init();
  rubber_init();
  latexmk_init();

  /* TODO: Temp hard set of compilation options for migrating configs */
  if (strlen(config_get_value("typesetter")) == 0)
    config_set_value("typesetter", "pdflatex");
  if (strlen(config_get_value("compile_steps")) == 0)
    config_set_value("compile_steps", "texpdf");

  return l;
}
Пример #19
0
/**
 * Get active mac address if required
 *
 * @param addr - mac address string (OUTPUT)
 *
 * @return none
 */
void
platform_get_active_mac_address (unsigned char *addr)
{
    config_get_value(CFGID_MY_ACTIVE_MAC_ADDR, addr, 6);
    TNP_DEBUG(DEB_F_PREFIX"ActiveMacAddr:from Get Val: %04x:%04x:%04x",
            DEB_F_PREFIX_ARGS(PLAT_API, "platform_get_mac_address"),
              addr[0] * 256 + addr[1], addr[2] * 256 + addr[3],
              addr[4] * 256 + addr[5]);
}
Пример #20
0
void qc_module_init( qc_module_type * qc_module , const config_type * config) {
  if (config_item_set( config , QC_PATH_KEY )) 
    qc_module_set_path( qc_module , config_get_value( config , QC_PATH_KEY ));
  
  if (config_item_set( config , QC_WORKFLOW_KEY)) {
    const char * qc_workflow = config_get_value_as_path(config , QC_WORKFLOW_KEY);
    qc_module_set_workflow( qc_module , qc_workflow );
  }
}
Пример #21
0
static void set_tab_compilation_settings(GuPrefsGui* prefs)
{
  /* Setting available typesetters and the active one */
  /* TODO: iterate the available typesetter list and gtk_builder the objects
   * maybe.. or not.. */


  if (pdflatex_detected()) {
    if (pdflatex_active())
      gtk_toggle_button_set_active(prefs->typ_pdflatex, TRUE);
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->typ_pdflatex), TRUE);
    gtk_widget_set_tooltip_text(GTK_WIDGET(prefs->typ_pdflatex), "");
  }

  if (xelatex_detected()) {
    if (xelatex_active())
      gtk_toggle_button_set_active(prefs->typ_xelatex, TRUE);
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->typ_xelatex), TRUE);
    gtk_widget_set_tooltip_text(GTK_WIDGET(prefs->typ_xelatex), "");
  }

  if (rubber_detected()) {
    if (rubber_active())
      gtk_toggle_button_set_active(prefs->typ_rubber, TRUE);
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->typ_rubber), TRUE);
    gtk_widget_set_tooltip_text(GTK_WIDGET(prefs->typ_rubber), "");
  }

  if (latexmk_detected()) {
    if (latexmk_active())
      gtk_toggle_button_set_active(prefs->typ_latexmk, TRUE);
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->typ_latexmk), TRUE);
    gtk_widget_set_tooltip_text(GTK_WIDGET(prefs->typ_latexmk), "");
  }

  if (latex_method_active("texpdf")) {
    gtk_toggle_button_set_active(prefs->method_texpdf, TRUE);
  } else if (latex_method_active("texdvipdf")) {
    gtk_toggle_button_set_active(prefs->method_texdvipdf, TRUE);
  } else if (latex_method_active("texdvipspdf")) {
    gtk_toggle_button_set_active(prefs->method_texdvipspdf, TRUE);
  }

  if (!latex_use_shellescaping())
    gtk_toggle_button_set_active(prefs->opt_shellescape, FALSE);
  else {
    gtk_toggle_button_set_active(prefs->opt_shellescape, TRUE);
  }

  if (latex_can_synctex()) {
    if (config_get_value("synctex")) {
      gtk_toggle_button_set_active(prefs->opt_synctex, TRUE);
    } else {
      gtk_toggle_button_set_active(prefs->opt_synctex, FALSE);
    }
  }
}
Пример #22
0
static void set_tab_view_settings(GuPrefsGui* prefs)
{
  gboolean value = FALSE;

  value = TO_BOOL(config_get_value("textwrapping"));
  if (value) {
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs->textwrap_button),
                                 value);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs->wordwrap_button),
                                 TO_BOOL(config_get_value("wordwrapping")));
  } else
    gtk_widget_set_sensitive(GTK_WIDGET(prefs->wordwrap_button), FALSE);

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

}
Пример #23
0
/*
 *  Function: config_get_line_value()
 *
 *  Parameters: id - The id of the config value to get
 *              *buffer - Empty buffer where value will be copied
 *              length - The number of bytes to get
 *              line - The line that the ID is associated with
 *
 *  Description: Get any arbitrary line config entry as a raw data value.
 *    If the length doesn't match the actual length of the field,
 *    nothing will be copied.
 *
 *  Returns: None
 */
void
config_get_line_value (int id, void *buffer, int length, int line)
{
    int line_id = 0;

    line_id = config_get_line_id(id, line);
    if (line_id) {
        config_get_value(line_id, buffer, length);
    }
}
Пример #24
0
static gboolean Request_basic_auth(T R)
{
	const char *auth;
	Field_T realm;
	memset(realm,0,sizeof(Field_T));
	config_get_value("realm", "HTTP", realm);
	if (! strlen(realm))
		strcpy(realm,"DBMail HTTP Access");

	// authenticate
	if (! (auth = evhttp_find_header(R->req->input_headers, "Authorization"))) {
		TRACE(TRACE_DEBUG,"No authorization header");
		basic_unauth(R, realm);
		return FALSE;
	}
	if (strncmp(auth,"Basic ", 6) == 0) {
		Field_T userpw;
		gsize len;
		guchar *s;
		gchar *safe;
		memset(userpw,0,sizeof(Field_T));
		config_get_value("admin", "HTTP", userpw);
		auth+=6;
		TRACE(TRACE_DEBUG, "auth [%s]", auth);
		s = g_base64_decode(auth, &len);
		safe = g_strndup((char *)s, (gsize)len);
		g_free(s);
		TRACE(TRACE_DEBUG,"Authorization [%" PRIu64 "][%s] <-> [%s]", (uint64_t)len, safe, userpw);
		if ((strlen(userpw) != strlen(safe)) || (strncmp(safe,(char *)userpw,strlen(userpw))!=0)) {
			if (! Request_user_auth(R, safe)) {
				TRACE(TRACE_DEBUG,"Authorization failed");
				basic_unauth(R, realm);
				g_free(safe);
				return FALSE;
			}
		}
		g_free(safe);
	} else {
		return FALSE;
	}
	return TRUE;
}
static int prefer_image(struct config *config)
{
	const char *v = config_get_value(config, "x11", "prefer-image");

	if (v == NULL)
		return 0;
	if (*v == '\0')
		return 1;

	return atoi(v);
}
Пример #26
0
/**
 * Check the configuration objects have valid parameters
 */
static void
check_config_objects(CONFIG_CONTEXT *context)
{
CONFIG_CONTEXT		*obj;
CONFIG_PARAMETER 	*params;
char			*type, **param_set;
int			i;

	/**
	 * Process the data and create the services and servers defined
	 * in the data.
	 */
	obj = context;
	while (obj)
	{
		param_set = NULL;
		if (obj->parameters &&
			(type = config_get_value(obj->parameters, "type")))
		{
			if (!strcmp(type, "service"))
				param_set = service_params;
			else if (!strcmp(type, "server"))
				param_set = server_params;
			else if (!strcmp(type, "listener"))
				param_set = listener_params;
			else if (!strcmp(type, "monitor"))
				param_set = monitor_params;
		}
		if (param_set != NULL)
		{
			params = obj->parameters;
			while (params)
			{
				int found = 0;
				for (i = 0; param_set[i]; i++)
					if (!strcmp(params->name, param_set[i]))
						found = 1;
				if (found == 0)
					LOGIF(LE, (skygw_log_write_flush(
                                                LOGFILE_ERROR,
                                                "Error : Unexpected parameter "
                                                "'%s' for object '%s' of type "
                                                "'%s'.",
						params->name,
                                                obj->object,
                                                type)));
				params = params->next;
			}
		}
		obj = obj->next;
	}
}
Пример #27
0
void plot_config_init(plot_config_type * plot_config , const config_type * config ) {
  if (config_item_set( config , PLOT_PATH_KEY))
    plot_config_set_path( plot_config , config_get_value( config , PLOT_PATH_KEY ));

  if (config_item_set( config , PLOT_DRIVER_KEY))
    plot_config_set_driver( plot_config , config_get_value( config , PLOT_DRIVER_KEY ));
  
  if (config_item_set( config , IMAGE_VIEWER_KEY))
    plot_config_set_viewer( plot_config , config_get_value( config , IMAGE_VIEWER_KEY ));

  if (config_item_set( config , PLOT_DRIVER_KEY))
    plot_config_set_driver( plot_config , config_get_value( config , PLOT_DRIVER_KEY ));
  
  if (config_item_set( config , PLOT_ERRORBAR_MAX_KEY))
    plot_config_set_errorbar_max( plot_config , config_get_value_as_int( config , PLOT_ERRORBAR_MAX_KEY ));
  
  if (config_item_set( config , PLOT_ERRORBAR_KEY))
    plot_config_set_plot_errorbar( plot_config , config_get_value_as_bool( config , PLOT_ERRORBAR_KEY ));  

  if (config_item_set( config , PLOT_HEIGHT_KEY))
    plot_config_set_height( plot_config , config_get_value_as_int( config , PLOT_HEIGHT_KEY ));

  if (config_item_set( config , PLOT_WIDTH_KEY))
    plot_config_set_width( plot_config , config_get_value_as_int( config , PLOT_WIDTH_KEY ));

  if (config_item_set( config , PLOT_REFCASE_KEY)) {
    const char * plot_refcase_string = config_get_value( config , PLOT_REFCASE_KEY );
    bool plot_refcase;
    if (!util_sscanf_bool( plot_refcase_string , &plot_refcase)) {
      fprintf(stderr ,
              "Warning: The PLOT_REFCASE option should have value True | False. The value:%s will be interpreted as True" , 
              plot_refcase_string);

      plot_refcase = true;
    }
    plot_config_set_plot_refcase( plot_config , plot_refcase );
  }
}
Пример #28
0
/**
 * Returns the configured value of preferred codec. The codec may
 * or may not be available by the platform.
 *
 * @param[in] none.
 *
 * @return rtp_ptype of the codec.
 */
rtp_ptype
sip_config_preferred_codec (void)
{
    key_table_entry_t cfg_preferred_codec;

    config_get_value(CFGID_PREFERRED_CODEC, &cfg_preferred_codec,
                     sizeof(cfg_preferred_codec));
    if ((cfg_preferred_codec.name != NULL) &&
        (cfg_preferred_codec.name[0] != '\0')) {
        /* The configuration has preferred codec configured */
        return (cfg_preferred_codec.value);
    }
    /* No preferred codec configured */
    return (RTP_NONE);
}
Пример #29
0
void latex_update_auxfile(GuLatex* lc, GuEditor* ec)
{
  gchar* dirname = g_path_get_dirname(ec->targetfile);
  gchar* command = g_strdup_printf("%s %s "
                                   "--draftmode "
                                   "-interaction=nonstopmode "
                                   "--output-directory=\"%s\" \"%s\"",
                                   C_TEXSEC,
                                   config_get_value("typesetter"),
                                   C_TMPDIR,
                                   ec->targetfile);
  Tuple2 res = utils_popen_r(command, dirname);
  g_free(dirname);
  g_free(res.second);
  g_free(command);
}
Пример #30
0
inline const char *
config_get_trace_file(void)
{
    const char *trace_file;
    const char *request = "/config/global/file[@type=\"trace\"]/text()";
    
    trace_file = config_get_value(request);
    
#ifdef VERBOSE
    if (!trace_file)
        fprintf(stderr, "Trace file : None\n");
    else
        fprintf(stderr, "Trace file : %s\n", trace_file);
#endif
    
    return trace_file;
}