.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" SUCH DAMAGE.
.\"
.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/locale/setlocale.3,v 1.33 2004/10/17 06:51:50 tjr Exp $
+.\" $FreeBSD$
.\"
.Dd November 21, 2003
.Dt SETLOCALE 3
.Sh SYNOPSIS
.In locale.h
.Ft char *
-.Fn setlocale "int category" "const char *locale"
+.Fo setlocale
+.Fa "int category"
+.Fa "const char *locale"
+.Fc
.Sh DESCRIPTION
The
.Fn setlocale
.Fn setlocale
function recognizes several categories of routines.
These are the categories and the sets of routines they select:
-.Pp
.Bl -tag -width LC_MONETARY
.It Dv LC_ALL
Set the entire locale generically.
function.
.El
.Pp
-Only three locales are defined by default,
+Only three locales are defined by default:
the empty string
-.Li "\&""\|""
-which denotes the native environment, and the
-.Li "\&""C""
+.Li \&"\|"
+(which denotes the native environment) and the
+.Li \&"C"
and
-.Li "\&""POSIX""
-locales, which denote the C language environment.
+.Li \&"POSIX"
+locales (which denote the C language environment).
A
.Fa locale
argument of
.Dv NULL
causes
.Fn setlocale
-to return the current locale.
+to return the current locale. An argument of
+.Li \&"\|"
+will determine the name of the new locale taking into account the environment
+variables LANG and LC_*. If these environment variables yield a locale that is
+invalid, NULL will be returned and the current locale will remain unchanged.
By default, C programs start in the
-.Li "\&""C""
+.Li \&"C"
locale.
The only function in the library that sets the locale is
.Fn setlocale ;
and
.Fa locale
makes no sense.
-.Sh ERRORS
-No errors are defined.
.Sh FILES
.Bl -tag -width /usr/share/locale/locale/category -compact
.It Pa $PATH_LOCALE/ Ns Em locale/category
.Em locale
and the category
.Em category .
+.It Pa /usr/local/share/locale/ Ns Em locale/category
+locale file for the locale
+.Em locale
+and the category
+.Em category .
.El
+.Sh ERRORS
+No errors are defined.
.Sh SEE ALSO
.Xr colldef 1 ,
.Xr mklocale 1 ,