diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-09-25 23:02:17 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-09-25 21:02:17 +0000 |
commit | 86ab632081cc94593ab6c22842d084fce5cf54d4 (patch) | |
tree | a67b71785be9512eea0092771c05491f212cbe18 /libgfortran/intrinsics/getlog.c | |
parent | ad90e28f8f685996778fa94aa6c9b5c86adb210c (diff) | |
download | gcc-86ab632081cc94593ab6c22842d084fce5cf54d4.zip gcc-86ab632081cc94593ab6c22842d084fce5cf54d4.tar.gz gcc-86ab632081cc94593ab6c22842d084fce5cf54d4.tar.bz2 |
re PR libfortran/23803 ([mingw32] getlog malfunction)
PR libfortran/23803
* intrinsics/getXid.c: Add getpid wrapper for MinGW.
* intrinsics/getlog.c: Add getlogin wrapper for MinGW.
* intrinsics/hostnm.c: Add gethostname wrapper for MinGW.
Co-Authored-By: Danny Smith <dannysmith@users.sourceforge.net>
From-SVN: r104624
Diffstat (limited to 'libgfortran/intrinsics/getlog.c')
-rw-r--r-- | libgfortran/intrinsics/getlog.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/getlog.c b/libgfortran/intrinsics/getlog.c index 35c52bd..9b73ec2 100644 --- a/libgfortran/intrinsics/getlog.c +++ b/libgfortran/intrinsics/getlog.c @@ -39,6 +39,29 @@ Boston, MA 02110-1301, USA. */ #endif +/* Windows32 version */ +#if defined __MINGW32__ && !defined HAVE_GETLOGIN +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <lmcons.h> /* for UNLEN */ + +static char * +w32_getlogin (void) +{ + static char name [UNLEN + 1]; + DWORD namelen = sizeof (name); + + GetUserName (name, &namelen); + return (name[0] == 0 ? NULL : name); +} + +#undef getlogin +#define getlogin w32_getlogin +#define HAVE_GETLOGIN 1 + +#endif + + /* GETLOG (LOGIN), g77 intrinsic for retrieving the login name for the process. CHARACTER(len=*), INTENT(OUT) :: LOGIN */ |