The cs_locale routine

Open Client/Server applications use the cs_locale routine to load a CS_LOCALE structure with custom localization information.

cs_locale is declared as follows:

CS_RETCODE cs_locale(context, action, locale, type,
 			buffer, buflen, outlen)
 
 CS_CONTEXT			*context;
 CS_INT			action;
 CS_LOCALE			*locale;
 CS_INT			type;
 CS_CHAR			*buffer;
 CS_INT			buflen;
 CS_INT			*outlen;

When called, cs_locale performs as follows:

  1. Determines what locale name to use.

    If the cs_locale buffer parameter is supplied, this parameter is the locale name.

    If the cs_locale buffer parameter is NULL, cs_locale checks for an environment variable corresponding to its type parameter and uses the value of this environment variable as the locale name.

    If an environment variable corresponding to type is not set, cs_locale uses a locale name of “default.”

  2. Looks up the locale name in the locales file to determine the associated language, character set, and collating sequence. If cs_locale cannot find a matching entry, it returns CS_FAIL.

  3. Loads the information specified by the cs_locale type parameter into the CS_LOCALE structure. For instance, if type is CS_LC_CTYPE, cs_locale loads character set information.

NoteIf cs_locale is called with a NULL buffer parameter, it examines the environment variable related to its type parameter to determine what to use as a locale name. If your application calls cs_locale with buffer as NULL, make sure that the appropriate environment variables have values that correspond to entries in the locales file.

For more information on cs_locale, see the Open Client and Open Server Common Libraries Reference Manual.