From c2bd0b680667c7ec4956552f75d9ff7d040ac941 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 23 Mar 2021 13:50:02 +0100 Subject: timeout,top,watch,ping: parse NN.N fractional duration in locales with other separators Signed-off-by: Denys Vlasenko --- coreutils/printf.c | 1 + coreutils/sleep.c | 4 ---- coreutils/sort.c | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'coreutils') diff --git a/coreutils/printf.c b/coreutils/printf.c index a20fc33..dd94c8a 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -122,6 +122,7 @@ static void FAST_FUNC conv_strtod(const char *arg, void *result) char *end; /* Well, this one allows leading whitespace... so what? */ /* What I like much less is that "-" accepted too! :( */ +//TODO: needs setlocale(LC_NUMERIC, "C")? *(double*)result = strtod(arg, &end); if (end[0]) { errno = ERANGE; diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 7bfaab9..2658e84 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c @@ -74,10 +74,6 @@ int sleep_main(int argc UNUSED_PARAM, char **argv) sleep(INT_MAX); #if ENABLE_FEATURE_FANCY_SLEEP -# if ENABLE_FLOAT_DURATION - /* undo busybox.c setlocale */ - setlocale(LC_NUMERIC, "C"); -# endif duration = 0; do { duration += parse_duration_str(*argv); diff --git a/coreutils/sort.c b/coreutils/sort.c index b194847..6c4e303 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -295,6 +295,7 @@ static int compare_keys(const void *xarg, const void *yarg) #if ENABLE_FEATURE_SORT_BIG case FLAG_g: { char *xx, *yy; +//TODO: needs setlocale(LC_NUMERIC, "C")? double dx = strtod(x, &xx); double dy = strtod(y, &yy); /* not numbers < NaN < -infinity < numbers < +infinity) */ -- cgit v1.1