summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphantom <phantom@FreeBSD.org>2003-06-26 10:46:16 +0000
committerphantom <phantom@FreeBSD.org>2003-06-26 10:46:16 +0000
commitcd4974c7348424a7f4d7337db3b49ee377be4b47 (patch)
treec4082e435ee6853fb778299516517d7162496077
parentd45e58ad731761c5ee7051580c01c0a05c8d9322 (diff)
downloadFreeBSD-src-cd4974c7348424a7f4d7337db3b49ee377be4b47.zip
FreeBSD-src-cd4974c7348424a7f4d7337db3b49ee377be4b47.tar.gz
. style(9)
. fix/add comments (to cover changes done thru last 20 months) . extend monetary testcase to cover int_* values
-rw-r--r--lib/libc/locale/fix_grouping.c9
-rw-r--r--lib/libc/locale/ldpart.c3
-rw-r--r--lib/libc/locale/lmessages.c2
-rw-r--r--lib/libc/locale/lmonetary.c19
-rw-r--r--lib/libc/locale/lnumeric.c3
-rw-r--r--lib/libc/locale/localeconv.c1
-rw-r--r--lib/libc/locale/nl_langinfo.c23
7 files changed, 41 insertions, 19 deletions
diff --git a/lib/libc/locale/fix_grouping.c b/lib/libc/locale/fix_grouping.c
index db49e18..2e5bc04 100644
--- a/lib/libc/locale/fix_grouping.c
+++ b/lib/libc/locale/fix_grouping.c
@@ -34,12 +34,15 @@ __FBSDID("$FreeBSD$");
static const char nogrouping[] = { CHAR_MAX, '\0' };
/*
- * "3;3;-1" -> "\003\003\177"
+ * Internal helper used to convert grouping sequences from string
+ * representation into POSIX specified form, i.e.
+ *
+ * "3;3;-1" -> "\003\003\177\000"
*/
const char *
-__fix_locale_grouping_str(const char *str) {
-
+__fix_locale_grouping_str(const char *str)
+{
char *src, *dst;
char n;
diff --git a/lib/libc/locale/ldpart.c b/lib/libc/locale/ldpart.c
index 62f92fd..3c35e20 100644
--- a/lib/libc/locale/ldpart.c
+++ b/lib/libc/locale/ldpart.c
@@ -39,8 +39,8 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "un-namespace.h"
-#include "setlocale.h"
#include "ldpart.h"
+#include "setlocale.h"
static int split_lines(char *, const char *);
@@ -80,6 +80,7 @@ __part_load_locale(const char *name,
namesize = strlen(name) + 1;
/* 'PathLocale' must be already set & checked. */
+
/* Range checking not needed, 'name' size is limited */
strcpy(filename, _PathLocale);
strcat(filename, "/");
diff --git a/lib/libc/locale/lmessages.c b/lib/libc/locale/lmessages.c
index 06e56cd..3498be2 100644
--- a/lib/libc/locale/lmessages.c
+++ b/lib/libc/locale/lmessages.c
@@ -29,8 +29,8 @@ __FBSDID("$FreeBSD$");
#include <stddef.h>
-#include "lmessages.h"
#include "ldpart.h"
+#include "lmessages.h"
#define LCMESSAGES_SIZE_FULL (sizeof(struct lc_messages_T) / sizeof(char *))
#define LCMESSAGES_SIZE_MIN \
diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c
index facda8d..8d55ab2 100644
--- a/lib/libc/locale/lmonetary.c
+++ b/lib/libc/locale/lmonetary.c
@@ -30,8 +30,9 @@ __FBSDID("$FreeBSD$");
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
-#include "lmonetary.h"
+
#include "ldpart.h"
+#include "lmonetary.h"
extern int __mlocale_changed;
extern const char * __fix_locale_grouping_str(const char *);
@@ -112,7 +113,7 @@ __monetary_load_locale(const char *name)
/*
* The six additional C99 international monetary formatting
* parameters default to the national parameters when
- * reading FreeBSD 4 LC_MONETARY data files.
+ * reading FreeBSD LC_MONETARY data files.
*/
#define M_ASSIGN_ICHAR(NAME) \
do { \
@@ -159,6 +160,12 @@ printf( "int_curr_symbol = %s\n"
"n_sep_by_space = %d\n"
"p_sign_posn = %d\n"
"n_sign_posn = %d\n",
+ "int_p_cs_precedes = %d\n"
+ "int_p_sep_by_space = %d\n"
+ "int_n_cs_precedes = %d\n"
+ "int_n_sep_by_space = %d\n"
+ "int_p_sign_posn = %d\n"
+ "int_n_sign_posn = %d\n",
_monetary_locale.int_curr_symbol,
_monetary_locale.currency_symbol,
_monetary_locale.mon_decimal_point,
@@ -173,7 +180,13 @@ printf( "int_curr_symbol = %s\n"
_monetary_locale.n_cs_precedes[0],
_monetary_locale.n_sep_by_space[0],
_monetary_locale.p_sign_posn[0],
- _monetary_locale.n_sign_posn[0]
+ _monetary_locale.n_sign_posn[0],
+ _monetary_locale.int_p_cs_precedes[0],
+ _monetary_locale.int_p_sep_by_space[0],
+ _monetary_locale.int_n_cs_precedes[0],
+ _monetary_locale.int_n_sep_by_space[0],
+ _monetary_locale.int_p_sign_posn[0],
+ _monetary_locale.int_n_sign_posn[0]
);
}
#endif /* LOCALE_DEBUG */
diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c
index 93acccc..d4ed04f 100644
--- a/lib/libc/locale/lnumeric.c
+++ b/lib/libc/locale/lnumeric.c
@@ -28,8 +28,9 @@
__FBSDID("$FreeBSD$");
#include <limits.h>
-#include "lnumeric.h"
+
#include "ldpart.h"
+#include "lnumeric.h"
extern int __nlocale_changed;
extern const char *__fix_locale_grouping_str(const char *);
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
index d10ba1f..97c22dd 100644
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)localeconv.c 8.1 (Berkeley) 6/4/93";
__FBSDID("$FreeBSD$");
#include <locale.h>
+
#include "lmonetary.h"
#include "lnumeric.h"
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index d279d1a..9bd5082 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
+ * Copyright (c) 2001, 2003 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,22 +27,22 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <locale.h>
#include <langinfo.h>
#include <limits.h>
+#include <locale.h>
#include <stdlib.h>
#include <string.h>
-#include "../stdtime/timelocal.h"
#include "lnumeric.h"
-#include "lmonetary.h"
#include "lmessages.h"
+#include "lmonetary.h"
+#include "../stdtime/timelocal.h"
#define _REL(BASE) ((int)item-BASE)
char *
-nl_langinfo(nl_item item) {
-
+nl_langinfo(nl_item item)
+{
char *ret, *s, *cs;
static char *csym = NULL;
@@ -126,9 +126,9 @@ nl_langinfo(nl_item item) {
ret = (char*) __get_current_messages_locale()->noexpr;
break;
/*
- * All items marked with LEGACY are available, but not recomended
- * by SUSv2 to be used in portable applications since they're subject
- * to remove in future specification editions
+ * YESSTR and NOSTR items marked with LEGACY are available, but not
+ * recomended by SUSv2 to be used in portable applications since
+ * they're subject to remove in future specification editions.
*/
case YESSTR: /* LEGACY */
ret = (char*) __get_current_messages_locale()->yesstr;
@@ -136,6 +136,9 @@ nl_langinfo(nl_item item) {
case NOSTR: /* LEGACY */
ret = (char*) __get_current_messages_locale()->nostr;
break;
+ /*
+ * SUSv2 special formatted currency string
+ */
case CRNCYSTR:
ret = "";
cs = (char*) __get_current_monetary_locale()->currency_symbol;
@@ -162,7 +165,7 @@ nl_langinfo(nl_item item) {
}
}
break;
- case D_MD_ORDER: /* local extension */
+ case D_MD_ORDER: /* FreeBSD local extension */
ret = (char *) __get_current_time_locale()->md_order;
break;
default:
OpenPOWER on IntegriCloud