linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc@public.gmane.org
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Moritz 'Morty' Strübe" <morty-hi6Y0CQ0nG0@public.gmane.org>
Subject: Re: [PATCH] string.3: Add short description of the functions
Date: Sun, 05 Jan 2014 00:30:26 +1300	[thread overview]
Message-ID: <52C7F0D2.9070007@gmail.com> (raw)
In-Reply-To: <1386158610-41816-1-git-send-email-Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc@public.gmane.org>

On 12/05/13 01:03, Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc@public.gmane.org wrote:
> From: Moritz 'Morty' Strübe <morty-hi6Y0CQ0nG0@public.gmane.org>
> 
> It is helpful to have a short description about what the different
> functions in string.h do.

Hello Moritz,

Thanks for the idea and the patch. I agree with you. I applied 
your patch. There were, however, a few inaccuracies in your
descriptions which I've hopefully fixed. I also further expanded
some of the descriptions.

Cheers,

Michael

> Signed-off-by: Moritz 'Morty' Strübe <morty-hi6Y0CQ0nG0@public.gmane.org>
> ---
>  man3/string.3 |  159 +++++++++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 133 insertions(+), 26 deletions(-)
> 
> diff --git a/man3/string.3 b/man3/string.3
> index b180a50..5e27a65 100644
> --- a/man3/string.3
> +++ b/man3/string.3
> @@ -34,58 +34,165 @@ strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
>  strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
>  \- string operations
>  .SH SYNOPSIS
> -.nf
>  .B #include <strings.h>
> -.sp
> +.TP
>  .BI "int strcasecmp(const char *" s1 ", const char *" s2 );
> -.sp
> +Compares
> +.I s1
> +and
> +.I s2
> +ignoring the case.
> +.TP
>  .BI "int strncasecmp(const char *" s1 ", const char *" s2 ", size_t " n );
> -.sp
> +Compares the first
> +.I n
> +characters of
> +.I s1
> +and 
> +.I s2 
> +ignoring the case.
> +.TP
>  .BI "char *index(const char *" s ", int " c );
> -.sp
> +Returns the first occurrence of
> +.I c 
> +in
> +.IR s .
> +.TP
>  .BI "char *rindex(const char *" s ", int " c );
> -.sp
> +Returns the last occurrence of
> +.I c
> +in
> +.IR s .
> +.TP
> +.TP
>  .B #include <string.h>
> -.sp
> +.TP
> +.TP
>  .BI "char *stpcpy(char *" dest ", const char *" src );
> -.sp
> +Copy a string from
> +.I src
> +to
> +.IR dest .
> +.TP
>  .BI "char *strcat(char *" dest ", const char *" src );
> -.sp
> +Concatenate
> +.I src
> +to
> +.IR dest .
> +.TP
>  .BI "char *strchr(const char *" s ", int " c );
> -.sp
> +Find the first occurence of
> +.I c
> +in
> +.IR s .
> +.TP
>  .BI "int strcmp(const char *" s1 ", const char *" s2 );
> -.sp
> +Compare
> +.I s1
> +with
> +.IR s2.
> +.TP
>  .BI "int strcoll(const char *" s1 ", const char *" s2 );
> -.sp
> +Compare
> +.I s1
> +with
> +.I s2
> +using the current locale.
> +.TP
>  .BI "char *strcpy(char *" dest ", const char *" src );
> -.sp
> +Copy
> +.I src
> +to
> +.IR dst .
> +.TP
>  .BI "size_t strcspn(const char *" s ", const char *" reject );
> -.sp
> +Calculate the length of the initial segment of
> +.I s
> +which does not contain
> +.IR reject .
> +.TP
>  .BI "char *strdup(const char *" s );
> -.sp
> +Copy
> +.I s
> +to memory allocated using
> +.IR malloc (3).
> +.TP
>  .BI "char *strfry(char *" string );
> -.sp
> +Randomly swap the characters in
> +.IR string.
> +.TP
>  .BI "size_t strlen(const char *" s );
> -.sp
> +Calculate the length of
> +.IR s .
> +.TP
>  .BI "char *strncat(char *" dest ", const char *" src ", size_t " n );
> -.sp
> +Copy at most
> +.I n
> +characters from
> +.I src
> +to
> +.IR dest .
> +.TP
>  .BI "int strncmp(const char *" s1 ", const char *" s2 ", size_t " n );
> -.sp
> +Compare at most
> +.I n
> +bytes of
> +.I s1
> +and
> +.IR s2.
> +.TP
>  .BI "char *strncpy(char *" dest ", const char *" src ", size_t " n );
> -.sp
> +Copy at most
> +.I n
> +bytes
> +from
> +.I src
> +to
> +.IR dst .
> +.TP
>  .BI "char *strpbrk(const char *" s ", const char *" accept );
> -.sp
> +Return the first occurrence of
> +.I s
> +in
> +.IR accept .
> +.TP
>  .BI "char *strrchr(const char *" s ", int " c );
> -.sp
> +Return the first occurrence of
> +.I s
> +in
> +.IR c .
> +.TP
>  .BI "char *strsep(char **" stringp ", const char *" delim );
> -.sp
> +Tokenise
> +.I stringp
> +at 
> +.IR delim .
> +.TP
>  .BI "size_t strspn(const char *" s ", const char *" accept );
> -.sp
> +Calculate the size of the starting segment in
> +.I s
> +that consists of
> +.IR accept .
> +.TP
>  .BI "char *strstr(const char *" haystack ", const char *" needle );
> -.sp
> +Find the first occurrence of
> +.I needle
> +in 
> +.IR haystack .
> +.TP
>  .BI "char *strtok(char *" s ", const char *" delim );
> -.sp
> +Tokenize 
> +.I s
> +at 
> +.IR delim .
> +.TP
>  .BI "size_t strxfrm(char *" dest ", const char *" src ", size_t " n );
> +Transforms
> +.I src
> +to the current locale and copies the first
> +.I n
> +characters to 
> +.IR dest .
>  .fi
>  .SH DESCRIPTION
>  The string functions perform string operations on null-terminated
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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

      parent reply	other threads:[~2014-01-04 11:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 12:03 [PATCH] string.3: Add short description of the functions Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc
     [not found] ` <1386158610-41816-1-git-send-email-Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc@public.gmane.org>
2014-01-04 11:30   ` Michael Kerrisk (man-pages) [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=52C7F0D2.9070007@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Moritz.Struebe-jNDFPZUTrfT6U6xlzOR6HsSSVFg4/55HhC4ANOJQIlc@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=morty-hi6Y0CQ0nG0@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 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 NNTP newsgroup(s).