Browse Source

whoops, fix a bug in my example :)

OPENBSD_2_6
aaron 25 years ago
parent
commit
142a0471af
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lib/libc/string/strtok.3

+ 2
- 2
src/lib/libc/string/strtok.3 View File

@ -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.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
.Dt STRTOK 3
@ -97,7 +97,7 @@ int i = 0;
snprintf(s, sizeof(s), "cat dog horse cow");
for ((p = strtok(s, " ")); p; (p = strtok(NULL, " ")), i++) {
if (i < MAXTOKENS)
if (i < MAXTOKENS - 1)
tokens[i] = p;
}
tokens[i] = '\e0';


Loading…
Cancel
Save