From e6e5c41e0cb0b70652421e778e839543c3fffe7a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 1 Sep 2001 00:16:59 +0000 Subject: using access to check for bootstrap files --- mixguile/mixguile.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'mixguile/mixguile.c') 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 + #include #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); } -- cgit v1.2.3