>From b3d5cc8cdaf11525c10c75988dab5a3de9385123 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 15 Oct 2023 12:53:29 +0200 Subject: [PATCH 5/8] MSVC port, part 5: Home directory handling like with mingw. * info/infomap.c (fetch_user_maps): Treat native Windows like mingw. * info/tilde.c (tilde_expand_word): Likewise. --- info/infomap.c | 4 ++-- info/tilde.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/info/infomap.c b/info/infomap.c index 71ed4098b8..0f9f6d82f6 100644 --- a/info/infomap.c +++ b/info/infomap.c @@ -563,7 +563,7 @@ fetch_user_maps (char *init_file) if (init_file) filename = xstrdup (init_file); else if ((homedir = getenv ("HOME")) != NULL -#ifdef __MINGW32__ +#ifdef _WIN32 || (homedir = getenv ("USERPROFILE")) != NULL #endif ) @@ -573,7 +573,7 @@ fetch_user_maps (char *init_file) strcat (filename, "/"); strcat (filename, INFOKEY_FILE); } -#if defined(__MSDOS__) || defined(__MINGW32__) +#if defined(__MSDOS__) || defined(_WIN32) /* Poor baby, she doesn't have a HOME... */ else filename = xstrdup (INFOKEY_FILE); /* try current directory */ diff --git a/info/tilde.c b/info/tilde.c index 0f78f3f25b..ffe427955a 100644 --- a/info/tilde.c +++ b/info/tilde.c @@ -39,7 +39,7 @@ tilde_expand_word (const char *filename) the password database. */ if (!temp_home) { -#ifndef __MINGW32__ +#ifndef _WIN32 struct passwd *entry; entry = (struct passwd *) getpwuid (getuid ()); @@ -63,7 +63,7 @@ tilde_expand_word (const char *filename) } else { -#ifndef __MINGW32__ +#ifndef _WIN32 struct passwd *user_entry; #endif char *username = xmalloc (257); @@ -78,7 +78,7 @@ tilde_expand_word (const char *filename) } username[i - 1] = 0; -#ifndef __MINGW32__ +#ifndef _WIN32 user_entry = (struct passwd *) getpwnam (username); if (user_entry) { -- 2.34.1