summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-01 00:16:59 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-01 00:16:59 +0000
commit5d0786103dcb47b2a01e1b280f5f7218d7714363 (patch)
tree2ad537fa174266f86f35c9861dcb381cb912be45
parentf4dccd790cbb501af6c6a3ad2eaf41765d724cc8 (diff)
downloadmdk-5d0786103dcb47b2a01e1b280f5f7218d7714363.tar.gz
mdk-5d0786103dcb47b2a01e1b280f5f7218d7714363.tar.bz2
using access to check for bootstrap files
-rw-r--r--mixguile/mixguile.c20
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);
}