Esempio n. 1
0
TEST_F(ConfigTest, config_remove_section) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_TRUE(config_remove_section(config, "DID"));
  EXPECT_FALSE(config_has_section(config, "DID"));
  EXPECT_FALSE(config_has_key(config, "DID", "productId"));
  config_free(config);
}
Esempio n. 2
0
static int _appbroker(char const * outfile, char const * filename)
{
	AppBroker appbroker;

	if((appbroker.config = config_new()) == NULL)
		return error_print(APPBROKER_PROGNAME);
	if(config_load(appbroker.config, filename) != 0)
	{
		config_delete(appbroker.config);
		return error_print(APPBROKER_PROGNAME);
	}
	appbroker.prefix = config_get(appbroker.config, NULL, "service");
	if((appbroker.outfile = outfile) == NULL)
		appbroker.fp = stdout;
	else if((appbroker.fp = fopen(outfile, "w")) == NULL)
	{
		config_delete(appbroker.config);
		return error_set_print(APPBROKER_PROGNAME, 1, "%s: %s", outfile,
				strerror(errno));
	}
	_appbroker_head(&appbroker);
	_appbroker_constants(&appbroker);
	_appbroker_calls(&appbroker);
	_appbroker_tail(&appbroker);
	if(outfile != NULL)
		fclose(appbroker.fp);
	config_delete(appbroker.config);
	return 0;
}
Esempio n. 3
0
int camera_save(Camera * camera)
{
	int ret = -1;
	char * filename;
	Config * config;
	char const * sformats[CSF_COUNT] = { NULL, "png", "jpeg" };

	if((filename = _camera_get_config_filename(camera, CAMERA_CONFIG_FILE))
			== NULL)
		return -1;
	if((config = config_new()) != NULL
			&& access(filename, R_OK) == 0
			&& config_load(config, filename) == 0)
	{
		/* XXX may fail */
		_save_variable_bool(camera, config, NULL, "hflip",
				camera->hflip);
		_save_variable_bool(camera, config, NULL, "vflip",
				camera->vflip);
		_save_variable_bool(camera, config, NULL, "ratio",
				camera->ratio);
		_save_variable_string(camera, config, "snapshot", "format",
				sformats[camera->snapshot_format]);
		_save_variable_int(camera, config, "snapshot", "quality",
				camera->snapshot_quality);
		/* FIXME also implement interpolation and overlay images */
		ret = config_save(config, filename);
	}
	if(config != NULL)
		config_delete(config);
	free(filename);
	return ret;
}
Esempio n. 4
0
static int _configure_load(Prefs * prefs, String const * directory,
		configArray * ca)
{
	int ret = 0;
	Config * config;
	String * path;
	String const * subdirs = NULL;

	if((path = string_new(directory)) == NULL)
		return configure_error(directory, 1);
	if(string_append(&path, "/") != 0
			|| string_append(&path, PROJECT_CONF) != 0
			|| (config = config_new()) == NULL)
	{
		string_delete(path);
		return configure_error(directory, 1);
	}
	config_set(config, "", "directory", directory);
	if(prefs->flags & PREFS_v)
		printf("%s%s%s", "Loading project file ", path, "\n");
	if(config_load(config, path) != 0)
		ret = error_print(PROGNAME);
	else
	{
		array_append(ca, &config);
		subdirs = config_get(config, "", "subdirs");
	}
	string_delete(path);
	if(subdirs == NULL)
		return ret;
	return _load_subdirs(prefs, directory, ca, subdirs);
}
Esempio n. 5
0
TEST_F(ConfigTest, config_no_bad_keys) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_FALSE(config_has_key(config, "DID_BAD", "primaryRecord"));
  EXPECT_FALSE(config_has_key(config, "DID", "primaryRecord_BAD"));
  EXPECT_FALSE(config_has_key(config, CONFIG_DEFAULT_SECTION, "primaryRecord"));
  config_free(config);
}
Esempio n. 6
0
struct config *
config_load (void)
{
    struct config *res = config_new ();

    if (!config_filename)
	asprintf (&config_filename, "%s/.usbiffrc", getenv ("HOME"));

    if (strcmp ("-", config_filename)) {
	yyin = fopen (config_filename, "r");
	if (!yyin) {
	    if (config_filename_provided) {
		syslog (LOG_ERR, "Cannot read configuration file \"%s\"", config_filename);
		exit (EXIT_FAILURE);
	    } else
		goto no_configuration_file;
	}
    }
    if (yyparse () != 0) {
	syslog (LOG_ERR, "Cannot parse configuration file");
	exit (EXIT_FAILURE);
    }

no_configuration_file:
    yyconfigure (res);
    parsed_conf_free (prg);
    yyclean ();

    if (yyin)
	fclose (yyin);

    return res;
}
int main(int argc, char **argv)
{
    struct configuration *config = NULL;
    struct question_db *qdb = NULL;
    struct template_db *tdb = NULL;
    int flags = 0;
    char *owner;
    int i;

    setlocale(LC_ALL, "");

    config = config_new();
    parsecmdline(config, argc, argv);

    /* always load all translations if running standalone */
    unsetenv("DEBCONF_DROP_TRANSLATIONS");

    /* If debconf is already running, use debconfclient to load
     * the templates;
     * This is a hack until we introduce a standard debconf
     * primitive for doing this.
     */
    if (getenv("DEBIAN_HAS_FRONTEND") != NULL)
    {
         add_questions_debconf(argc, argv);
         exit(0);
    }

    /* parse the configuration info */
    if (config->read(config, DEBCONFCONFIG) == 0)
        DIE("Error reading configuration information");

    /* initialize database modules */
    if ((tdb = template_db_new(config, NULL)) == 0)
        DIE("Cannot initialize DebConf template database");
    if ((qdb = question_db_new(config, tdb, NULL)) == 0)
        DIE("Cannot initialize DebConf config database");

    tdb->methods.load(tdb);
    qdb->methods.load(qdb);

    owner = argv[optind];
    i = optind + 1;
    if (merge)
        flags |= DC_LOADTEMPLATE_MERGE;
    while (i < argc)
    {
        template_db_loadfile(tdb, qdb, argv[i++], owner, flags);
    }

    if (tdb->methods.save(tdb) != DC_OK)
	exit(1);
    if (qdb->methods.save(qdb) != DC_OK)
	exit(1);
    template_db_delete(tdb);
    question_db_delete(qdb);
    config_delete(config);

    return EXIT_SUCCESS;
}
Esempio n. 8
0
bool btc_config_init(void)
{
    osi_mutex_new(&lock);
    config = config_new(CONFIG_FILE_PATH);
    if (!config) {
        LOG_WARN("%s unable to load config file; starting unconfigured.\n", __func__);
        config = config_new_empty();
        if (!config) {
            LOG_ERROR("%s unable to allocate a config object.\n", __func__);
            goto error;
        }
    }
    if (config_save(config, CONFIG_FILE_PATH)) {
        // unlink(LEGACY_CONFIG_FILE_PATH);
    }

    return true;

error:;
    config_free(config);
    osi_mutex_free(&lock);
    config = NULL;
    LOG_ERROR("%s failed\n", __func__);
    return false;
}
Esempio n. 9
0
TEST_F(ConfigTest, config_remove_key_missing) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 0x1200);
  EXPECT_TRUE(config_remove_key(config, "DID", "productId"));
  EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 999);
  config_free(config);
}
Esempio n. 10
0
TEST_F(ConfigTest, config_section_end) {
  config_t *config = config_new(CONFIG_FILE);
  const config_section_node_t * section = config_section_begin(config);
  section = config_section_next(section);
  section = config_section_next(section);
  EXPECT_EQ(section, config_section_end(config));
  config_free(config);
}
Esempio n. 11
0
TEST_F(ConfigTest, config_has_keys) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_TRUE(config_has_key(config, "DID", "recordNumber"));
  EXPECT_TRUE(config_has_key(config, "DID", "primaryRecord"));
  EXPECT_TRUE(config_has_key(config, "DID", "productId"));
  EXPECT_TRUE(config_has_key(config, "DID", "version"));
  config_free(config);
}
Esempio n. 12
0
TEST_F(ConfigTest, config_section_begin) {
  config_t *config = config_new(CONFIG_FILE);
  const config_section_node_t *section = config_section_begin(config);
  EXPECT_TRUE(section != NULL);
  const char *section_name = config_section_name(section);
  EXPECT_TRUE(section != NULL);
  EXPECT_TRUE(!strcmp(section_name, CONFIG_DEFAULT_SECTION));
  config_free(config);
}
Esempio n. 13
0
File: config.c Progetto: ArkShen/xcb
struct config *config_load(const char *path) {
	struct config *cfg, *result;

	if ((cfg = config_new()) == NULL)
		return NULL;
	if ((result = config_internal_load(path, cfg)) == NULL)
		config_destroy(cfg);
	return result;
}
Esempio n. 14
0
redmine::result redmine::action::config(redmine::cl::args &args,
                                        redmine::options &options) {
  if (0 == args.count()) {
    fprintf(stderr,
            "usage: redmine config <action> [args]\n"
            "actions:\n"
            "        new <name>\n"
            "        browser [<path>]\n"
            "        editor [<path>]\n"
            "        profile [<name>]\n"
            "        key [<key>]\n"
            "        url [<url>]\n"
            "        port [<port>]\n"
            "        use-ssl [true|false]\n"
            "        verify-ssl [true|false]\n");
    return FAILURE;
  }

  if (!strcmp("new", args[0])) {
    return config_new(++args, options);
  }

  if (!strcmp("browser", args[0])) {
    return config_browser(++args, options);
  }

  if (!strcmp("editor", args[0])) {
    return config_editor(++args, options);
  }

  if (!strcmp("profile", args[0])) {
    return config_profile(++args, options);
  }

  if (!strcmp("key", args[0])) {
    return config_key(++args, options);
  }

  if (!strcmp("url", args[0])) {
    return config_url(++args, options);
  }

  if (!strcmp("port", args[0])) {
    return config_port(++args, options);
  }

  if (!strcmp("use-ssl", args[0])) {
    return config_use_ssl(++args, options);
  }

  if (!strcmp("verify-ssl", args[0])) {
    return config_verify_ssl(++args, options);
  }

  fprintf(stderr, "invalid argument: %s\n", args[0]);
  return INVALID_ARGUMENT;
}
Esempio n. 15
0
int server_start()
{
    thread_state_t *state = NULL;

    struct sockaddr_in cli_addr;

    int cli_fd;
    socklen_t clilen = sizeof (cli_addr);


    /* Allocate new configuration */
    if ((server_config = config_new()) == NULL)
    {
        ERROR_MSG("Internal error: Can not allocate configuration\n");
        return 1;
    }

    /* Creating socket */
    if ((server_config->socket_fd = create_server_socket(get_port())) < 0)
    {
        ERROR_MSG("Error: Can not create socket\n");
        config_free(&server_config);
        return 1;
    }

    while (1)
    {
        cli_fd = accept(server_config->socket_fd, (struct sockaddr *)&cli_addr,
                        &clilen);

        if (cli_fd < 0)
        {
            ERROR_MSG("ERROR on accept\n");
            continue;
        }

        if (check_overload() < 0)
        {
            ERROR_MSG("ERROR close\n");
            close(cli_fd);
            continue;
        }

        state = thread_state_new();

        state->cli_fd = cli_fd;

        INCR_SERVER_LOAD;

        pthread_create(&(state->thread), NULL, compile_file, state);
    }

    config_free(&server_config);

    return 0;
}
Esempio n. 16
0
int test_config_new(void) {
    Config *config = config_new(TEST_RAW_LEN, TEST_COL_LEN);
    if(config == NULL) {
        LOG_ERR("new config");
        return 1;
    } else {
        LOG_SUCCESS("new config");
        return 0;
    }
}
Esempio n. 17
0
TEST_F(ConfigTest, config_section_next) {
  config_t *config = config_new(CONFIG_FILE);
  const config_section_node_t *section = config_section_begin(config);
  EXPECT_TRUE(section != NULL);
  section = config_section_next(section);
  EXPECT_TRUE(section != NULL);
  const char *section_name = config_section_name(section);
  EXPECT_TRUE(section != NULL);
  EXPECT_TRUE(!strcmp(section_name, "DID"));
  config_free(config);
}
Esempio n. 18
0
static int _new_config(Panel * panel)
{
	char * filename;

	if((panel->config = config_new()) == NULL)
		return -1;
	if((filename = _config_get_filename()) == NULL)
		return -1;
	config_load(panel->config, filename); /* we can ignore errors */
	free(filename);
	return 0;
}
Esempio n. 19
0
int camera_load(Camera * camera)
{
	int ret = 0;
	char * filename;
	Config * config;
	char const * p;
	char * q;
	char const jpeg[] = "jpeg";
	int i;

	if((filename = _camera_get_config_filename(camera, CAMERA_CONFIG_FILE))
			== NULL)
		return -1;
	if((config = config_new()) == NULL
			|| config_load(config, filename) != 0)
		ret = -1;
	else
	{
		/* horizontal flipping */
		camera->hflip = FALSE;
		if((p = _load_variable(camera, config, NULL, "hflip")) != NULL
				&& strtoul(p, NULL, 0) != 0)
			camera->hflip = TRUE;
		/* vertical flipping */
		camera->vflip = FALSE;
		if((p = _load_variable(camera, config, NULL, "vflip")) != NULL
				&& strtoul(p, NULL, 0) != 0)
			camera->vflip = TRUE;
		/* aspect ratio */
		camera->ratio = TRUE;
		if((p = _load_variable(camera, config, NULL, "ratio")) != NULL
				&& strtoul(p, NULL, 0) == 0)
			camera->ratio = FALSE;
		/* snapshot format */
		camera->snapshot_format = CSF_PNG;
		if((p = _load_variable(camera, config, "snapshot", "format"))
				!= NULL
				&& strcmp(p, jpeg) == 0)
			camera->snapshot_format = CSF_JPEG;
		/* snapshot quality */
		camera->snapshot_quality = 100;
		if((p = _load_variable(camera, config, "snapshot", "quality"))
				!= NULL
				&& p[0] != '\0' && (i = strtol(p, &q, 10)) >= 0
				&& *q == '\0' && i <= 100)
			camera->snapshot_quality = i;
		/* FIXME also implement interpolation and overlay images */
	}
	if(config != NULL)
		config_delete(config);
	free(filename);
	return ret;
}
Esempio n. 20
0
// Parses the specified Device ID configuration file and registers the
// Device ID records with SDP.
void bte_load_did_conf(const char *p_path) {
    assert(p_path != NULL);

    config_t *config = config_new(p_path);
    if (!config) {
        LOG_ERROR(LOG_TAG, "%s unable to load DID config '%s'.", __func__, p_path);
        return;
    }

    for (int i = 1; i <= BTA_DI_NUM_MAX; ++i) {
        char section_name[16] = { 0 };
        snprintf(section_name, sizeof(section_name), "DID%d", i);

        if (!config_has_section(config, section_name)) {
            LOG_DEBUG(LOG_TAG, "%s no section named %s.", __func__, section_name);
            break;
        }

        tBTA_DI_RECORD record;
        record.vendor = config_get_int(config, section_name, "vendorId", LMP_COMPID_BROADCOM);
        record.vendor_id_source = config_get_int(config, section_name, "vendorIdSource", DI_VENDOR_ID_SOURCE_BTSIG);
        record.product = config_get_int(config, section_name, "productId", 0);
        record.version = config_get_int(config, section_name, "version", 0);
        record.primary_record = config_get_bool(config, section_name, "primaryRecord", false);
        strlcpy(record.client_executable_url, config_get_string(config, section_name, "clientExecutableURL", ""), sizeof(record.client_executable_url));
        strlcpy(record.service_description, config_get_string(config, section_name, "serviceDescription", ""), sizeof(record.service_description));
        strlcpy(record.documentation_url, config_get_string(config, section_name, "documentationURL", ""), sizeof(record.documentation_url));

        if (record.vendor_id_source != DI_VENDOR_ID_SOURCE_BTSIG &&
            record.vendor_id_source != DI_VENDOR_ID_SOURCE_USBIF) {
            LOG_ERROR(LOG_TAG, "%s invalid vendor id source %d; ignoring DID record %d.", __func__, record.vendor_id_source, i);
            continue;
        }

        LOG_DEBUG(LOG_TAG, "Device ID record %d : %s", i, (record.primary_record ? "primary" : "not primary"));
        LOG_DEBUG(LOG_TAG, "  vendorId            = %04x", record.vendor);
        LOG_DEBUG(LOG_TAG, "  vendorIdSource      = %04x", record.vendor_id_source);
        LOG_DEBUG(LOG_TAG, "  product             = %04x", record.product);
        LOG_DEBUG(LOG_TAG, "  version             = %04x", record.version);
        LOG_DEBUG(LOG_TAG, "  clientExecutableURL = %s", record.client_executable_url);
        LOG_DEBUG(LOG_TAG, "  serviceDescription  = %s", record.service_description);
        LOG_DEBUG(LOG_TAG, "  documentationURL    = %s", record.documentation_url);

        uint32_t record_handle;
        tBTA_STATUS status = BTA_DmSetLocalDiRecord(&record, &record_handle);
        if (status != BTA_SUCCESS) {
            LOG_ERROR(LOG_TAG, "%s unable to set device ID record %d: error %d.", __func__, i, status);
        }
    }

    config_free(config);
}
Esempio n. 21
0
void setup_population()
{
    /* function set */
    struct function *functions[10] = {
        function_new_func(ADD, 2),
        function_new_func(SUB, 2),
        function_new_func(MUL, 2),
        function_new_func(DIV, 2),
        function_new_func(POW, 2),

        function_new_func(LOG, 1),
        function_new_func(EXP, 1),
        function_new_func(RAD, 1),
        function_new_func(SIN, 1),
        function_new_func(COS, 1)
    };
    fs = function_set_new(functions, 10);

    /* terminal set */
    float *one= malloc_float(1.0);
    float *two = malloc_float(2.0);

    struct terminal *terminals[2] = {
        terminal_new_constant(FLOAT, one),
        terminal_new_constant(FLOAT, two)
    };
    ts = terminal_set_new(terminals, 2);

    /* setup config */
    c = config_new();
    c->population_size = 100;

    /* general config */
    c->get_score = tree_score;
    c->copy_func = tree_copy;
    c->free_func = tree_destroy;
    c->cmp = tree_cmp;

    /* tree config */
    c->data_struct = tree_config_new();
    ((struct tree_config *) c->data_struct)->build_method = FULL;
    ((struct tree_config *) c->data_struct)->max_depth = 3;
    ((struct tree_config *) c->data_struct)->fs = fs;
    ((struct tree_config *) c->data_struct)->ts = ts;
    c->data_struct_free = tree_config_destroy;

    /* create trees */
    p = tree_population(c);

    free(one);
    free(two);
}
Esempio n. 22
0
int test_new_matrix(void) {
    Config *config = config_new(TEST_RAW_LEN, TEST_COL_LEN);
    Matrix *matrix = matrix_new(config);
    if(matrix == NULL) {
        LOG_ERR("new matrix");
        return 1;
    }
    
    safe_free(config);
    safe_free(matrix);
    LOG_SUCCESS("new matrix");
    return 0;
}
Esempio n. 23
0
int main(int argc, char *argv[]) {
    log_open("statsd-proxy", NULL, 0);

    char *filename;

    const char *short_opt = "hvdf:";
    struct option long_opt[] = {
        {"help", no_argument, NULL, 'h'},
        {"version", no_argument, NULL, 'v'},
        {"debug", no_argument, NULL, 'd'},
        {"file", required_argument, NULL, 'f'},
        {NULL, 0, NULL, 0},
    };

    int c;
    while ((c = getopt_long(argc, argv, short_opt, long_opt, NULL)) != -1) {
        switch (c) {
            case 'h':
            case ':':
            case '?':
                usage();
                break;
            case 'v':
                version();
                break;
            case 'f':
                filename = optarg;
                break;
            case 'd':
                log_setlevel(LOG_DEBUG);
                break;
            default:
                usage();
        };
    }

    if (argc == 1 || optind < argc) usage();

    struct config *config = config_new();

    if (config == NULL) exit(1);

    if (config_init(config, filename) != CONFIG_OK) exit(1);

    start(config);

    config_free(config);
    log_close();
    return 0;
}
Esempio n. 24
0
int main(int argc,char *argv[])
{
    int myfd;
    int myport;
    int buffLen = 0;
    char * readBuff = NULL;
    struct sockaddr_in myaddr;

    configuration *conf = config_new();
    config_init(conf);//相当于config_load("conf.ini");

    if (argc < 2 || (myport = atoi(argv[1])) < 1) {
        if (!config_get_int(conf, "http", "listen", &myport)) {
            myport = 80;
        }
    }
//	printf("port :%d\n",myport);

    if((myfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
    {
        perror("server socket() error!");
        exit(1);
    }

    myaddr.sin_family      = AF_INET;
    myaddr.sin_port        = htons(myport);
    myaddr.sin_addr.s_addr = inet_addr("0.0.0.0");

    if(bind(myfd, (struct sockaddr *)&myaddr, sizeof(struct sockaddr)) == -1)
    {
        perror("server bind() error!");
        exit(1);
    }

    if(listen(myfd, 10) == -1)
    {
        perror("server listen() error!");
        exit(1);
    }

    while(1)
    {
        mySocket(myfd,&readBuff,&buffLen);
        printf("\nreadBuff:\n%s\n buffLen:\n%d\n",readBuff,buffLen);
    }

    free(readBuff);
    close(myfd);
    return 0;
}
Esempio n. 25
0
/* libdatabase_database_new */
static PyObject * _libdatabase_database_new(PyObject * self, PyObject * args)
{
    Database * database;
    char const * engine;
    char const * section;

    if(!PyArg_ParseTuple(args, "ss", &engine, &section))
        return NULL;
    /* FIXME obtain the Config object */
    if((database = database_new(engine, config_new(), section)) == NULL)
        return NULL;
    return PyCapsule_New(database, _libdatabase_database_name,
                         _libdatabase_database_delete);
}
Esempio n. 26
0
static int _settings_browse(Settings * settings)
{
	int ret = 0;
	Config * config;
	GtkTreeModel * model;
	char const * path;
	char * p;
	size_t i;
	size_t j;
	int datadir = 1;

	if((config = config_new()) == NULL)
		return -_settings_error(error_get(NULL), 1);
	model = _settings_get_model(settings);
	gtk_list_store_clear(GTK_LIST_STORE(model));
	/* read through every XDG application folder */
	if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0)
	{
		path = "/usr/local/share:/usr/share";
		datadir = 0;
	}
	if((p = strdup(path)) == NULL)
		_settings_error(error_get(NULL), 1);
	else
		for(i = 0, j = 0;; i++)
			if(p[i] == '\0')
			{
				string_rtrim(&p[j], "/");
				_settings_browse_folder(settings, config,
						&p[j]);
				datadir |= (strcmp(&p[j], DATADIR) == 0);
				break;
			}
			else if(p[i] == ':')
			{
				p[i] = '\0';
				string_rtrim(&p[j], "/");
				_settings_browse_folder(settings, config,
						&p[j]);
				datadir |= (strcmp(&p[j], DATADIR) == 0);
				j = i + 1;
			}
	free(p);
	if(datadir == 0)
		ret = _settings_browse_folder(settings, config, DATADIR);
	ret |= _settings_browse_home(settings, config);
	config_delete(config);
	return ret;
}
Esempio n. 27
0
/* note_new */
Note * note_new(void)
{
	Note * note;

	if((note = object_new(sizeof(*note))) == NULL)
		return NULL;
	note->config = config_new();
	note->filename = NULL;
	note->description = NULL;
	if(note->config == NULL)
	{
		note_delete(note);
		return NULL;
	}
	return note;
}
Esempio n. 28
0
/* gserverplatform_new */
GServerPlatform * gserverplatform_new(void)
{
	GServerPlatform * platform;

	if((platform = object_new(sizeof(*platform))) == NULL)
		return NULL;
	if((platform->config = config_new()) == NULL)
	{
		object_delete(platform->config);
		return NULL;
	}
	/* XXX report errors */
	config_load_preferences_system(platform->config, VENDOR, PACKAGE,
			"platform.conf");
	return platform;
}
Esempio n. 29
0
int parse_filename(char * filename, struct configobj ** newcfg) 
{
    struct configobj * mycfg;

    mycfg = config_new(NULL);
    *newcfg = mycfg;

    config_parse_file(mycfg, filename);
    printf("\nDumping has table key/value pairs.\n");
    dump_string_ht(mycfg->config_options);
    printf("\n");

    /*    config_destroy(mycfg); */

    return 0;
}
int main()
{
	int numvars = 100;
	int vartaglen = 32;
	char tag_buf[vartaglen*numvars];
	struct config_var vars[numvars];
	struct config_buf buf = config_new(tag_buf, sizeof(tag_buf)/sizeof(tag_buf[0]), vars, sizeof(vars)/sizeof(vars[0]));

	int some_special_int = 4;
	int some_other_int = 20;
	float some_float = .01;
	vec3 some_vector = {{0.0, 0.0, 0.0}};
	bool some_bool = 0;
	bool some_other_bool = 1;
	bool some_unchanging_bool = 1;

	// config_expose_int(&buf, &some_other_int, "SOME_OTHER_INT");
	// config_expose_int(&buf, &some_special_int, "SOME_SPECIAL_INT");
	// config_expose_float(&buf, &some_float, "SOME_FLOAT");
	// config_expose_float3(&buf, some_vector.A, "SOME_VECTOR");
	// config_expose_bool(&buf, &some_bool, "SOME_BOOL");
	// config_expose_bool(&buf, &some_other_bool, "SOME_OTHER_BOOL");
	// config_expose_bool(&buf, &some_unchanging_bool, "SOME_UNCHANGING_BOOL");

	config_expose(&buf, &some_other_int, "SOME_OTHER_INT");
	config_expose(&buf, &some_special_int, "SOME_SPECIAL_INT");
	config_expose(&buf, &some_float, "SOME_FLOAT");
	config_expose(&buf, &some_vector, "SOME_VECTOR");
	config_expose(&buf, &some_bool, "SOME_BOOL");
	config_expose(&buf, &some_other_bool, "SOME_OTHER_BOOL");
	config_expose(&buf, &some_unchanging_bool, "SOME_UNCHANGING_BOOL");


	printf("some_special_int value is %i\n", some_special_int);
	printf("some_other_int value is: %d\n", some_other_int);
	printf("float is %f, vector is <%f, %f, %f>\n", some_float, some_vector.x, some_vector.y, some_vector.z);
	printf("some_bool is %s, some_other_bool is %s, some_unchanging_bool is %s\n", BOOLSTR(some_bool), BOOLSTR(some_other_bool), BOOLSTR(some_unchanging_bool));

	config_load(buf, "./int_test.conf");

	printf("some_special_int value is %i\n", some_special_int);
	printf("some_other_int value is: %d\n", some_other_int);
	printf("float is %f, vector is <%f, %f, %f>\n", some_float, some_vector.x, some_vector.y, some_vector.z);
	printf("some_bool is %s, some_other_bool is %s, some_unchanging_bool is %s\n", BOOLSTR(some_bool), BOOLSTR(some_other_bool), BOOLSTR(some_unchanging_bool));
	return 0;
}