diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-09-01 00:16:59 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2001-09-01 00:16:59 +0000 |
commit | e6e5c41e0cb0b70652421e778e839543c3fffe7a (patch) | |
tree | 848828bafc19388c6bd4485925e40ebb01c28712 /mixguile | |
parent | 075a7726fcd147c355d0fa6b78de710c920b9192 (diff) | |
download | mdk-e6e5c41e0cb0b70652421e778e839543c3fffe7a.tar.gz mdk-e6e5c41e0cb0b70652421e778e839543c3fffe7a.tar.bz2 |
using access to check for bootstrap files
Diffstat (limited to 'mixguile')
-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); } |