From 6cd5aacd98782ca3497e8bf584d3791ef8678804 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Tue, 14 Sep 2010 20:07:22 +1000 Subject: win32: enable whoami --- coreutils/whoami.c | 10 ++++++++++ scripts/defconfig.mingw32 | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 78d20db14..f7ac7aa6d 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -16,11 +16,21 @@ int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) { +#if ENABLE_PLATFORM_MINGW32 + char buf[64]; + DWORD len = 64; +#endif + if (argv[1]) bb_show_usage(); +#if ENABLE_PLATFORM_MINGW32 + GetUserName(buf, &len); + puts(buf); +#else /* Will complain and die if username not found */ puts(xuid2uname(geteuid())); +#endif return fflush_all(); } diff --git a/scripts/defconfig.mingw32 b/scripts/defconfig.mingw32 index 66422f9b0..0c5e40559 100644 --- a/scripts/defconfig.mingw32 +++ b/scripts/defconfig.mingw32 @@ -284,7 +284,7 @@ CONFIG_UUENCODE=y CONFIG_WC=y CONFIG_FEATURE_WC_LARGE=y # CONFIG_WHO is not set -# CONFIG_WHOAMI is not set +CONFIG_WHOAMI=y CONFIG_YES=y # -- cgit v1.2.3-55-g6feb