From: Jayakrishna Vadayath <jvadayat@asu.edu>
To: Florian Weimer <fweimer@redhat.com>
Cc: Jayakrishna Vadayath via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: Implementation of strtok
Date: Thu, 1 Jun 2023 23:17:05 -0700 [thread overview]
Message-ID: <CAFrQ_55tD6Ki_FWXhuVncbjp4YxqFH=Y=ZWf63KrsfuurpEp0Q@mail.gmail.com> (raw)
In-Reply-To: <87a5xipffq.fsf@oldenburg.str.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]
Hi,
Thank you for your reply.
I was only looking at the return value section of the documentation.
However, it makes sense to me now.
Thank you.
On Thu, Jun 1, 2023 at 11:05 PM Florian Weimer <fweimer@redhat.com> wrote:
> * 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://urldefense.com/v3/__https://man7.org/linux/man-pages/man3/strtok.3.html__;!!IKRxdwAv5BmarQ!bQa53ZIha6p2oe0o-luVxpSJFX4pb7VPYYq36zBLfwHYp6-jrFmUvqu99oGfoqfG3qYlrRhyElmpVpse$
> 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
>
>
--
Regards
Jayakrishna Menon
prev parent reply other threads:[~2023-06-02 6:17 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
2023-06-02 6:17 ` Jayakrishna Vadayath [this message]
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='CAFrQ_55tD6Ki_FWXhuVncbjp4YxqFH=Y=ZWf63KrsfuurpEp0Q@mail.gmail.com' \
--to=jvadayat@asu.edu \
--cc=fweimer@redhat.com \
--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).