Mail Archives: djgpp-workers/2000/07/24/04:08:42
--Message-Boundary-30081
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
> Why not change the order of precedence in getlogin()? If there are
> systems where USERNAME is defined, but USER is not, that would be the
> logical solution, no?
Why not? What about the order of searching env. vars - is
USERNAME, USER, LOGNAME ok? If so - I've attached the patch
changing this (getlogin.c+getlogin.txh).
Piotr Eljasiak
--Message-Boundary-30081
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'getlogin-2.dif'
*** src/libc/posix/unistd/getlogin.c Wed Aug 4 13:58:24 1999
--- getlogin.c Mon Jul 24 08:04:30 2000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <unistd.h>
***************
*** 10,16 ****
{
char *p;
! p = getenv("USER");
if (!p)
p = getenv("LOGNAME");
if (!p)
--- 11,19 ----
{
char *p;
! p = getenv("USERNAME");
! if (!p)
! p = getenv("USER");
if (!p)
p = getenv("LOGNAME");
if (!p)
*** src/libc/posix/unistd/getlogin.txh Sun Sep 27 09:22:24 1998
--- getlogin.txh Mon Jul 24 08:04:50 2000
***************
*** 13,20 ****
@subheading Return Value
! Returns the value of the @code{USER} environment variable, else the
! @code{LOGNAME} environment variable, else @code{"dosuser"}.
@subheading Portability
--- 13,24 ----
@subheading Return Value
! Returns the value of the @code{USERNAME} environment variable, else the
! @code{USER} environment variable, else the @code{LOGNAME} environment
! variable, else @code{dosuser}.
!
! @code{USERNAME} is set automatically under Windows NT and 2000. None of these
! environment variables are set automatically under DOS, Windows '95 or '98.
@subheading Portability
--Message-Boundary-30081--
- Raw text -