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

catopen.3p (5955B)


  1. '\" et
  2. .TH CATOPEN "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. catopen
  12. \(em open a message catalog
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <nl_types.h>
  17. .P
  18. nl_catd catopen(const char *\fIname\fP, int \fIoflag\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIcatopen\fR()
  23. function shall open a message catalog and return a message catalog
  24. descriptor. The
  25. .IR name
  26. argument specifies the name of the message catalog to be opened. If
  27. .IR name
  28. contains a
  29. .BR '/' ,
  30. then
  31. .IR name
  32. specifies a pathname for the message catalog. Otherwise, the
  33. environment variable
  34. .IR NLSPATH
  35. is used with
  36. .IR name
  37. substituted for the
  38. .BR %N
  39. conversion specification (see the Base Definitions volume of POSIX.1\(hy2017,
  40. .IR "Chapter 8" ", " "Environment Variables");
  41. if
  42. .IR NLSPATH
  43. exists in the environment when the process starts, then if the process
  44. has appropriate privileges, the behavior of
  45. \fIcatopen\fR()
  46. is undefined. If
  47. .IR NLSPATH
  48. does not exist in the environment, or if a message catalog cannot be
  49. found in any of the components specified by
  50. .IR NLSPATH ,
  51. then an implementation-defined default path shall be used. This default
  52. may be affected by the setting of
  53. .IR LC_MESSAGES
  54. if the value of
  55. .IR oflag
  56. is NL_CAT_LOCALE, or the
  57. .IR LANG
  58. environment variable if
  59. .IR oflag
  60. is 0.
  61. .P
  62. A message catalog descriptor shall remain valid in a process until that
  63. process closes it, or a successful call to one of the
  64. .IR exec
  65. functions. A change in the setting of the
  66. .IR LC_MESSAGES
  67. category may invalidate existing open catalogs.
  68. .P
  69. If a file descriptor is used to implement message catalog descriptors,
  70. the FD_CLOEXEC flag shall be set; see
  71. .IR <fcntl.h> .
  72. .P
  73. If the value of the
  74. .IR oflag
  75. argument is 0, the
  76. .IR LANG
  77. environment variable is used to locate the catalog without regard to
  78. the
  79. .IR LC_MESSAGES
  80. category. If the
  81. .IR oflag
  82. argument is NL_CAT_LOCALE, the
  83. .IR LC_MESSAGES
  84. category is used to locate the message catalog (see the Base Definitions volume of POSIX.1\(hy2017,
  85. .IR "Section 8.2" ", " "Internationalization Variables").
  86. .SH "RETURN VALUE"
  87. Upon successful completion,
  88. \fIcatopen\fR()
  89. shall return a message catalog descriptor for use on subsequent calls to
  90. \fIcatgets\fR()
  91. and
  92. \fIcatclose\fR().
  93. Otherwise,
  94. \fIcatopen\fR()
  95. shall return (\c
  96. .BR nl_catd )
  97. \-1 and set
  98. .IR errno
  99. to indicate the error.
  100. .SH ERRORS
  101. The
  102. \fIcatopen\fR()
  103. function may fail if:
  104. .TP
  105. .BR EACCES
  106. Search permission is denied for the component of the path prefix of the
  107. message catalog or read permission is denied for the message catalog.
  108. .TP
  109. .BR EMFILE
  110. All file descriptors available to the process are currently open.
  111. .TP
  112. .BR ENAMETOOLONG
  113. .br
  114. The length of a component of a pathname is longer than
  115. {NAME_MAX}.
  116. .TP
  117. .BR ENAMETOOLONG
  118. .br
  119. The length of a pathname exceeds
  120. {PATH_MAX},
  121. or pathname resolution of a symbolic link produced an intermediate
  122. result with a length that exceeds
  123. {PATH_MAX}.
  124. .TP
  125. .BR ENFILE
  126. Too many files are currently open in the system.
  127. .TP
  128. .BR ENOENT
  129. The message catalog does not exist or the
  130. .IR name
  131. argument points to an empty string.
  132. .TP
  133. .BR ENOMEM
  134. Insufficient storage space is available.
  135. .TP
  136. .BR ENOTDIR
  137. A component of the path prefix of the message catalog names an existing
  138. file that is neither a directory nor a symbolic link to a directory,
  139. or the pathname of the message catalog contains at least one non-\c
  140. <slash>
  141. character and ends with one or more trailing
  142. <slash>
  143. characters and the last pathname component names an existing file
  144. that is neither a directory nor a symbolic link to a directory.
  145. .LP
  146. .IR "The following sections are informative."
  147. .SH EXAMPLES
  148. None.
  149. .SH "APPLICATION USAGE"
  150. Some implementations of
  151. \fIcatopen\fR()
  152. use
  153. \fImalloc\fR()
  154. to allocate space for internal buffer areas. The
  155. \fIcatopen\fR()
  156. function may fail if there is insufficient storage space available to
  157. accommodate these buffers.
  158. .P
  159. Conforming applications must assume that message catalog descriptors are
  160. not valid after a call to one of the
  161. .IR exec
  162. functions.
  163. .P
  164. Application developers should be aware that guidelines for the location
  165. of message catalogs have not yet been developed. Therefore they should
  166. take care to avoid conflicting with catalogs used by other applications
  167. and the standard utilities.
  168. .P
  169. To be sure that messages produced by an application running with
  170. appropriate privileges cannot be used by an attacker setting an
  171. unexpected value for
  172. .IR NLSPATH
  173. in the environment to confuse a system administrator, such
  174. applications should use pathnames containing a
  175. .BR '/'
  176. to get defined behavior when using
  177. \fIcatopen\fR()
  178. to open a message catalog.
  179. .SH RATIONALE
  180. None.
  181. .SH "FUTURE DIRECTIONS"
  182. None.
  183. .SH "SEE ALSO"
  184. .IR "\fIcatclose\fR\^(\|)",
  185. .IR "\fIcatgets\fR\^(\|)"
  186. .P
  187. The Base Definitions volume of POSIX.1\(hy2017,
  188. .IR "Chapter 8" ", " "Environment Variables",
  189. .IR "\fB<fcntl.h>\fP",
  190. .IR "\fB<nl_types.h>\fP",
  191. .\"
  192. .SH COPYRIGHT
  193. Portions of this text are reprinted and reproduced in electronic form
  194. from IEEE Std 1003.1-2017, Standard for Information Technology
  195. -- Portable Operating System Interface (POSIX), The Open Group Base
  196. Specifications Issue 7, 2018 Edition,
  197. Copyright (C) 2018 by the Institute of
  198. Electrical and Electronics Engineers, Inc and The Open Group.
  199. In the event of any discrepancy between this version and the original IEEE and
  200. The Open Group Standard, the original IEEE and The Open Group Standard
  201. is the referee document. The original Standard can be obtained online at
  202. http://www.opengroup.org/unix/online.html .
  203. .PP
  204. Any typographical or formatting errors that appear
  205. in this page are most likely
  206. to have been introduced during the conversion of the source files to
  207. man page format. To report such errors, see
  208. https://www.kernel.org/doc/man-pages/reporting_bugs.html .