diff options
author | 2000-04-24 16:55:44 +0000 | |
---|---|---|
committer | 2000-04-24 16:55:44 +0000 | |
commit | 511d7280aba006b332e3d185369804db6f33e925 (patch) | |
tree | 6b04bff2110b8cd5369715832089fcc3a24c9cbb /lib/libc/string | |
parent | Treat the beginning of the current dmesg output as starting at (diff) | |
download | wireguard-openbsd-511d7280aba006b332e3d185369804db6f33e925.tar.xz wireguard-openbsd-511d7280aba006b332e3d185369804db6f33e925.zip |
correct example
Diffstat (limited to 'lib/libc/string')
-rw-r--r-- | lib/libc/string/strtok.3 | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3 index 143ffc2e426..255431c9c68 100644 --- a/lib/libc/string/strtok.3 +++ b/lib/libc/string/strtok.3 @@ -33,7 +33,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: strtok.3,v 1.11 2000/04/21 15:24:20 aaron Exp $ +.\" $OpenBSD: strtok.3,v 1.12 2000/04/24 16:55:44 deraadt Exp $ .\" .Dd June 29, 1991 .Dt STRTOK 3 @@ -107,11 +107,12 @@ int i = 0; snprintf(s, sizeof(s), "cat dog horse cow"); -for ((p = strtok_r(s, " ", &last)); p; (p = strtok_r(NULL, " ", &last)), i++) { - if (i < MAXTOKENS - 1) - tokens[i] = p; +for ((p = strtok_r(s, " ", &last)); p; + (p = strtok_r(NULL, " ", &last)), i++) { + if (i < MAXTOKENS - 1) + tokens[i] = p; } -tokens[i] = '\e0'; +tokens[i] = NULL; .Ed .Pp That is, |