Skip to content

Commit a8199b5

Browse files
committed
LOGNAME workaround for GETLOG
1 parent 3c61fc9 commit a8199b5

File tree

7 files changed

+40
-1
lines changed

7 files changed

+40
-1
lines changed

src/argos/argos_prep_wrttop.F

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ logical function argos_prep_wrttop(lfnout,title,lfntop,filtop,
182182
call swatch(topdat,toptim)
183183
#ifdef USE_POSIXF
184184
call pxfgetlogin(user, ilen, ierror)
185+
#elif USE_GETENV_LOGNAME
186+
! From https://linux.die.net/man/3/getlogin:
187+
! For most purposes, it is more useful to use the environment variable
188+
! LOGNAME to find out who the user is. This is more flexible precisely
189+
! because the user can set LOGNAME arbitrarily.
190+
call util_getenv('LOGNAME',user)
185191
#else
186192
call getlog(user)
187193
#endif

src/argos/argos_prepare_wrttop.F

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ logical function argos_prepare_wrttop(lfnout,title,lfntop,filtop,
182182
call swatch(topdat,toptim)
183183
#ifdef USE_POSIXF
184184
call pxfgetlogin(user, ilen, ierror)
185+
#elif USE_GETENV_LOGNAME
186+
! From https://linux.die.net/man/3/getlogin:
187+
! For most purposes, it is more useful to use the environment variable
188+
! LOGNAME to find out who the user is. This is more flexible precisely
189+
! because the user can set LOGNAME arbitrarily.
185190
#else
186191
call getlog(user)
187192
#endif

src/argos/argos_space_wtmro.F

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ subroutine argos_space_wtmro(lfnmro,stime,pres,temp,tempw,temps,
2828
call swatch(rdate,rtime)
2929
#ifdef USE_POSIXF
3030
call pxfgetlogin(user, ilen, ierror)
31+
#elif USE_GETENV_LOGNAME
32+
! From https://linux.die.net/man/3/getlogin:
33+
! For most purposes, it is more useful to use the environment variable
34+
! LOGNAME to find out who the user is. This is more flexible precisely
35+
! because the user can set LOGNAME arbitrarily.
3136
#else
3237
call getlog(user)
3338
#endif

src/argos/argos_space_wtrst.F

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ subroutine argos_space_wtrst(lfnrst,filrst,lveloc,pres,
3939
call swatch(rdate,rtime)
4040
#ifdef USE_POSIXF
4141
call pxfgetlogin(user, ilen, ierror)
42+
#elif USE_GETENV_LOGNAME
43+
! From https://linux.die.net/man/3/getlogin:
44+
! For most purposes, it is more useful to use the environment variable
45+
! LOGNAME to find out who the user is. This is more flexible precisely
46+
! because the user can set LOGNAME arbitrarily.
4247
#else
4348
call getlog(user)
4449
#endif

src/config/makefile.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,10 @@ ifneq ($(TARGET),LINUX)
31293129
EXTRA_LIBS += -lm
31303130
DEFINES += -DUSE_FLANG
31313131
endif
3132-
3132+
# Jeff: F18 does not support GETLOG _or_ PXF
3133+
ifeq ($(USE_FLANG),1)
3134+
DEFINES += -DUSE_GETENV_LOGNAME
3135+
endif
31333136
endif
31343137

31353138
endif

src/prepar/pre_wrttop.F

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ logical function pre_wrttop(lfnout,title,lfntop,filtop,
182182
call swatch(topdat,toptim)
183183
#ifdef USE_POSIXF
184184
call pxfgetlogin(user, ilen, ierror)
185+
#elif USE_GETENV_LOGNAME
186+
! From https://linux.die.net/man/3/getlogin:
187+
! For most purposes, it is more useful to use the environment variable
188+
! LOGNAME to find out who the user is. This is more flexible precisely
189+
! because the user can set LOGNAME arbitrarily.
185190
#else
186191
call getlog(user)
187192
#endif

src/space/sp_init.F

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,6 +2355,11 @@ subroutine sp_wtrst(lfnrst,filrst,lveloc,pres,temp,tempw,temps,
23552355
call swatch(rdate,rtime)
23562356
#ifdef USE_POSIXF
23572357
call pxfgetlogin(user, ilen, ierror)
2358+
#elif USE_GETENV_LOGNAME
2359+
! From https://linux.die.net/man/3/getlogin:
2360+
! For most purposes, it is more useful to use the environment variable
2361+
! LOGNAME to find out who the user is. This is more flexible precisely
2362+
! because the user can set LOGNAME arbitrarily.
23582363
#else
23592364
call getlog(user)
23602365
#endif
@@ -3939,6 +3944,11 @@ subroutine sp_wtmro(lfnmro,stime,pres,temp,tempw,temps,
39393944
call swatch(rdate,rtime)
39403945
#ifdef USE_POSIXF
39413946
call pxfgetlogin(user, ilen, ierror)
3947+
#elif USE_GETENV_LOGNAME
3948+
! From https://linux.die.net/man/3/getlogin:
3949+
! For most purposes, it is more useful to use the environment variable
3950+
! LOGNAME to find out who the user is. This is more flexible precisely
3951+
! because the user can set LOGNAME arbitrarily.
39423952
#else
39433953
call getlog(user)
39443954
#endif

0 commit comments

Comments
 (0)