summaryrefslogtreecommitdiffhomepage
path: root/coreutils/seq.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-06-15 15:47:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-06-15 15:47:58 +0200
commit9517d8ad72c8db8336ea8dba05a64df44688dec8 (patch)
tree56395f6a42da68a2d719bfd9ce20db8282f7a0c0 /coreutils/seq.c
parent6548edd430271f6b6d2b295c77a4fdaec51a2468 (diff)
seq: fix input handling in non-C locales
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/seq.c')
-rw-r--r--coreutils/seq.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/coreutils/seq.c b/coreutils/seq.c
index bb39a5b54..03ae3c632 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -22,8 +22,15 @@ int seq_main(int argc, char **argv)
unsigned width;
unsigned frac_part;
const char *sep, *opt_s = "\n";
- unsigned opt = getopt32(argv, "+ws:", &opt_s);
+ unsigned opt;
+#if ENABLE_LOCALE_SUPPORT
+ /* Undo busybox.c: on input, we want to use dot
+ * as fractional separator, regardless of current locale */
+ setlocale(LC_NUMERIC, "C");
+#endif
+
+ opt = getopt32(argv, "+ws:", &opt_s);
argc -= optind;
argv += optind;
first = increment = 1;
@@ -44,6 +51,10 @@ int seq_main(int argc, char **argv)
bb_show_usage();
}
+#if ENABLE_LOCALE_SUPPORT
+ setlocale(LC_NUMERIC, "");
+#endif
+
/* Last checked to be compatible with: coreutils-6.10 */
width = 0;
frac_part = 0;