History log of /freebsd-current/usr.bin/localedef/wide.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# ead8d64a 14-May-2017 Enji Cooper <ngie@FreeBSD.org>

Mark errf _Noreturn, and mark errf and warn __printflike

The _Noreturn attribute was added to placate Coverity and other static
analysis tools. The __printflike attribute was added to catch issues
with the calls related to printf(3) abuse.

- Modify the code to facilitate the __printflike attribute addition.
- Convert errf calls in to_mb(..) and to_mb_string(..) to warn(..) so
the calls will return instead of exiting, as the code suggests it
should.

Differential Revision: D10704
MFC after: 1 month
Reviewed by: pfg
Sponsored by: Dell EMC Isilon


# e12a957f 10-Mar-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

localedef(1): Add comment markings for license.


# 0b33b55b 28-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

Small typo.


# 55b270e6 08-Nov-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Eliminate some gcc pragmas


# 78be8e67 07-Nov-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Fix build on arm64


# 99b72f8f 06-Nov-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Add missing header


# 9f3e8dc2 07-Nov-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Fix typo


# d79cdd21 31-Oct-2015 Baptiste Daroussin <bapt@FreeBSD.org>

libc: Fix (and improve) nl_langinfo (CODESET)

The output of "locale charmap" is identical to the result of
nl_langinfo (CODESET) for any given locale. The logic for returning the
codeset was very simplistic. It just returned portion of the locale name
after the period (e.g. en_FR.ISO8859-1 returned "ISO8859-1").

When softlinks were added to locales, this broke. e.g.:
en_US returned ""
en_FR.UTF8 returned "UTF8"
en_FR.UTF-8 returned "UTF-8"
zh_Hant_HK.Big5HKSCS returned "Big5HKSCS"
zh_Hant_TW.Big5 returned "Big5"
es_ES@euro returned ""

In order to fix this properly, the named locale cannot be used to
determine the encoding. This information was almost available in the
rune data. Unfortunately, all the single byte encodings were listed
as "NONE" encoding.

So I adjusted localedef tool to provide more information about the
encoding. For example, instead of "NONE", the LC_CTYPE used by
fr_FR.ISO8859-15 is now encoded as "NONE:ISO8859-15". The locale
handlers now check if the first four characters of the encoding is
"NONE" and if so, treats it as a single-byte encoding.

The nl_langinfo handling of CODESET was adjusting accordingly. Now the
following is returned:
en_US returns "ISO8859-1"
fr_FR.UTF8 returns "UTF-8"
fr_FR.UTF-8 returns "UTF-8"
zh_Hant_HK.Big5HKSCS returns "Big5"
zh_Hant_TW.Big5 returns "Big5"
es_ES@euro returns "ISO8859-15"

as before, "C" and "POSIX" locales return "US-ASCII". This is a big
improvement. The result of nl_langinfo can never be a zero-length
string and it will always exclusively one of the values of the
character maps of /usr/src/tools/tools/locale/etc/final-maps.

Submitted by: marino
Obtained from: DragonflyBSD


# 057ca2d4 07-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Add localedef(1), a locale definition generator tool

The localedef tool can read entire (and unmodified) CLDR posix definition
files, and generate all 6 LC categories: LC_COLLATE, LC_CTYPE, LC_TIME,
LC_NUMERIC, LC_MONETARY and LC_MESSAGES.

This tool has a long history with Solaris. The Nexenta developers
modified it to read CLDR files and created the much richer collation
formats. The libc collation functions have to be modified to read the
new format (called "BSD-1.0") and to handle the new data structures.

The result will be that locale-sensitive tools and functions will now
properly sort multibyte and unicode strings.

Obtained from: Dragonfly