diff options
author | Barrucadu <mike@barrucadu.co.uk> | 2009-04-26 21:05:11 +0100 |
---|---|---|
committer | Barrucadu <mike@barrucadu.co.uk> | 2009-04-26 21:05:11 +0100 |
commit | c6fd63a3f2c68f4341f5392efcc07a9673470679 (patch) | |
tree | 8094feb3215d41d2f097cfe1e81abf5111f8364f /uzbl.c | |
parent | 8d3a16b9a61a8f2c0549ae2e26fa66989e26c5e6 (diff) |
Now checks in $XDG_CONFIG_HOME for a "uzbl" file if no config file is specified. Does not check $XDG_CONFIG_DIRS yet.
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -214,12 +214,12 @@ run_command(const char *command, const char *args) { static void parse_command(const char *command) { - int i; - Command *c; + int i = 0; + Command *c = NULL; char * command_name = strtok (command, " "); char * command_param = strtok (NULL, " ,"); //dunno how this works, but it seems to work - Command *c_tmp; + Command *c_tmp = NULL; for (i = 0; i < LENGTH (commands); i++) { c_tmp = &commands[i]; if (strncmp (command_name, c_tmp->command, strlen (c_tmp->command)) == 0) { @@ -399,6 +399,14 @@ settings_init () { gboolean res = NULL; gchar** keysi = NULL; gchar** keyse = NULL; + + if (! config_file) { + char* conf = getenv ("XDG_CONFIG_HOME"); + strcat (conf, "/uzbl"); + if (file_exists (conf)) + strcpy(config_file conf); + } + if (config_file) { config = g_key_file_new (); res = g_key_file_load_from_file (config, config_file, G_KEY_FILE_NONE, NULL); |