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

mblen.3p (4054B)


  1. '\" et
  2. .TH MBLEN "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. mblen
  12. \(em get number of bytes in a character
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdlib.h>
  17. .P
  18. int mblen(const char *\fIs\fP, size_t \fIn\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. If
  26. .IR s
  27. is not a null pointer,
  28. \fImblen\fR()
  29. shall determine the number of bytes constituting the character
  30. pointed to by
  31. .IR s .
  32. Except that the shift state of
  33. \fImbtowc\fR()
  34. is not affected, it shall be equivalent to:
  35. .sp
  36. .RS 4
  37. .nf
  38. mbtowc((wchar_t *)0, \fIs\fP, \fIn\fP);
  39. .fi
  40. .P
  41. .RE
  42. .P
  43. The implementation shall behave as if no function defined in this volume of POSIX.1\(hy2017
  44. calls
  45. \fImblen\fR().
  46. .P
  47. The behavior of this function is affected by the
  48. .IR LC_CTYPE
  49. category of the current locale. For a state-dependent encoding, this
  50. function shall be placed into its initial state by a call for which its
  51. character pointer argument,
  52. .IR s ,
  53. is a null pointer. Subsequent calls with
  54. .IR s
  55. as other than a null pointer shall cause the internal state of the
  56. function to be altered as necessary. A call with
  57. .IR s
  58. as a null pointer shall cause this function to return a non-zero value
  59. if encodings have state dependency, and 0 otherwise. If the
  60. implementation employs special bytes to change the shift state, these
  61. bytes shall not produce separate wide-character codes, but shall be
  62. grouped with an adjacent character. Changing the
  63. .IR LC_CTYPE
  64. category causes the shift state of this function to be unspecified.
  65. .P
  66. The
  67. \fImblen\fR()
  68. function need not be thread-safe.
  69. .SH "RETURN VALUE"
  70. If
  71. .IR s
  72. is a null pointer,
  73. \fImblen\fR()
  74. shall return a non-zero or 0 value, if character encodings,
  75. respectively, do or do not have state-dependent encodings. If
  76. .IR s
  77. is not a null pointer,
  78. \fImblen\fR()
  79. shall either return 0 (if
  80. .IR s
  81. points to the null byte), or return the number of bytes that
  82. constitute the character (if the next
  83. .IR n
  84. or fewer bytes form a valid character), or return \-1 (if they do
  85. not form a valid character)
  86. and may set
  87. .IR errno
  88. to indicate the error.
  89. In no case shall the value returned be greater than
  90. .IR n
  91. or the value of the
  92. {MB_CUR_MAX}
  93. macro.
  94. .SH ERRORS
  95. The
  96. \fImblen\fR()
  97. function may fail if:
  98. .TP
  99. .BR EILSEQ
  100. An invalid character sequence is detected. In the POSIX locale an
  101. .BR [EILSEQ]
  102. error cannot occur since all byte values are valid characters.
  103. .LP
  104. .IR "The following sections are informative."
  105. .SH EXAMPLES
  106. None.
  107. .SH "APPLICATION USAGE"
  108. None.
  109. .SH RATIONALE
  110. None.
  111. .SH "FUTURE DIRECTIONS"
  112. None.
  113. .SH "SEE ALSO"
  114. .IR "\fImbtowc\fR\^(\|)",
  115. .IR "\fImbstowcs\fR\^(\|)",
  116. .IR "\fIwctomb\fR\^(\|)",
  117. .IR "\fIwcstombs\fR\^(\|)"
  118. .P
  119. The Base Definitions volume of POSIX.1\(hy2017,
  120. .IR "\fB<stdlib.h>\fP"
  121. .\"
  122. .SH COPYRIGHT
  123. Portions of this text are reprinted and reproduced in electronic form
  124. from IEEE Std 1003.1-2017, Standard for Information Technology
  125. -- Portable Operating System Interface (POSIX), The Open Group Base
  126. Specifications Issue 7, 2018 Edition,
  127. Copyright (C) 2018 by the Institute of
  128. Electrical and Electronics Engineers, Inc and The Open Group.
  129. In the event of any discrepancy between this version and the original IEEE and
  130. The Open Group Standard, the original IEEE and The Open Group Standard
  131. is the referee document. The original Standard can be obtained online at
  132. http://www.opengroup.org/unix/online.html .
  133. .PP
  134. Any typographical or formatting errors that appear
  135. in this page are most likely
  136. to have been introduced during the conversion of the source files to
  137. man page format. To report such errors, see
  138. https://www.kernel.org/doc/man-pages/reporting_bugs.html .