All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon <jg-hus3n9K41k0@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: should strstr    return const char*  ?
Date: Sun, 28 Feb 2010 21:29:59 +0000	[thread overview]
Message-ID: <4B8AE057.7000000@jguk.org> (raw)

Hi there,

A couple of queries. I hope could be considered.

I see this function on Ubuntu 9.10:

      char *strstr(const char *haystack, const char *needle);

Should it not return as const char * though?

Also could the description be clarified:

DESCRIPTION
        The strstr() function finds the first occurrence of the 
substring needle in the string haystack.  The terminating
        '\0' characters are not compared.


Can this be added: "If needle is longer than haystack it will never 
match. When the search reaches a character position in haystack which 
does not leave enough characters left to compare, searching will end, 
the haystack buffer will not be overrun.

Thanks again for considering this.
Cheers, Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-02-28 21:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28 21:29 Jon [this message]
     [not found] ` <4B8AE057.7000000-hus3n9K41k0@public.gmane.org>
2010-03-05 20:08   ` should strstr return const char* ? Mike Frysinger
2010-06-19  5:49   ` Michael Kerrisk

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=4B8AE057.7000000@jguk.org \
    --to=jg-hus3n9k41k0@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.