2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 2001 Markus Kuhn <mkuhn@acm.org>
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" References consulted:
|
|
|
|
.\" GNU glibc-2 manual
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
.\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" Corrected prototype, 2002-10-18, aeb
|
|
|
|
.\"
|
2010-10-03 16:02:21 +00:00
|
|
|
.TH NL_LANGINFO 3 2010-10-03 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
nl_langinfo \- query language and locale information
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <langinfo.h>
|
|
|
|
.sp
|
|
|
|
.BI "char *nl_langinfo(nl_item " item );
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR nl_langinfo ()
|
|
|
|
function provides access to locale information
|
2004-11-03 13:51:07 +00:00
|
|
|
in a more flexible way than
|
|
|
|
.BR localeconv (3)
|
2007-04-12 22:42:49 +00:00
|
|
|
does.
|
|
|
|
Individual and additional elements of the locale categories can
|
2004-11-03 13:51:07 +00:00
|
|
|
be queried.
|
|
|
|
.PP
|
|
|
|
Examples for the locale elements that can be specified in \fIitem\fP
|
2007-06-20 21:53:34 +00:00
|
|
|
using the constants defined in \fI<langinfo.h>\fP are:
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR CODESET \ (LC_CTYPE)
|
|
|
|
Return a string with the name of the character encoding used in the
|
|
|
|
selected locale, such as "UTF-8", "ISO-8859-1", or "ANSI_X3.4-1968"
|
2007-04-12 22:42:49 +00:00
|
|
|
(better known as US-ASCII).
|
|
|
|
This is the same string that you get with
|
|
|
|
"locale charmap".
|
|
|
|
For a list of character encoding names,
|
2004-11-03 13:51:07 +00:00
|
|
|
try "locale \-m", cf.\&
|
|
|
|
.BR locale (1).
|
|
|
|
.TP
|
|
|
|
.BR D_T_FMT \ (LC_TIME)
|
|
|
|
Return a string that can be used as a format string for
|
|
|
|
.BR strftime (3)
|
|
|
|
to represent time and date in a locale-specific way.
|
|
|
|
.TP
|
|
|
|
.BR D_FMT \ (LC_TIME)
|
|
|
|
Return a string that can be used as a format string for
|
|
|
|
.BR strftime (3)
|
|
|
|
to represent a date in a locale-specific way.
|
|
|
|
.TP
|
|
|
|
.BR T_FMT \ (LC_TIME)
|
|
|
|
Return a string that can be used as a format string for
|
|
|
|
.BR strftime (3)
|
|
|
|
to represent a time in a locale-specific way.
|
|
|
|
.TP
|
|
|
|
.BR DAY_ "{1\(en7} (LC_TIME)"
|
|
|
|
Return name of the \fIn\fP-th day of the week. [Warning: this follows
|
|
|
|
the US convention DAY_1 = Sunday, not the international convention
|
|
|
|
(ISO 8601) that Monday is the first day of the week.]
|
|
|
|
.TP
|
|
|
|
.BR ABDAY_ "{1\(en7} (LC_TIME)"
|
|
|
|
Return abbreviated name of the \fIn\fP-th day of the week.
|
|
|
|
.TP
|
|
|
|
.BR MON_ "{1\(en12} (LC_TIME)"
|
|
|
|
Return name of the \fIn\fP-th month.
|
|
|
|
.TP
|
|
|
|
.BR ABMON_ "{1\(en12} (LC_TIME)"
|
|
|
|
Return abbreviated name of the \fIn\fP-th month.
|
|
|
|
.TP
|
|
|
|
.BR RADIXCHAR \ (LC_NUMERIC)
|
|
|
|
Return radix character (decimal dot, decimal comma, etc.).
|
|
|
|
.TP
|
|
|
|
.BR THOUSEP \ (LC_NUMERIC)
|
|
|
|
Return separator character for thousands (groups of three digits).
|
|
|
|
.TP
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR YESEXPR \ (LC_MESSAGES)
|
|
|
|
Return a regular expression that can be used with the
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR regex (3)
|
|
|
|
function to recognize a positive response to a yes/no question.
|
|
|
|
.TP
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR NOEXPR \ (LC_MESSAGES)
|
|
|
|
Return a regular expression that can be used with the
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR regex (3)
|
|
|
|
function to recognize a negative response to a yes/no question.
|
|
|
|
.TP
|
|
|
|
.BR CRNCYSTR \ (LC_MONETARY)
|
|
|
|
Return the currency symbol, preceded by "\-" if the symbol should
|
|
|
|
appear before the value, "+" if the symbol should appear after the
|
|
|
|
value, or "." if the symbol should replace the radix character.
|
|
|
|
.PP
|
2007-04-12 22:42:49 +00:00
|
|
|
The above list covers just some examples of items that can be requested.
|
2006-09-06 12:38:32 +00:00
|
|
|
For a more detailed list, consult
|
2004-11-03 13:51:07 +00:00
|
|
|
.IR "The GNU C Library Reference Manual" .
|
|
|
|
.SH "RETURN VALUE"
|
2010-10-03 16:03:31 +00:00
|
|
|
If no locale has been selected by
|
Changes, clone.2, mount.2, nanosleep.2, sigaltstack.2, statfs.2, timer_settime.2, ctime.3, fmemopen.3, nl_langinfo.3, posix_memalign.3, pthread_attr_init.3, pthread_setaffinity_np.3, pthread_setschedprio.3, pthread_testcancel.3, setjmp.3, sigwait.3, tty_ioctl.4, epoll.7, posixoptions.7, unix.7: Add section number to references to functions documented in other pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-11-01 07:07:28 +00:00
|
|
|
.BR setlocale (3)
|
2010-10-03 16:03:31 +00:00
|
|
|
for the appropriate category,
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR nl_langinfo ()
|
|
|
|
returns a pointer to the corresponding string in the
|
2004-11-03 13:51:07 +00:00
|
|
|
"C" locale.
|
|
|
|
.PP
|
|
|
|
If \fIitem\fP is not valid, a pointer to an empty string is returned.
|
|
|
|
.PP
|
|
|
|
This pointer may point to static data that may be overwritten on the
|
2007-05-12 09:06:04 +00:00
|
|
|
next call to
|
|
|
|
.BR nl_langinfo ()
|
|
|
|
or
|
2007-05-21 22:14:09 +00:00
|
|
|
.BR setlocale (3).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "CONFORMING TO"
|
2006-08-03 13:57:30 +00:00
|
|
|
SUSv2, POSIX.1-2001.
|
2010-10-03 16:02:21 +00:00
|
|
|
.SH "EXAMPLE"
|
|
|
|
The following program sets the character type locale according to the
|
|
|
|
environment and queries the terminal character set.
|
|
|
|
.LP
|
|
|
|
.nf
|
|
|
|
#include <langinfo.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
setlocale(LC_CTYPE,"");
|
|
|
|
printf("%s\\n",nl_langinfo(CODESET));
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
.fi
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR locale (1),
|
|
|
|
.BR localeconv (3),
|
|
|
|
.BR setlocale (3),
|
|
|
|
.BR charsets (7),
|
2008-07-12 12:38:45 +00:00
|
|
|
.BR locale (7)
|
|
|
|
.br
|
2004-11-03 13:51:07 +00:00
|
|
|
The GNU C Library Reference Manual
|