From 7e6a84d77b53451498d31c4b621a7ba55a8f7db6 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 29 Nov 2012 10:29:32 +0000 Subject: du: enable for MINGW with fake block count --- configs/mingw32_defconfig | 6 +++--- coreutils/du.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index 94380c22f..7ed14c40b 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.21.0.git -# Wed Oct 10 13:02:18 2012 +# Thu Nov 29 10:22:19 2012 # CONFIG_HAVE_DOT_CONFIG=y # CONFIG_PLATFORM_POSIX is not set @@ -215,8 +215,8 @@ CONFIG_FEATURE_DD_IBS_OBS=y CONFIG_DIRNAME=y CONFIG_DOS2UNIX=y CONFIG_UNIX2DOS=y -# CONFIG_DU is not set -# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y CONFIG_ECHO=y CONFIG_FEATURE_FANCY_ECHO=y CONFIG_ENV=y diff --git a/coreutils/du.c b/coreutils/du.c index 19a0319f1..04e78f982 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -127,7 +127,11 @@ static unsigned long long du(const char *filename) } } +#if !ENABLE_PLATFORM_MINGW32 sum = statbuf.st_blocks; +#else + sum = (statbuf.st_size+511)/512; +#endif if (S_ISLNK(statbuf.st_mode)) { if (G.slink_depth > G.du_depth) { /* -H or -L */ @@ -136,7 +140,11 @@ static unsigned long long du(const char *filename) G.status = EXIT_FAILURE; return 0; } +#if !ENABLE_PLATFORM_MINGW32 sum = statbuf.st_blocks; +#else + sum = (statbuf.st_size+511)/512; +#endif if (G.slink_depth == 1) { /* Convert -H to -L */ G.slink_depth = INT_MAX; -- cgit v1.2.3-55-g6feb