From 939a8e932851124e05f14df53a925b185054b5ae Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 27 Feb 2015 15:00:55 +0000 Subject: Enable logname in mingw32 configuration --- configs/mingw32_defconfig | 6 +++--- include/mingw.h | 1 + win32/mingw.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index 4a3303b9e..cff601e72 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.23.0-TIG-1656-g6d6d18d -# Sun Dec 14 14:24:44 2014 +# Busybox version: 1.23.0 +# Fri Feb 27 14:51:19 2015 # CONFIG_HAVE_DOT_CONFIG=y # CONFIG_PLATFORM_POSIX is not set @@ -241,7 +241,7 @@ CONFIG_FEATURE_FANCY_HEAD=y # CONFIG_INSTALL is not set # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set # CONFIG_LN is not set -# CONFIG_LOGNAME is not set +CONFIG_LOGNAME=y CONFIG_LS=y CONFIG_FEATURE_LS_FILETYPES=y CONFIG_FEATURE_LS_FOLLOWLINKS=y diff --git a/include/mingw.h b/include/mingw.h index 970b689fd..033edd07e 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -371,6 +371,7 @@ IMPL(getegid,int,DEFAULT_GID,void); IMPL(geteuid,int,DEFAULT_UID,void); NOIMPL(getsid,pid_t pid UNUSED_PARAM); IMPL(getuid,int,DEFAULT_UID,void); +int getlogin_r(char *buf, size_t len); int fcntl(int fd, int cmd, ...); #define fork() -1 IMPL(fsync,int,0,int fd UNUSED_PARAM); diff --git a/win32/mingw.c b/win32/mingw.c index 197f331f6..4b5701b2d 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -624,6 +624,23 @@ struct group *getgrgid(gid_t gid UNUSED_PARAM) return &g; } +int getlogin_r(char *buf, size_t len) +{ + char *name; + + if ( (name=get_user_name()) == NULL ) { + return -1; + } + + if ( strlen(name) >= len ) { + errno = ERANGE; + return -1; + } + + strcpy(buf, name); + return 0; +} + long sysconf(int name) { if ( name == _SC_CLK_TCK ) { -- cgit v1.2.3-55-g6feb