mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
. style(9)
. fix/add comments (to cover changes done thru last 20 months) . extend monetary testcase to cover int_* values
This commit is contained in:
parent
370c3cb57c
commit
683fe11379
7 changed files with 41 additions and 19 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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, "/");
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 *);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue