|
@ -33,7 +33,7 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: strtok.3,v 1.7 1999/07/03 15:58:50 aaron Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: strtok.3,v 1.8 1999/07/03 16:21:31 aaron Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd June 29, 1991 |
|
|
.Dd June 29, 1991 |
|
|
.Dt STRTOK 3 |
|
|
.Dt STRTOK 3 |
|
@ -97,7 +97,7 @@ int i = 0; |
|
|
snprintf(s, sizeof(s), "cat dog horse cow"); |
|
|
snprintf(s, sizeof(s), "cat dog horse cow"); |
|
|
|
|
|
|
|
|
for ((p = strtok(s, " ")); p; (p = strtok(NULL, " ")), i++) { |
|
|
for ((p = strtok(s, " ")); p; (p = strtok(NULL, " ")), i++) { |
|
|
if (i < MAXTOKENS) |
|
|
|
|
|
|
|
|
if (i < MAXTOKENS - 1) |
|
|
tokens[i] = p; |
|
|
tokens[i] = p; |
|
|
} |
|
|
} |
|
|
tokens[i] = '\e0'; |
|
|
tokens[i] = '\e0'; |
|
|