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

strcoll.3p (4427B)


  1. '\" et
  2. .TH STRCOLL "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. strcoll,
  12. strcoll_l
  13. \(em string comparison using collating information
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <string.h>
  18. .P
  19. int strcoll(const char *\fIs1\fP, const char *\fIs2\fP);
  20. int strcoll_l(const char *\fIs1\fP, const char *\fIs2\fP,
  21. locale_t \fIlocale\fP);
  22. .fi
  23. .SH DESCRIPTION
  24. For
  25. \fIstrcoll\fR():
  26. The functionality described on this reference page is aligned with the
  27. ISO\ C standard. Any conflict between the requirements described here and the
  28. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  29. .P
  30. The
  31. \fIstrcoll\fR()
  32. and
  33. \fIstrcoll_l\fR()
  34. functions shall compare the string pointed to by
  35. .IR s1
  36. to the string pointed to by
  37. .IR s2 ,
  38. both interpreted as appropriate to the
  39. .IR LC_COLLATE
  40. category of the current locale,
  41. or of the locale represented by
  42. .IR locale ,
  43. respectively.
  44. .P
  45. The
  46. \fIstrcoll\fR()
  47. and
  48. \fIstrcoll_l\fR()
  49. functions shall not change the setting of
  50. .IR errno
  51. if successful.
  52. .P
  53. Since no return value is reserved to indicate an error, an
  54. application wishing to check for error situations should set
  55. .IR errno
  56. to 0, then call
  57. \fIstrcoll\fR(),
  58. or
  59. \fIstrcoll_l\fR()
  60. then check
  61. .IR errno .
  62. .P
  63. The behavior is undefined if the
  64. .IR locale
  65. argument to
  66. \fIstrcoll_l\fR()
  67. is the special locale object LC_GLOBAL_LOCALE or is not a valid locale
  68. object handle.
  69. .SH "RETURN VALUE"
  70. Upon successful completion,
  71. \fIstrcoll\fR()
  72. shall return an integer greater than, equal to, or less than
  73. 0, according to whether the string pointed to by
  74. .IR s1
  75. is greater than, equal to, or less than the string pointed to by
  76. .IR s2
  77. when both are interpreted as appropriate to the current locale.
  78. On error,
  79. \fIstrcoll\fR()
  80. may set
  81. .IR errno ,
  82. but no return value is reserved to indicate an error.
  83. .P
  84. Upon successful completion,
  85. \fIstrcoll_l\fR()
  86. shall return an integer greater than, equal to, or less than 0,
  87. according to whether the string pointed to by
  88. .IR s1
  89. is greater than, equal to, or less than the string pointed to by
  90. .IR s2
  91. when both are interpreted as appropriate to the locale represented by
  92. .IR locale .
  93. On error,
  94. \fIstrcoll_l\fR()
  95. may set
  96. .IR errno ,
  97. but no return value is reserved to indicate an error.
  98. .SH ERRORS
  99. These functions may fail if:
  100. .TP
  101. .BR EINVAL
  102. The
  103. .IR s1
  104. or
  105. .IR s2
  106. arguments contain characters outside the domain of the collating
  107. sequence.
  108. .LP
  109. .IR "The following sections are informative."
  110. .SH EXAMPLES
  111. .SS "Comparing Nodes"
  112. .P
  113. The following example uses an application-defined function,
  114. \fInode_compare\fR(),
  115. to compare two nodes based on an alphabetical ordering of the
  116. .IR string
  117. field.
  118. .sp
  119. .RS 4
  120. .nf
  121. #include <string.h>
  122. \&...
  123. struct node { /* These are stored in the table. */
  124. char *string;
  125. int length;
  126. };
  127. \&...
  128. int node_compare(const void *node1, const void *node2)
  129. {
  130. return strcoll(((const struct node *)node1)->string,
  131. ((const struct node *)node2)->string);
  132. }
  133. \&...
  134. .fi
  135. .P
  136. .RE
  137. .SH "APPLICATION USAGE"
  138. The
  139. \fIstrxfrm\fR()
  140. and
  141. \fIstrcmp\fR()
  142. functions should be used for sorting large lists.
  143. .SH RATIONALE
  144. None.
  145. .SH "FUTURE DIRECTIONS"
  146. None.
  147. .SH "SEE ALSO"
  148. .IR "\fIalphasort\fR\^(\|)",
  149. .IR "\fIstrcmp\fR\^(\|)",
  150. .IR "\fIstrxfrm\fR\^(\|)"
  151. .P
  152. The Base Definitions volume of POSIX.1\(hy2017,
  153. .IR "\fB<string.h>\fP"
  154. .\"
  155. .SH COPYRIGHT
  156. Portions of this text are reprinted and reproduced in electronic form
  157. from IEEE Std 1003.1-2017, Standard for Information Technology
  158. -- Portable Operating System Interface (POSIX), The Open Group Base
  159. Specifications Issue 7, 2018 Edition,
  160. Copyright (C) 2018 by the Institute of
  161. Electrical and Electronics Engineers, Inc and The Open Group.
  162. In the event of any discrepancy between this version and the original IEEE and
  163. The Open Group Standard, the original IEEE and The Open Group Standard
  164. is the referee document. The original Standard can be obtained online at
  165. http://www.opengroup.org/unix/online.html .
  166. .PP
  167. Any typographical or formatting errors that appear
  168. in this page are most likely
  169. to have been introduced during the conversion of the source files to
  170. man page format. To report such errors, see
  171. https://www.kernel.org/doc/man-pages/reporting_bugs.html .