From c6fd63a3f2c68f4341f5392efcc07a9673470679 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 26 Apr 2009 21:05:11 +0100 Subject: Now checks in $XDG_CONFIG_HOME for a "uzbl" file if no config file is specified. Does not check $XDG_CONFIG_DIRS yet. --- uzbl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index ce1d190..47f5e22 100644 --- a/uzbl.c +++ b/uzbl.c @@ -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); -- cgit v1.2.3