158f0484fSRodney W. Grimes.\" Copyright (c) 1993 258f0484fSRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 358f0484fSRodney W. Grimes.\" 458f0484fSRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 558f0484fSRodney W. Grimes.\" Donn Seeley at BSDI. 658f0484fSRodney W. Grimes.\" 758f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 858f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions 958f0484fSRodney W. Grimes.\" are met: 1058f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 1158f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 1258f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 1358f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 1458f0484fSRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 15*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 1658f0484fSRodney W. Grimes.\" may be used to endorse or promote products derived from this software 1758f0484fSRodney W. Grimes.\" without specific prior written permission. 1858f0484fSRodney W. Grimes.\" 1958f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2058f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2158f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2258f0484fSRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2358f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2458f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2558f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2658f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2758f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2858f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2958f0484fSRodney W. Grimes.\" SUCH DAMAGE. 3058f0484fSRodney W. Grimes.\" 3158f0484fSRodney W. Grimes.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 327f3dea24SPeter Wemm.\" $FreeBSD$ 3358f0484fSRodney W. Grimes.\" 34da44487bSTim J. Robbins.Dd November 21, 2003 3558f0484fSRodney W. Grimes.Dt SETLOCALE 3 3658f0484fSRodney W. Grimes.Os 3758f0484fSRodney W. Grimes.Sh NAME 38da44487bSTim J. Robbins.Nm setlocale 3958f0484fSRodney W. Grimes.Nd natural language formatting for C 4025bb73e0SAlexey Zelkin.Sh LIBRARY 4125bb73e0SAlexey Zelkin.Lb libc 4258f0484fSRodney W. Grimes.Sh SYNOPSIS 4332eef9aeSRuslan Ermilov.In locale.h 4458f0484fSRodney W. Grimes.Ft char * 4558f0484fSRodney W. Grimes.Fn setlocale "int category" "const char *locale" 4658f0484fSRodney W. Grimes.Sh DESCRIPTION 4758f0484fSRodney W. GrimesThe 4858f0484fSRodney W. Grimes.Fn setlocale 4958f0484fSRodney W. Grimesfunction sets the C library's notion 5058f0484fSRodney W. Grimesof natural language formatting style 5158f0484fSRodney W. Grimesfor particular sets of routines. 5258f0484fSRodney W. GrimesEach such style is called a 5358f0484fSRodney W. Grimes.Sq locale 5458f0484fSRodney W. Grimesand is invoked using an appropriate name passed as a C string. 5558f0484fSRodney W. Grimes.Pp 5658f0484fSRodney W. GrimesThe 5758f0484fSRodney W. Grimes.Fn setlocale 5858f0484fSRodney W. Grimesfunction recognizes several categories of routines. 5958f0484fSRodney W. GrimesThese are the categories and the sets of routines they select: 6058f0484fSRodney W. Grimes.Bl -tag -width LC_MONETARY 6158f0484fSRodney W. Grimes.It Dv LC_ALL 6258f0484fSRodney W. GrimesSet the entire locale generically. 6358f0484fSRodney W. Grimes.It Dv LC_COLLATE 6458f0484fSRodney W. GrimesSet a locale for string collation routines. 6558f0484fSRodney W. GrimesThis controls alphabetic ordering in 6658f0484fSRodney W. Grimes.Fn strcoll 6758f0484fSRodney W. Grimesand 6858f0484fSRodney W. Grimes.Fn strxfrm . 6958f0484fSRodney W. Grimes.It Dv LC_CTYPE 7058f0484fSRodney W. GrimesSet a locale for the 7131d330fbSTim J. Robbins.Xr ctype 3 7258f0484fSRodney W. Grimesand 7331d330fbSTim J. Robbins.Xr multibyte 3 7458f0484fSRodney W. Grimesfunctions. 7558f0484fSRodney W. GrimesThis controls recognition of upper and lower case, 7658f0484fSRodney W. Grimesalphabetic or non-alphabetic characters, 771a0a9345SRuslan Ermilovand so on. 780b5e953bSAndrey A. Chernov.It Dv LC_MESSAGES 79271632b0SAndrey A. ChernovSet a locale for message catalogs, see 80271632b0SAndrey A. Chernov.Xr catopen 3 81271632b0SAndrey A. Chernovfunction. 8258f0484fSRodney W. Grimes.It Dv LC_MONETARY 8358f0484fSRodney W. GrimesSet a locale for formatting monetary values; 8458f0484fSRodney W. Grimesthis affects the 8558f0484fSRodney W. Grimes.Fn localeconv 8658f0484fSRodney W. Grimesfunction. 8758f0484fSRodney W. Grimes.It Dv LC_NUMERIC 8858f0484fSRodney W. GrimesSet a locale for formatting numbers. 8958f0484fSRodney W. GrimesThis controls the formatting of decimal points 9058f0484fSRodney W. Grimesin input and output of floating point numbers 9158f0484fSRodney W. Grimesin functions such as 9258f0484fSRodney W. Grimes.Fn printf 9358f0484fSRodney W. Grimesand 9458f0484fSRodney W. Grimes.Fn scanf , 9558f0484fSRodney W. Grimesas well as values returned by 9658f0484fSRodney W. Grimes.Fn localeconv . 9758f0484fSRodney W. Grimes.It Dv LC_TIME 9858f0484fSRodney W. GrimesSet a locale for formatting dates and times using the 9958f0484fSRodney W. Grimes.Fn strftime 10058f0484fSRodney W. Grimesfunction. 10158f0484fSRodney W. Grimes.El 10258f0484fSRodney W. Grimes.Pp 10358f0484fSRodney W. GrimesOnly three locales are defined by default, 10458f0484fSRodney W. Grimesthe empty string 1053d05ebbcSUlrich Spörlein.Li \&"\|" 10658f0484fSRodney W. Grimeswhich denotes the native environment, and the 1073d05ebbcSUlrich Spörlein.Li \&"C" 10858f0484fSRodney W. Grimesand 1093d05ebbcSUlrich Spörlein.Li \&"POSIX" 11058f0484fSRodney W. Grimeslocales, which denote the C language environment. 11158f0484fSRodney W. GrimesA 11258f0484fSRodney W. Grimes.Fa locale 11358f0484fSRodney W. Grimesargument of 11458f0484fSRodney W. Grimes.Dv NULL 11558f0484fSRodney W. Grimescauses 11658f0484fSRodney W. Grimes.Fn setlocale 11758f0484fSRodney W. Grimesto return the current locale. 11858f0484fSRodney W. GrimesBy default, C programs start in the 1193d05ebbcSUlrich Spörlein.Li \&"C" 12058f0484fSRodney W. Grimeslocale. 12158f0484fSRodney W. GrimesThe only function in the library that sets the locale is 12258f0484fSRodney W. Grimes.Fn setlocale ; 12358f0484fSRodney W. Grimesthe locale is never changed as a side effect of some other routine. 124f80eb0cbSRuslan Ermilov.Sh RETURN VALUES 125f80eb0cbSRuslan ErmilovUpon successful completion, 126ecffe713SAndrey A. Chernov.Fn setlocale 127f80eb0cbSRuslan Ermilovreturns the string associated with the specified 128ecffe713SAndrey A. Chernov.Fa category 129ecffe713SAndrey A. Chernovfor the requested 130ecffe713SAndrey A. Chernov.Fa locale . 13158f0484fSRodney W. GrimesThe 13258f0484fSRodney W. Grimes.Fn setlocale 13358f0484fSRodney W. Grimesfunction returns 13458f0484fSRodney W. Grimes.Dv NULL 13558f0484fSRodney W. Grimesand fails to change the locale 13658f0484fSRodney W. Grimesif the given combination of 13758f0484fSRodney W. Grimes.Fa category 13858f0484fSRodney W. Grimesand 13958f0484fSRodney W. Grimes.Fa locale 14058f0484fSRodney W. Grimesmakes no sense. 14158f0484fSRodney W. Grimes.Sh FILES 14258f0484fSRodney W. Grimes.Bl -tag -width /usr/share/locale/locale/category -compact 14321b4da07SAndrey A. Chernov.It Pa $PATH_LOCALE/ Ns Em locale/category 1446a145130SMike Pritchard.It Pa /usr/share/locale/ Ns Em locale/category 1456a145130SMike Pritchardlocale file for the locale 1466a145130SMike Pritchard.Em locale 1476a145130SMike Pritchardand the category 1486a145130SMike Pritchard.Em category . 14958f0484fSRodney W. Grimes.El 15024a0682cSRuslan Ermilov.Sh ERRORS 15124a0682cSRuslan ErmilovNo errors are defined. 152f80eb0cbSRuslan Ermilov.Sh SEE ALSO 1538c9c6676SMike Pritchard.Xr colldef 1 , 1548c9c6676SMike Pritchard.Xr mklocale 1 , 155acd80190SWolfram Schneider.Xr catopen 3 , 156e69bcfc3SAlexander Langer.Xr ctype 3 , 157da44487bSTim J. Robbins.Xr localeconv 3 , 15858f0484fSRodney W. Grimes.Xr multibyte 3 , 15958f0484fSRodney W. Grimes.Xr strcoll 3 , 16058f0484fSRodney W. Grimes.Xr strxfrm 3 , 1618962b7a5STim J. Robbins.Xr euc 5 , 162e6e9fb74SAndrey A. Chernov.Xr utf8 5 , 163e6e9fb74SAndrey A. Chernov.Xr environ 7 16458f0484fSRodney W. Grimes.Sh STANDARDS 16558f0484fSRodney W. GrimesThe 16658f0484fSRodney W. Grimes.Fn setlocale 167da44487bSTim J. Robbinsfunction conforms to 168f4da1a75STim J. Robbins.St -isoC-99 . 16958f0484fSRodney W. Grimes.Sh HISTORY 17058f0484fSRodney W. GrimesThe 17158f0484fSRodney W. Grimes.Fn setlocale 172da44487bSTim J. Robbinsfunction first appeared in 1737bdf80e5SMike Pritchard.Bx 4.4 . 174