STRXFRM(3)

NAME
strxfrm, strxfrm_l - transform a string under locale

SYNOPSIS
#include <string.h>
size_t
strxfrm(char *dst, const char *src, size_t n);
#include <xlocale.h>
size_t
strxfrm_l(char *dst, const char *src, size_t n, locale_t locale);

DESCRIPTION
The idea of strxfrm() and strxfrm_l() is to “un-localize” a string: the functions transform src, storing the result in dst, such that strcmp(3) on transformed strings returns what strcoll(3) on the original untransformed strings would return. n is the maximal amount of bytes that can be written to dst , however if n is 0 this function returns the amount of bytes that the transformed string would require --usefull to allocate space before calling again.

The function strcoll() uses the current locale collation, while strcoll_l() uses the given locale, see xlocale(3)

RETURN VALUE
Length of the string transformed (not counting NUL). If such lenght is greather than the contents of dst is unspecified.

ENVIRONMENT
The behaviour of strxfrm() depends on the LC_CTYPE and LC_COLLATE locale(1).

CAVEATS
On adJ the implementation is enough for the portion of UTF-8 translatable to ISO8859-1.

SEE ALSO
newlocale(3), locale(1), setlocale(3), strcmp(3), strcoll(3), strlcpy(3), wcsxfrm(3)

STANDARDS
The strxfrm() function conforms to ansiC, and strxfrm_l() to p1003.1-2008.

HISTORY
The strxfrm() function has been available since 4.3BSD Reno, and strxfrm_l() since OpenBSD 6.2 and since adJ 5.6 (derive from FreeBSD).