~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
1
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
2 by Francesco Paolo Lovergine
* Alligned to linux main manpages edition.
2
.TH "STRRCHR" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
3
.\" strrchr 
4
.SH NAME
5
strrchr \- string scanning operation
6
.SH SYNOPSIS
7
.LP
8
\fB#include <string.h>
9
.br
10
.sp
11
char *strrchr(const char *\fP\fIs\fP\fB, int\fP \fIc\fP\fB);
12
.br
13
\fP
14
.SH DESCRIPTION
15
.LP
16
The \fIstrrchr\fP() function shall locate the last occurrence of \fIc\fP
17
(converted to a \fBchar\fP) in the string pointed to
18
by \fIs\fP. The terminating null byte is considered to be part of
19
the string.
20
.SH RETURN VALUE
21
.LP
22
Upon successful completion, \fIstrrchr\fP() shall return a pointer
23
to the byte or a null pointer if \fIc\fP does not occur in
24
the string.
25
.SH ERRORS
26
.LP
27
No errors are defined.
28
.LP
29
\fIThe following sections are informative.\fP
30
.SH EXAMPLES
31
.SS Finding the Base Name of a File
32
.LP
33
The following example uses \fIstrrchr\fP() to get a pointer to the
34
base name of a file. The \fIstrrchr\fP() function searches
35
backwards through the name of the file to find the last \fB'/'\fP
36
character in \fIname\fP. This pointer (plus one) will point
37
to the base name of the file.
38
.sp
39
.RS
40
.nf
41
42
\fB#include <string.h>
43
\&...
44
const char *name;
45
char *basename;
46
\&...
47
basename = strrchr(name, '/') + 1;
48
\&...
49
\fP
50
.fi
51
.RE
52
.SH APPLICATION USAGE
53
.LP
54
None.
55
.SH RATIONALE
56
.LP
57
None.
58
.SH FUTURE DIRECTIONS
59
.LP
60
None.
61
.SH SEE ALSO
62
.LP
63
\fIstrchr\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001,
64
\fI<string.h>\fP
65
.SH COPYRIGHT
66
Portions of this text are reprinted and reproduced in electronic form
67
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
68
-- Portable Operating System Interface (POSIX), The Open Group Base
69
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
70
Electrical and Electronics Engineers, Inc and The Open Group. In the
71
event of any discrepancy between this version and the original IEEE and
72
The Open Group Standard, the original IEEE and The Open Group Standard
73
is the referee document. The original Standard can be obtained online at
74
http://www.opengroup.org/unix/online.html .