Re: [patch] nl_langinfo.3: better explaination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Michael.

On Tue, Sep 28, 2010 at 1:45 PM, Michael Haardt <michael@xxxxxxxx> wrote:
> Hello,
>
> it could be more clear that nl_langinfo() interacts with setlocale().
> I made a patch against 3.27 and added a short example to query the
> terminal character set.

Thanks. Applied for man-pages-3.28.

Cheers,

Michael


> Michael
> ----------------------------------------------------------------------
> --- ./nl_langinfo.3.orig        2010-09-28 13:14:39.000000000 +0200
> +++ ./nl_langinfo.3     2010-09-28 13:33:26.000000000 +0200
> @@ -10,8 +10,9 @@
>  .\"   OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html
>  .\"
>  .\" Corrected prototype, 2002-10-18, aeb
> +.\" Modified 2010-09-28 by Michael Haardt
>  .\"
> -.TH NL_LANGINFO 3  2001-05-11 "GNU" "Linux Programmer's Manual"
> +.TH NL_LANGINFO 3 "GNU" "Linux Programmer's Manual"
>  .SH NAME
>  nl_langinfo \- query language and locale information
>  .SH SYNOPSIS
> @@ -97,7 +98,9 @@
>  For a more detailed list, consult
>  .IR "The GNU C Library Reference Manual" .
>  .SH "RETURN VALUE"
> -If no locale has been selected for the appropriate category,
> +If no locale has been selected by
> +.BR setlocale ()
> +for the appropriate category,
>  .BR nl_langinfo ()
>  returns a pointer to the corresponding string in the
>  "C" locale.
> @@ -109,6 +112,23 @@
>  .BR nl_langinfo ()
>  or
>  .BR setlocale (3).
> +.SH "EXAMPLE"
> +This 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
>  .SH "CONFORMING TO"
>  SUSv2, POSIX.1-2001.
>  .SH "SEE ALSO"
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux