component of the current locale.
@item DECIMAL
@anchor{SET DECIMAL}
-The default DOT setting causes the decimal point character to be
-@samp{.} and the grouping character to be @samp{,}. A setting of COMMA
+This value may be set to DOT or COMMA.
+Setting it to DOT causes the decimal point character to be
+@samp{.} and the grouping character to be @samp{,}.
+Setting it to COMMA
causes the decimal point character to be @samp{,} and the grouping
character to be @samp{.}.
+The default value is determined from the system locale.
@item FORMAT
Allows the default numeric input/output format to be specified. The
settings_set_epoch (-1);
i18n_init ();
the_settings.styles = fmt_create ();
+
+ settings_set_decimal_char (get_system_decimal ());
}
void
#include <localcharset.h>
#include "xstrndup.h"
+#if HAVE_NL_LANGINFO
+#include <langinfo.h>
+#endif
+
static char *locale = 0;
static const char *charset;
}
}
+
+
+
+/* Return the system local's idea of the
+ decimal seperator character */
+char
+get_system_decimal (void)
+{
+ char *radix_char = NULL;
+
+ char *ol = setlocale (LC_NUMERIC, NULL);
+ setlocale (LC_NUMERIC, "");
+
+#if HAVE_NL_LANGINFO
+ radix_char = nl_langinfo (RADIXCHAR);
+#else
+ {
+ char *buf = xmalloc (10);
+ snprintf (buf, 10, "%f", 2.5);
+ radix_char = &buf[1];
+ }
+#endif
+
+ /* We MUST leave LC_NUMERIC untouched, since it would
+ otherwise interfere with data_{in,out} */
+ setlocale (LC_NUMERIC, ol);
+ return *radix_char;
+}
+
char * recode_string (enum conv_id how, const char *text, int len);
+/* Return the decimal separator according to the
+ system locale */
+char get_system_decimal (void);
#endif /* i18n.h */
# Allow locale_charset to find charset.alias before running "make install".
TESTS_ENVIRONMENT += CHARSETALIASDIR='$(abs_top_builddir)/gl'
+TESTS_ENVIRONMENT += LC_ALL=C
+
dist_TESTS = \
tests/command/aggregate.sh \
tests/command/attributes.sh \