1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma D option quiet
28 
29 BEGIN
30 {
31 	str = "foobarbarbazbarbop";
32 	this->success = 0;
33 
34 	c = str;
35 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
36 
37 	c = "baz";
38 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
39 
40 	c = "bar";
41 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
42 
43 	c = "bazbarbop";
44 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
45 
46 	c = "barba";
47 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
48 
49 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n",
50 	    strstr(str, "baz"), strstr(str, "zba"),
51 	    strstr(strstr(str, "baz"), strstr(str, "zba")));
52 
53 	c = "";
54 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
55 
56 	str = "";
57 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
58 
59 	str = "f";
60 	c = "f";
61 	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
62 
63 	this->success = 1;
64 }
65 
66 BEGIN
67 /!this->success/
68 {
69 	exit(1);
70 }
71 
72 BEGIN
73 /strstr(str, "barbarf") != NULL/
74 {
75 	exit(2);
76 }
77 
78 BEGIN
79 /strstr(str, "foobarbarbazbarbopp") != NULL/
80 {
81 	exit(3);
82 }
83 
84 BEGIN
85 {
86 	exit(0);
87 }
88