Bug 23803 - [mingw32] getlog malfunction
Summary: [mingw32] getlog malfunction
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.3
Assignee: Francois-Xavier Coudert
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2005-09-09 22:34 UTC by Francois-Xavier Coudert
Modified: 2005-09-29 12:30 UTC (History)
1 user (show)

See Also:
Host:
Target: i386-mingw32
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-24 16:39:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-09-09 22:34:10 UTC
$ cat getlog.f 
      character*50 user
      call getlog(user)
      write(*,"(A)") user
      end
$ gfortran getlog.f 
cc4Qbaaa.o:getlog.f:(.text+0x15): undefined reference to `_gfortran_getlog'
collect2: ld returned 1 exit status

mingw sets the USERNAME environment variable, we should use it to provide a
getlog procedure. Or we could use a windows API function (if there is one
available on all windows versions).
Comment 1 Danny Smith 2005-09-14 23:53:27 UTC
(In reply to comment #0)
> mingw sets the USERNAME environment variable, we should use it to provide a
> getlog procedure.

NT and later set USERNAME by default.  win95, win98 do not. The var may not 
necessarily refect the logon name.

> Or we could use a windows API function (if there is one
> available on all windows versions).

GetUserName() 

Comment 2 GCC Commits 2005-09-25 21:02:24 UTC
Subject: Bug 23803

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	fxcoudert@gcc.gnu.org	2005-09-25 21:02:17

Modified files:
	libgfortran    : ChangeLog 
	libgfortran/intrinsics: getXid.c getlog.c hostnm.c 

Log message:
	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.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.306&r2=1.307
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/getXid.c.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/getlog.c.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/hostnm.c.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 3 GCC Commits 2005-09-29 12:29:15 UTC
Subject: Bug 23803

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	fxcoudert@gcc.gnu.org	2005-09-29 12:28:52

Modified files:
	libgfortran    : ChangeLog 
	libgfortran/intrinsics: cpu_time.c getXid.c getlog.c hostnm.c 
	                        sleep.c 

Log message:
	Backport from mainline:
	PR libfortran/23380
	PR libfortran/23802
	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.
	* intrinsics/sleep.c: Add correct sleep macro for MinGW.
	* intrinsics/cpu_time.c (__cpu_time_1): Provide a MS Windows
	version.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.92&r2=1.163.2.93
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/cpu_time.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5&r2=1.5.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/getXid.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/getlog.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.2&r2=1.1.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/hostnm.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/sleep.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2

Comment 4 Francois-Xavier Coudert 2005-09-29 12:30:31 UTC
Fixed.