summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMartin Pelikan <pelikan@cvs.openbsd.org>2014-07-14 07:22:08 +0000
committerMartin Pelikan <pelikan@cvs.openbsd.org>2014-07-14 07:22:08 +0000
commitafda1f50262607e949ebcbea1e8a310d6a0abc60 (patch)
tree6de8a7995f27d87e338f98f757eae51d2780d388 /lib/libc
parentaf5b891568cb5c7890063a6cdd63db156fb9c876 (diff)
international currency locale rules as per POSIX.1-2008
required for libc++ ok guenther afresh1
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/_def_monetary.c12
-rw-r--r--lib/libc/locale/localeconv.c8
-rw-r--r--lib/libc/locale/setlocale.334
3 files changed, 49 insertions, 5 deletions
diff --git a/lib/libc/locale/_def_monetary.c b/lib/libc/locale/_def_monetary.c
index aa92c75d111..c050020ee4a 100644
--- a/lib/libc/locale/_def_monetary.c
+++ b/lib/libc/locale/_def_monetary.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: _def_monetary.c,v 1.4 2005/08/08 08:05:35 espie Exp $ */
+/* $OpenBSD: _def_monetary.c,v 1.5 2014/07/14 07:22:07 pelikan Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
@@ -19,12 +19,20 @@ const _MonetaryLocale _DefaultMonetaryLocale =
"",
CHAR_MAX,
CHAR_MAX,
+
+ CHAR_MAX, /* local p_cs_precedes */
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+
+ CHAR_MAX, /* intl p_cs_precedes */
CHAR_MAX,
CHAR_MAX,
CHAR_MAX,
CHAR_MAX,
CHAR_MAX,
- CHAR_MAX
};
const _MonetaryLocale *_CurrentMonetaryLocale = &_DefaultMonetaryLocale;
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
index 989eb4bca65..8421fa3d953 100644
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: localeconv.c,v 1.5 2005/08/08 08:05:35 espie Exp $ */
+/* $OpenBSD: localeconv.c,v 1.6 2014/07/14 07:22:07 pelikan Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
@@ -44,6 +44,12 @@ localeconv(void)
ret.n_sep_by_space = _CurrentMonetaryLocale->n_sep_by_space;
ret.p_sign_posn = _CurrentMonetaryLocale->p_sign_posn;
ret.n_sign_posn = _CurrentMonetaryLocale->n_sign_posn;
+ ret.int_p_cs_precedes = _CurrentMonetaryLocale->int_p_cs_precedes;
+ ret.int_p_sep_by_space = _CurrentMonetaryLocale->int_p_sep_by_space;
+ ret.int_n_cs_precedes = _CurrentMonetaryLocale->int_n_cs_precedes;
+ ret.int_n_sep_by_space = _CurrentMonetaryLocale->int_n_sep_by_space;
+ ret.int_p_sign_posn = _CurrentMonetaryLocale->int_p_sign_posn;
+ ret.int_n_sign_posn = _CurrentMonetaryLocale->int_n_sign_posn;
__mlocale_changed = 0;
}
diff --git a/lib/libc/locale/setlocale.3 b/lib/libc/locale/setlocale.3
index b570f19331d..6836da5a860 100644
--- a/lib/libc/locale/setlocale.3
+++ b/lib/libc/locale/setlocale.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setlocale.3,v 1.14 2013/06/05 03:39:22 tedu Exp $
+.\" $OpenBSD: setlocale.3,v 1.15 2014/07/14 07:22:07 pelikan Exp $
.\" $NetBSD: setlocale.3,v 1.3 1997/07/14 23:19:47 kleink Exp $
.\"
.\" Copyright (c) 1993
@@ -33,7 +33,7 @@
.\"
.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: June 5 2013 $
+.Dd $Mdocdate: July 14 2014 $
.Dt SETLOCALE 3
.Os
.Sh NAME
@@ -150,6 +150,12 @@ struct lconv {
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
+ char int_p_cs_precedes;
+ char int_p_sep_by_space;
+ char int_n_cs_precedes;
+ char int_n_sep_by_space;
+ char int_p_sign_posn;
+ char int_n_sign_posn;
};
.Ed
.Pp
@@ -236,6 +242,30 @@ Just after
Like
.Fa p_sign_posn
but for negative currency values.
+.It Fa int_p_cs_precedes
+Like
+.Fa p_cs_precedes
+but for the international symbol.
+.It Fa int_n_cs_precedes
+Like
+.Fa n_cs_precedes
+but for the international symbol.
+.It Fa int_p_sep_by_space
+Like
+.Fa p_sep_by_space
+but for the international symbol.
+.It Fa int_n_sep_by_space
+Like
+.Fa n_sep_by_space
+but for the international symbol.
+.It Fa int_p_sign_posn
+Like
+.Fa p_sign_posn
+but for the international symbol.
+.It Fa int_n_sign_posn
+Like
+.Fa n_sign_posn
+but for the international symbol.
.El
.Pp
Unless mentioned above,