From d062100ca75811eca6aacaeb9db276f504c94dd9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 27 Jul 2016 22:51:30 -0700 Subject: Check for Cygnal when deciding where user home is. * parser.c (get_home_path): Do not try HOME first and then USERPROFILE. If running on Cygnal, use strictly USERPROFILE, and do not fall back on HOME. In all other situations, try the HOME variable only. --- parser.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/parser.c b/parser.c index 6589bd47..aca71939 100644 --- a/parser.c +++ b/parser.c @@ -37,6 +37,9 @@ #include #include "config.h" #include ALLOCA_H +#ifdef __CYGWIN__ +#include +#endif #include "lib.h" #include "signal.h" #include "unwind.h" @@ -644,31 +647,18 @@ static val read_eval_ret_last(val env, val counter, return t; } -#ifdef __CYGWIN__ static val get_home_path(void) { - val path_exists_p = intern(lit("path-exists-p"), user_package); - - { - val posixy_home = getenv_wrap(lit("HOME")); - if (funcall1(path_exists_p, posixy_home)) - return posixy_home; - } +#ifdef __CYGWIN__ + struct utsname un; - { - val windowsy_home = getenv_wrap(lit("USERPROFILE")); - if (funcall1(path_exists_p, windowsy_home)) - return windowsy_home; + if (uname(&un) >= 0) { + if (strncmp(un.sysname, "CYGNAL", 6) == 0) + return getenv_wrap(lit("USERPROFILE")); } - - return nil; -} -#else -static val get_home_path(void) -{ +#endif return getenv_wrap(lit("HOME")); } -#endif val repl(val bindings, val in_stream, val out_stream) { -- cgit v1.2.3