--- yap-6.0.2.orig/C/c_interface.c 2010-03-04 13:57:29.000000000 +1300 +++ yap-6.0.2/C/c_interface.c 2010-03-05 21:41:19.000000000 +1300 @@ -2170,6 +2170,7 @@ static int eof_found = FALSE; static int yap_lineno = 0; +static char *BootFileDir = NULL; static FILE *bootfile; static char InitFile[] = "init.yap"; @@ -2489,11 +2490,21 @@ /* read the bootfile */ if (!do_bootstrap) { + BootFileDir = getenv("YAPBOOTDIR"); + if (BootFileDir) { #if HAVE_STRNCAT - strncpy(boot_file, YAP_PL_SRCDIR, 256); + strncpy(boot_file, BootFileDir, 256); #else - strcpy(boot_file, YAP_PL_SRCDIR); + strcpy(boot_file, BootFileDir); #endif + } + else { +#if HAVE_STRNCAT + strncpy(boot_file, YAP_PL_SRCDIR, 256); +#else + strcpy(boot_file, YAP_PL_SRCDIR); +#endif + } #if HAVE_STRNCAT strncat(boot_file, "/", 255); #else @@ -2513,11 +2524,20 @@ Atom atfile; Functor fgoal; YAP_Term goal, as[2]; + if (BootFileDir) { #if HAVE_STRNCAT - strncpy(init_file, YAP_PL_SRCDIR, 256); + strncpy(init_file, BootFileDir, 256); #else - strcpy(init_file, YAP_PL_SRCDIR); + strcpy(init_file, BootFileDir); #endif + } + else { +#if HAVE_STRNCAT + strncpy(init_file, YAP_PL_SRCDIR, 256); +#else + strcpy(init_file, YAP_PL_SRCDIR); +#endif + } #if HAVE_STRNCAT strncat(init_file, "/", 255); #else