strcoll, strcoll_l - string collation
#include <string.h> int strcoll(const char *s1, const char *s2);
int strcoll_l(const char *s1, const char *s2, locale_t locale);
Both strcoll() and strxfrm(3C) provide for locale-specific string sorting. strcoll() is intended for applications in which the number of comparisons per string is small. When strings are to be compared a number of times, strxfrm(3C) is a more appropriate function because the transformation process occurs only once. Same applies between strcoll_l() and strxfrm_l(3C).
The strcoll() and strcoll_l() functions compare the string pointed to by s1 to the string pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the current locale, or of the locale represented by locale, respectively.
The strcoll() and strcoll_l() functions do not change the setting of errno if successful.
Since no return value is reserved to indicate an error, an application wishing to check for error situations should set errno to 0, then call strcoll() or strcoll_l(), then check errno.
The behavior is undefined if the <locale> argument to strcoll_l() is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle.
Upon successful completion, strcoll() and strcoll_l() return an integer greater than, equal to, or less than zero in direct correlation to whether string s1 is greater than, equal to, or less than the string s2. The comparison is based on strings interpreted as appropriate to the current locale or locale represented by locale respectively, for category LC_COLLATE (see setlocale(3C)).
On error, strcoll() and strcoll_l() may set errno, but no return value is reserved to indicate an error.
The strcoll() and strcoll_l() function may fail if:
The s1 or s2 arguments contain characters outside the domain of the collating sequence.
LC_COLLATE database for locale
See attributes(7) for descriptions of the following attributes: