logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

nl_langinfo.3p (5632B)


  1. '\" et
  2. .TH NL_LANGINFO "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. nl_langinfo,
  12. nl_langinfo_l
  13. \(em language information
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <langinfo.h>
  18. .P
  19. char *nl_langinfo(nl_item \fIitem\fP);
  20. char *nl_langinfo_l(nl_item \fIitem\fP, locale_t \fIlocale\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fInl_langinfo\fR()
  25. and
  26. \fInl_langinfo_l\fR()
  27. functions shall return a pointer to a string containing information
  28. relevant to the particular language or cultural area defined in the
  29. current locale, or in the locale represented by
  30. .IR locale ,
  31. respectively (see
  32. .IR <langinfo.h> ).
  33. The manifest constant names and values of
  34. .IR item
  35. are defined in
  36. .IR <langinfo.h> .
  37. For example:
  38. .sp
  39. .RS 4
  40. .nf
  41. nl_langinfo(ABDAY_1)
  42. .fi
  43. .P
  44. .RE
  45. .P
  46. would return a pointer to the string
  47. .BR \(dqDom\(dq
  48. if the identified language was Portuguese, and
  49. .BR \(dqSun\(dq
  50. if the identified language was English.
  51. .sp
  52. .RS 4
  53. .nf
  54. nl_langinfo_l(ABDAY_1, loc)
  55. .fi
  56. .P
  57. .RE
  58. .P
  59. would return a pointer to the string
  60. .BR \(dqDom\(dq
  61. if the identified language of the locale represented by
  62. .IR loc
  63. was Portuguese, and
  64. .BR \(dqSun\(dq
  65. if the identified language of the locale represented by
  66. .IR loc
  67. was English.
  68. .P
  69. The
  70. \fInl_langinfo\fR()
  71. function need not be thread-safe.
  72. .P
  73. The behavior is undefined if the
  74. .IR locale
  75. argument to
  76. \fInl_langinfo_l\fR()
  77. is the special locale object LC_GLOBAL_LOCALE or is not a valid locale
  78. object handle.
  79. .SH "RETURN VALUE"
  80. In a locale where
  81. .IR langinfo
  82. data is not defined, these functions shall return a pointer to the
  83. corresponding string in the POSIX locale. In all locales, these functions
  84. shall return a pointer to an empty string if
  85. .IR item
  86. contains an invalid setting.
  87. .P
  88. The application shall not modify the string returned. The pointer
  89. returned by
  90. \fInl_langinfo\fR()
  91. might be invalidated or the string content might be overwritten by a
  92. subsequent call to
  93. \fInl_langinfo\fR()
  94. in any thread or to
  95. \fInl_langinfo_l\fR()
  96. in the same thread or the initial thread, by subsequent calls to
  97. \fIsetlocale\fR()
  98. with a category corresponding to the category of
  99. .IR item
  100. (see
  101. .IR <langinfo.h> )
  102. or the category LC_ALL, or by subsequent calls to
  103. \fIuselocale\fR()
  104. which change the category corresponding to the category of
  105. .IR item .
  106. The pointer returned by
  107. \fInl_langinfo_l\fR()
  108. might be invalidated or the string content might be overwritten by a
  109. subsequent call to
  110. \fInl_langinfo_l\fR()
  111. in the same thread or to
  112. \fInl_langinfo\fR()
  113. in any thread, or by subsequent calls to
  114. \fIfreelocale\fR()
  115. or
  116. \fInewlocale\fR()
  117. which free or modify the locale object that was passed to
  118. \fInl_langinfo_l\fR().
  119. The returned pointer and the string content might also be
  120. invalidated if the calling thread is terminated.
  121. .SH "ERRORS"
  122. No errors are defined.
  123. .br
  124. .LP
  125. .IR "The following sections are informative."
  126. .SH EXAMPLES
  127. .SS "Getting Date and Time Formatting Information"
  128. .P
  129. The following example returns a pointer to a string containing date and
  130. time formatting information, as defined in the
  131. .IR LC_TIME
  132. category of the current locale.
  133. .sp
  134. .RS 4
  135. .nf
  136. #include <time.h>
  137. #include <langinfo.h>
  138. \&...
  139. strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm);
  140. \&...
  141. .fi
  142. .P
  143. .RE
  144. .SH "APPLICATION USAGE"
  145. The array pointed to by the return value should not be modified by the
  146. program, but may be modified by further calls to these functions.
  147. .SH RATIONALE
  148. The possible interactions between internal data used by
  149. \fInl_langinfo\fR()
  150. and
  151. \fInl_langinfo_l\fR()
  152. are complicated by the fact that
  153. \fInl_langinfo_l\fR()
  154. must be thread-safe but
  155. \fInl_langinfo\fR()
  156. need not be. The various implementation choices are:
  157. .IP " 1." 4
  158. \fInl_langinfo_l\fR()
  159. and
  160. \fInl_langinfo\fR()
  161. use separate buffers, or at least one of them does not use an internal
  162. string buffer. In this case there are no interactions.
  163. .IP " 2." 4
  164. \fInl_langinfo_l\fR()
  165. and
  166. \fInl_langinfo\fR()
  167. share an internal per-thread buffer. There can be interactions, but
  168. only in the same thread.
  169. .IP " 3." 4
  170. \fInl_langinfo_l\fR()
  171. uses an internal per-thread buffer, and
  172. \fInl_langinfo\fR()
  173. uses (in all threads) the same buffer that
  174. \fInl_langinfo_l\fR()
  175. uses in the initial thread. There can be interactions, but only when
  176. \fInl_langinfo_l\fR()
  177. is called in the initial thread.
  178. .SH "FUTURE DIRECTIONS"
  179. None.
  180. .SH "SEE ALSO"
  181. .IR "\fIsetlocale\fR\^(\|)",
  182. .IR "\fIuselocale\fR\^(\|)"
  183. .P
  184. The Base Definitions volume of POSIX.1\(hy2017,
  185. .IR "Chapter 7" ", " "Locale",
  186. .IR "\fB<langinfo.h>\fP",
  187. .IR "\fB<locale.h>\fP",
  188. .IR "\fB<nl_types.h>\fP"
  189. .\"
  190. .SH COPYRIGHT
  191. Portions of this text are reprinted and reproduced in electronic form
  192. from IEEE Std 1003.1-2017, Standard for Information Technology
  193. -- Portable Operating System Interface (POSIX), The Open Group Base
  194. Specifications Issue 7, 2018 Edition,
  195. Copyright (C) 2018 by the Institute of
  196. Electrical and Electronics Engineers, Inc and The Open Group.
  197. In the event of any discrepancy between this version and the original IEEE and
  198. The Open Group Standard, the original IEEE and The Open Group Standard
  199. is the referee document. The original Standard can be obtained online at
  200. http://www.opengroup.org/unix/online.html .
  201. .PP
  202. Any typographical or formatting errors that appear
  203. in this page are most likely
  204. to have been introduced during the conversion of the source files to
  205. man page format. To report such errors, see
  206. https://www.kernel.org/doc/man-pages/reporting_bugs.html .