watch,free: interpet intervals in non-locale way

Both watch and free used the locale to determine the required delay
interval for subsequent updates. It's preferable to not care about
locale and accept both 12.34 and 12,34 as meaning 12 seconds and
340 microseconds.

References:
 https://bugs.debian.org/692113

Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
Craig Small
2016-07-03 16:14:36 +10:00
parent d936f62eec
commit 1310a76848
4 changed files with 7 additions and 9 deletions

4
free.c
View File

@ -324,9 +324,7 @@ int main(int argc, char **argv)
case 's':
flags |= FREE_REPEAT;
errno = 0;
args.repeat_interval = (1000000 * strtof(optarg, &endptr));
if (errno || optarg == endptr || (endptr && *endptr))
xerrx(EXIT_FAILURE, _("seconds argument `%s' failed"), optarg);
args.repeat_interval = (1000000 * strtod_nol_or_err(optarg, "seconds argument failed"));
if (args.repeat_interval < 1)
xerrx(EXIT_FAILURE,
_("seconds argument `%s' is not positive number"), optarg);