diff options
-rw-r--r-- | mixguile/mixguile.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/mixguile/mixguile.c b/mixguile/mixguile.c index 4072869..4da3068 100644 --- a/mixguile/mixguile.c +++ b/mixguile/mixguile.c @@ -21,6 +21,8 @@ * */ +#include <unistd.h> + #include <mixlib/mix_config.h> #include "mixguile_cmd_dispatcher.h" #include "mixguile.h" @@ -59,26 +61,21 @@ mixguile_init (int argc, char *argv[], main_func_t main_fun, void mixguile_load_bootstrap (void) { - FILE *scm = NULL; const gchar *scmfile = SCM_FILE; - gchar *lscmfile = - g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S, MIX_CONFIG_DIR, - G_DIR_SEPARATOR_S, LOCAL_SCM_FILE, NULL); + gchar *lscmfile = g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S, + MIX_CONFIG_DIR, G_DIR_SEPARATOR_S, + LOCAL_SCM_FILE, NULL); - if (!(scm = fopen (scmfile, "r")) - && !(scm = fopen ((scmfile = LOCAL_SCM_FILE), "r"))) + if (access (scmfile, R_OK) && access ((scmfile = LOCAL_SCM_FILE), R_OK)) { g_warning ("mixguile bootstrap file %s not found\n", SCM_FILE); scmfile = NULL; } else - fclose (scm); - - if (scmfile) mixguile_interpret_file (scmfile); + mixguile_interpret_file (scmfile); - if ((scm = fopen (lscmfile, "r")) != NULL) + if (!access (lscmfile, R_OK)) { - fclose (scm); mixguile_interpret_file (lscmfile); } @@ -89,7 +86,6 @@ mixguile_load_bootstrap (void) void mixguile_enter_repl (int argc, char *argv[]) { - mixguile_cmd_dispatcher_prepare (dispatcher_); gh_repl (argc, argv); } |