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 2006 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
33 this->str = ",,,Carrots,,Barley,Oatmeal,,,Beans,";
37 /(this->field
= strtok(this->str, ",")) == NULL
/
44 printf("%s\n", this->field
);
48 /(this->field
= strtok(NULL
, ",")) == NULL
/
55 printf("%s\n", this->field
);
59 /(this->field
= strtok(NULL
, ",")) == NULL
/
66 printf("%s\n", this->field
);
70 /(this->field
= strtok(NULL
, ",")) == NULL
/
77 printf("%s\n", this->field
);
81 /(self
->a
= strtok(NULL
, ",")) != NULL
/
83 printf("unexpected field: %s\n", this->field
);
99 command
[i
].result
= "";
102 command
[i
].s1
= "foo";
104 command
[i
].result
= command
[i
].s1
;
107 command
[i
].s1
= "foobar";
109 command
[i
].result
= "f";
112 command
[i
].s1
= "oobar";
114 command
[i
].result
= "bar";
117 command
[i
].s1
= "foo";
118 command
[i
].s2
= "bar";
119 command
[i
].result
= command
[i
].s1
;
123 command
[i
].s2
= "foo";
124 command
[i
].result
= "";
133 (this->result
= strtok(command
[i
].s1
, command
[i
].s2
)) != command
[i
].result
/
135 printf("strtok(\"%s\", \"%s\") = \"%s\", expected \"%s\"",
136 command
[i
].s1
, command
[i
].s2
,
137 this->result
!= NULL ?
this->result
: "<null>",
138 command
[i
].result
!= NULL ? command
[i
].result
: "<null>");