diff --git a/H/YapGFlagInfo.h b/H/YapGFlagInfo.h index 77ddac470..16352a140 100644 --- a/H/YapGFlagInfo.h +++ b/H/YapGFlagInfo.h @@ -291,7 +291,7 @@ Read-only flag telling the maximum arity of a functor. Takes the value "256", NULL), YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false", NULL), YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true, booleanFlag, - "true", NULL), /**< `open_expands_filename ` + "false", NULL), /**< `open_expands_filename ` If `true` the open/3 builtin performs filename-expansion before opening a file (SICStus Prolog like). If `false` it does not diff --git a/os/edio.yap b/os/edio.yap index cba6e023c..1a581eb5f 100644 --- a/os/edio.yap +++ b/os/edio.yap @@ -129,6 +129,7 @@ simultaneously opened streams is 17. */ told :- current_output(Stream), + flush_output(Stream), !, set_output(user), close(Stream). diff --git a/os/sysbits.c b/os/sysbits.c index d4438e091..c004a678a 100644 --- a/os/sysbits.c +++ b/os/sysbits.c @@ -7,7 +7,6 @@ * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * * ************************************************************************** - * PrologPathProkoh * * * File: sysbits.c * * Last rev: 4/03/88 * @@ -519,12 +518,13 @@ static const char *myrealpath(const char *path, char *out) { } // rc = NULL; if (errno == ENOENT || errno == EACCES) { - char base[YAP_FILENAME_MAX]; + char base[YAP_FILENAME_MAX+1]; strncpy(base, path, YAP_FILENAME_MAX - 1); rc = realpath(dirname(base), NULL); if (rc) { - const char *b = basename(base); + // base may haave been destroyed + const char *b = basename(path); size_t e = strlen(rc); size_t bs = strlen(b); @@ -585,6 +585,11 @@ static const char *expandVars(const char *spec, char *u) { const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) { const char *p; const char *rc; + if (!ok) { + if (!rc0) + rc0 = malloc(strlen(spec)+1); + return strcpy(rc0, spec); + } rc = PlExpandVars(spec, NULL, rc0); if (!rc) rc = spec;