summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-04-24 16:55:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-04-24 16:55:45 +0000
commitc386cb8e7ccb163e3d3a92a1eb0cea69849bba9c (patch)
treea4fe1c6eba0ddade651315140e8fe473063849c1 /lib/libc/string
parentc92e501ba983934d480dc9d12f20b8bdaf2c7baa (diff)
correct example
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/strtok.311
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,