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

mbrlen.3p (4295B)


  1. '\" et
  2. .TH MBRLEN "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. mbrlen
  12. \(em get number of bytes in a character (restartable)
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <wchar.h>
  17. .P
  18. size_t mbrlen(const char *restrict \fIs\fP, size_t \fIn\fP,
  19. mbstate_t *restrict \fIps\fP);
  20. .fi
  21. .SH DESCRIPTION
  22. The functionality described on this reference page is aligned with the
  23. ISO\ C standard. Any conflict between the requirements described here and the
  24. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  25. .P
  26. If
  27. .IR s
  28. is not a null pointer,
  29. \fImbrlen\fR()
  30. shall determine the number of bytes constituting the character pointed
  31. to by
  32. .IR s .
  33. It shall be equivalent to:
  34. .sp
  35. .RS 4
  36. .nf
  37. mbstate_t internal;
  38. mbrtowc(NULL, s, n, ps != NULL ? ps : &internal);
  39. .fi
  40. .P
  41. .RE
  42. .P
  43. If
  44. .IR ps
  45. is a null pointer, the
  46. \fImbrlen\fR()
  47. function shall use its own internal
  48. .BR mbstate_t
  49. object, which is initialized at program start-up to the initial
  50. conversion state. Otherwise, the
  51. .BR mbstate_t
  52. object pointed to by
  53. .IR ps
  54. shall be used to completely describe the current conversion state of
  55. the associated character sequence. The implementation shall behave as
  56. if no function defined in this volume of POSIX.1\(hy2017 calls
  57. \fImbrlen\fR().
  58. .P
  59. The behavior of this function is affected by the
  60. .IR LC_CTYPE
  61. category of the current locale.
  62. .P
  63. The
  64. \fImbrlen\fR()
  65. function need not be thread-safe if called with a NULL
  66. .IR ps
  67. argument.
  68. .P
  69. The
  70. \fImbrlen\fR()
  71. function shall not change the setting of
  72. .IR errno
  73. if successful.
  74. .SH "RETURN VALUE"
  75. The
  76. \fImbrlen\fR()
  77. function shall return the first of the following that applies:
  78. .IP 0 12
  79. If the next
  80. .IR n
  81. or fewer bytes complete the character that corresponds to the null
  82. wide character.
  83. .IP "\fIpositive\fP" 12
  84. If the next
  85. .IR n
  86. or fewer bytes complete a valid character; the value returned shall
  87. be the number of bytes that complete the character.
  88. .IP "(\fBsize_t\fP)\-2" 12
  89. If the next
  90. .IR n
  91. bytes contribute to an incomplete but potentially valid character, and
  92. all
  93. .IR n
  94. bytes have been processed. When
  95. .IR n
  96. has at least the value of the
  97. {MB_CUR_MAX}
  98. macro, this case can only occur if
  99. .IR s
  100. points at a sequence of redundant shift sequences (for implementations
  101. with state-dependent encodings).
  102. .IP "(\fBsize_t\fP)\-1" 12
  103. If an encoding error occurs, in which case the next
  104. .IR n
  105. or fewer bytes do not contribute to a complete and valid character. In
  106. this case,
  107. .BR [EILSEQ]
  108. shall be stored in
  109. .IR errno
  110. and the conversion state is undefined.
  111. .SH ERRORS
  112. The
  113. \fImbrlen\fR()
  114. function shall fail if:
  115. .TP
  116. .BR EILSEQ
  117. An invalid character sequence is detected.
  118. In the POSIX locale an
  119. .BR [EILSEQ]
  120. error cannot occur since all byte values are valid characters.
  121. .br
  122. .P
  123. The
  124. \fImbrlen\fR()
  125. function may fail if:
  126. .TP
  127. .BR EINVAL
  128. .IR ps
  129. points to an object that contains an invalid conversion state.
  130. .LP
  131. .IR "The following sections are informative."
  132. .SH EXAMPLES
  133. None.
  134. .SH "APPLICATION USAGE"
  135. None.
  136. .SH RATIONALE
  137. None.
  138. .SH "FUTURE DIRECTIONS"
  139. None.
  140. .SH "SEE ALSO"
  141. .IR "\fImbsinit\fR\^(\|)",
  142. .IR "\fImbrtowc\fR\^(\|)"
  143. .P
  144. The Base Definitions volume of POSIX.1\(hy2017,
  145. .IR "\fB<wchar.h>\fP"
  146. .\"
  147. .SH COPYRIGHT
  148. Portions of this text are reprinted and reproduced in electronic form
  149. from IEEE Std 1003.1-2017, Standard for Information Technology
  150. -- Portable Operating System Interface (POSIX), The Open Group Base
  151. Specifications Issue 7, 2018 Edition,
  152. Copyright (C) 2018 by the Institute of
  153. Electrical and Electronics Engineers, Inc and The Open Group.
  154. In the event of any discrepancy between this version and the original IEEE and
  155. The Open Group Standard, the original IEEE and The Open Group Standard
  156. is the referee document. The original Standard can be obtained online at
  157. http://www.opengroup.org/unix/online.html .
  158. .PP
  159. Any typographical or formatting errors that appear
  160. in this page are most likely
  161. to have been introduced during the conversion of the source files to
  162. man page format. To report such errors, see
  163. https://www.kernel.org/doc/man-pages/reporting_bugs.html .