xref: /original-bsd/lib/libc/string/strstr.3 (revision 698bcc85)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\" %sccs.include.redist.man%
7.\"
8.\"     @(#)strstr.3	5.2 (Berkeley) 04/19/91
9.\"
10.Dd
11.Dt STRSTR 3
12.Os
13.Sh NAME
14.Nm strstr
15.Nd locate a substring in a string
16.Sh SYNOPSIS
17.Fd #include <string.h>
18.Ft char *
19.Fn strstr "const char *big" "const char *little"
20.Sh DESCRIPTION
21The
22.Fn strstr
23function
24locates the first occurrence of the null-terminated string
25.Fa little
26in the null-terminated string
27.Fa big .
28If
29.Fa little
30is the empty string,
31.Fn strstr
32returns
33.Fa big ;
34if
35.Fa little
36occurs nowhere in
37.Fa big ,
38.Fn strstr
39returns NULL;
40otherwise
41.Fn strstr
42returns a pointer to the first character of the first occurrence of
43.Fa little .
44.Sh SEE ALSO
45.Xr index 3 ,
46.Xr memchr 3 ,
47.Xr rindex 3 ,
48.Xr strchr 3 ,
49.Xr strcspn 3 ,
50.Xr strpbrk 3 ,
51.Xr strrchr 3 ,
52.Xr strsep 3 ,
53.Xr strspn 3 ,
54.Xr strtok 3
55.Sh STANDARDS
56The
57.Fn strstr
58function
59conforms to
60.St -ansiC .
61