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.
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.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #pragma D option quiet
30 #pragma D option strsize=32
45 altstr = "CRAIG: Positioned them, I don't ";
46 altstr2 = "know... I'm fairly wide guy.";
52 command[i].index = 300;
56 command[i].index = -10;
68 command[i].index = strlen(str) - 1;
72 command[i].index = strlen(str);
76 command[i].index = strlen(str) + 1;
81 command[i].length = 20;
85 command[i].length = 4;
89 command[i].length = strlen(str) - command[i].index + 1;
93 command[i].length = strlen(str) - command[i].index + 2;
96 command[i].index = 400;
97 command[i].length = 20;
100 command[i].index = 400;
101 command[i].length = 0;
104 command[i].index = 400;
105 command[i].length = -1;
108 command[i].index = 3;
109 command[i].length = 0;
112 command[i].index = 3;
113 command[i].length = -1;
116 command[i].index = 3;
117 command[i].length = -4;
120 command[i].index = 3;
121 command[i].length = -20;
124 command[i].index = -10;
125 command[i].length = -5;
128 command[i].index = 0;
129 command[i].length = 400;
132 command[i].index = -1;
133 command[i].length = 400;
136 command[i].index = -1;
137 command[i].length = 0;
140 command[i].index = -1;
141 command[i].length = -1;
144 command[i].index = -2 * strlen(str);
145 command[i].length = 2 * strlen(str);
148 command[i].index = -2 * strlen(str);
149 command[i].length = strlen(str);
152 command[i].index = -2 * strlen(str);
153 command[i].length = strlen(str) + 1;
156 command[i].index = -1 * strlen(str);
157 command[i].length = strlen(str);
160 command[i].index = -1 * strlen(str);
161 command[i].length = strlen(str) - 1;
164 command[i].index = 100;
165 command[i].length = 10;
169 command[i].index = 100;
170 command[i].nolen = 1;
176 printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n");
181 /i < end && command[i].nolen/
183 this->str = command[i].alt ? altstr : str;
184 this->str2 = command[i].alt ? altstr2 : str2;
185 this->result = substr(command[i].alt ?
186 "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
187 str, command[i].index);
189 printf("\tif (substr(\"%s%s\", %d) ne \"%s\") {\n",
190 this->str, this->str2, command[i].index, this->result);
192 printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d) = ",
193 this->str, this->str2, command[i].index);
194 printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d));\n",
195 this->str, this->str2, command[i].index);
196 printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d) = ",
197 this->str, this->str2, command[i].index);
198 printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result);
199 printf("\t\t$failed++;\n");
204 /i < end && !command[i].nolen/
206 this->str = command[i].alt ? altstr : str;
207 this->str2 = command[i].alt ? altstr2 : str2;
208 this->result = substr(command[i].alt ?
209 "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
210 str, command[i].index, command[i].length);
212 printf("\tif (substr(\"%s%s\", %d, %d) ne \"%s\") {\n",
213 this->str, this->str2, command[i].index, command[i].length,
215 printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d, %d) = ",
216 this->str, this->str2, command[i].index, command[i].length);
217 printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d, %d));\n",
218 this->str, this->str2, command[i].index, command[i].length);
219 printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d, %d) = ",
220 this->str, this->str2, command[i].index, command[i].length);
221 printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result);
222 printf("\t\t$failed++;\n");
229 printf("\texit($failed);\n}\n");