View | Details | Raw Unified | Return to bug 32054 | Differences between
and this patch

Collapse All | Expand All

(-)index.3 (-8 / +20 lines)
Lines 38-44 Link Here
38
.Dt INDEX 3
38
.Dt INDEX 3
39
.Os
39
.Os
40
.Sh NAME
40
.Sh NAME
41
.Nm index
41
.Nm index ,
42
.Nm rindex
42
.Nd locate character in string
43
.Nd locate character in string
43
.Sh LIBRARY
44
.Sh LIBRARY
44
.Lb libc
45
.Lb libc
Lines 46-73 Link Here
46
.In string.h
47
.In string.h
47
.Ft char *
48
.Ft char *
48
.Fn index "const char *s" "int c"
49
.Fn index "const char *s" "int c"
50
.Ft char *
51
.Fn rindex "const char *s" "int c"
49
.Sh DESCRIPTION
52
.Sh DESCRIPTION
50
The
53
The
51
.Fn index
54
.Fn index
52
function
55
function locates the first character matching
53
locates the first character matching
54
.Fa c
56
.Fa c
55
(converted to a
57
(converted to a
56
.Em char )
58
.Em char )
57
in the null-terminated string
59
in the null-terminated string
58
.Fa s .
60
.Fa s .
61
.Pp
62
The
63
.Fn rindex
64
function behaves as well, except locates the last character matching
65
.Fa c .
59
.Sh RETURN VALUES
66
.Sh RETURN VALUES
60
A pointer to the character is returned if it is found; otherwise
67
A pointer to the character is returned if it is found; otherwise
61
.Dv NULL
68
.Dv NULL
62
is returned.
69
is returned.
63
If
70
If
64
.Fa c
71
.Fa c
65
is '\e0',
72
is
73
.Ql \e0 ,
66
.Fn index
74
.Fn index
67
locates the terminating '\e0'.
75
and
76
.Fn rindex
77
locate the terminating
78
.Ql \e0 .
68
.Sh SEE ALSO
79
.Sh SEE ALSO
69
.Xr memchr 3 ,
80
.Xr memchr 3 ,
70
.Xr rindex 3 ,
71
.Xr strchr 3 ,
81
.Xr strchr 3 ,
72
.Xr strcspn 3 ,
82
.Xr strcspn 3 ,
73
.Xr strpbrk 3 ,
83
.Xr strpbrk 3 ,
Lines 77-83 Link Here
77
.Xr strstr 3 ,
87
.Xr strstr 3 ,
78
.Xr strtok 3
88
.Xr strtok 3
79
.Sh HISTORY
89
.Sh HISTORY
80
A
90
The
81
.Fn index
91
.Fn index
82
function appeared in
92
and
93
.Fn rindex
94
functions appeared in
83
.At v6 .
95
.At v6 .

Return to bug 32054