From: Florian Weimer <fweimer@redhat.com>
To: Jayakrishna Vadayath <jvadayat@asu.edu>
Cc: Jayakrishna Vadayath via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: Implementation of strtok
Date: Fri, 02 Jun 2023 08:05:13 +0200 [thread overview]
Message-ID: <87a5xipffq.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAFrQ_54y6MzWBsa5qBLW=oDMLAG4XHAWBAzjNsRTJPbn82x5Sg@mail.gmail.com> (Jayakrishna Vadayath's message of "Thu, 1 Jun 2023 22:52:56 -0700")
* Jayakrishna Vadayath:
> The man page of strtok mention that strtok returns a pointer to the
> next token or NULL if there are no more tokens :
> https://man7.org/linux/man-pages/man3/strtok.3.html I can see how the
> "no more tokens" would apply in this case, but it seems like not many
> people are aware of this case.
>
> Can you list the descriptions of strtok that explain this behavior ?
This part is quite clear to me:
| The first call to strtok() sets this pointer to point to the first
| byte of the string. The start of the next token is determined by
| scanning forward for the next nondelimiter byte in str. If such a
| byte is found, it is taken as the start of the next token. If no such
| byte is found, then there are no more tokens, and strtok() returns
| NULL.
The last sentence is really unambiguous. Maybe it's the double
negation?
Thanks,
Florian
next prev parent reply other threads:[~2023-06-02 6:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 5:22 Jayakrishna Vadayath
2023-06-02 5:40 ` Florian Weimer
2023-06-02 5:52 ` Jayakrishna Vadayath
2023-06-02 6:05 ` Florian Weimer [this message]
2023-06-02 6:17 ` Jayakrishna Vadayath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5xipffq.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=jvadayat@asu.edu \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).