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

strrchr.3p (2738B)


  1. '\" et
  2. .TH STRRCHR "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. strrchr
  12. \(em string scanning operation
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <string.h>
  17. .P
  18. char *strrchr(const char *\fIs\fP, int \fIc\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. The
  26. \fIstrrchr\fR()
  27. function shall locate the last occurrence of
  28. .IR c
  29. (converted to a
  30. .BR char )
  31. in the string pointed to by
  32. .IR s .
  33. The terminating NUL character is considered to be part of the string.
  34. .SH "RETURN VALUE"
  35. Upon successful completion,
  36. \fIstrrchr\fR()
  37. shall return a pointer to the byte or a null pointer if
  38. .IR c
  39. does not occur in the string.
  40. .SH ERRORS
  41. No errors are defined.
  42. .LP
  43. .IR "The following sections are informative."
  44. .SH EXAMPLES
  45. .SS "Finding the Base Name of a File"
  46. .P
  47. The following example uses
  48. \fIstrrchr\fR()
  49. to get a pointer to the base name of a file. The
  50. \fIstrrchr\fR()
  51. function searches backwards through the name of the file to find the
  52. last
  53. .BR '/'
  54. character in
  55. .IR name .
  56. This pointer (plus one) will point to the base name of the file.
  57. .sp
  58. .RS 4
  59. .nf
  60. #include <string.h>
  61. \&...
  62. const char *name;
  63. char *basename;
  64. \&...
  65. basename = strrchr(name, \(aq/\(aq) + 1;
  66. \&...
  67. .fi
  68. .P
  69. .RE
  70. .SH "APPLICATION USAGE"
  71. None.
  72. .SH RATIONALE
  73. None.
  74. .SH "FUTURE DIRECTIONS"
  75. None.
  76. .SH "SEE ALSO"
  77. .IR "\fIstrchr\fR\^(\|)"
  78. .P
  79. The Base Definitions volume of POSIX.1\(hy2017,
  80. .IR "\fB<string.h>\fP"
  81. .\"
  82. .SH COPYRIGHT
  83. Portions of this text are reprinted and reproduced in electronic form
  84. from IEEE Std 1003.1-2017, Standard for Information Technology
  85. -- Portable Operating System Interface (POSIX), The Open Group Base
  86. Specifications Issue 7, 2018 Edition,
  87. Copyright (C) 2018 by the Institute of
  88. Electrical and Electronics Engineers, Inc and The Open Group.
  89. In the event of any discrepancy between this version and the original IEEE and
  90. The Open Group Standard, the original IEEE and The Open Group Standard
  91. is the referee document. The original Standard can be obtained online at
  92. http://www.opengroup.org/unix/online.html .
  93. .PP
  94. Any typographical or formatting errors that appear
  95. in this page are most likely
  96. to have been introduced during the conversion of the source files to
  97. man page format. To report such errors, see
  98. https://www.kernel.org/doc/man-pages/reporting_bugs.html .