aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsimple/mem.h4
-rw-r--r--libsimple/str.h2
-rw-r--r--libsimple/strn.h2
-rw-r--r--man3/libsimple_memcmove.389
-rw-r--r--man3/libsimple_mempmove.31
l---------man3/libsimple_rawmemccpy.31
-rw-r--r--man3/libsimple_rawmemcmove.3108
-rw-r--r--man3/libsimple_stpmove.31
-rw-r--r--man3/libsimple_stpnmove.31
l---------man3/libsimple_strccpy.31
-rw-r--r--man3/libsimple_strcmove.3109
-rw-r--r--man3/libsimple_strmove.31
l---------man3/libsimple_strnccpy.31
-rw-r--r--man3/libsimple_strncmove.3114
-rw-r--r--man3/libsimple_strnmove.31
-rw-r--r--memcmove.c2
-rw-r--r--strcmove.c2
-rw-r--r--strncmove.c2
18 files changed, 435 insertions, 7 deletions
diff --git a/libsimple/mem.h b/libsimple/mem.h
index f477681..f4c01dc 100644
--- a/libsimple/mem.h
+++ b/libsimple/mem.h
@@ -613,7 +613,7 @@ static inline void *libsimple_mempset(void *__s, int __c, size_t __n)
* @return `&rawmemchr(d, c)[1]` (after copying)
*/
static inline void *
-libsimple_rawmemccpy(void *restrict __d_, const void *restrict __s_, int __c_) /* TODO man */
+libsimple_rawmemccpy(void *restrict __d_, const void *restrict __s_, int __c_)
{
char __c = (char)__c_, *restrict __d = __d_;
const char *restrict __s = __s_;
@@ -656,7 +656,7 @@ void *libsimple_memcmove(void *, const void *, int, size_t);
* @return `&rawmemchr(d, c)[1]` (after copying)
*/
static inline void *
-libsimple_rawmemcmove(void *__d_, const void *__s_, int __c_) /* TODO man */
+libsimple_rawmemcmove(void *__d_, const void *__s_, int __c_)
{
char *__d = __d_, *__p, __c = (char)__c_;
const char *__s = __s_;
diff --git a/libsimple/str.h b/libsimple/str.h
index 01ce0f7..3693c14 100644
--- a/libsimple/str.h
+++ b/libsimple/str.h
@@ -554,7 +554,7 @@ libsimple_stpset(char *__s, int __c_)
*/
_LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__)))
static inline char *
-libsimple_strccpy(char *restrict __d, const char *restrict __s, int __c_) /* TODO man */
+libsimple_strccpy(char *restrict __d, const char *restrict __s, int __c_)
{
char __c = (char)__c_;
do {
diff --git a/libsimple/strn.h b/libsimple/strn.h
index d9d67ff..e9272a4 100644
--- a/libsimple/strn.h
+++ b/libsimple/strn.h
@@ -630,7 +630,7 @@ libsimple_stpnset(char *__s, int __c_, size_t __n)
*/
_LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__)))
static inline char *
-libsimple_strnccpy(char *restrict __d, const char *restrict __s, int __c_, size_t __n) /* TODO man */
+libsimple_strnccpy(char *restrict __d, const char *restrict __s, int __c_, size_t __n)
{
char __c = (char)__c_, *__end = &__d[__n];
do {
diff --git a/man3/libsimple_memcmove.3 b/man3/libsimple_memcmove.3
new file mode 100644
index 0000000..0079e28
--- /dev/null
+++ b/man3/libsimple_memcmove.3
@@ -0,0 +1,89 @@
+.TH LIBSIMPLE_MEMCMOVE 3 2018-11-25 libsimple
+.SH NAME
+libsimple_memcmove \- move bytes within an array of bytes
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+void *libsimple_memcmove(void *\fIdest\fP, const void *\fIsrc\fP, int \fIc\fP, size_t \fIn\fP);
+
+#ifndef memcmove
+# define memcmove libsimple_memcmove
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_memcmove ()
+function moves
+.I n
+bytes from
+.I src
+to
+.IR dest .
+However the move stops after the character
+.I c
+(it is converted to a
+.BR char )
+is moved. The arrays may overlap in the.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_memcmove ()
+function returns a pointer directly behind
+the position of the character
+.I c
+in
+.I dest
+after it was move, if the character
+.I c
+was not moved
+.I NULL
+is returned.
+.SH ERRORS
+The
+.BR libsimple_memcmove ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_memcmove ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_memcmove ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_memcmove ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_rawmemcmove (3),
+.BR libsimple_mempmove (3),
+.BR libsimple_mempcpy (3),
+.BR libsimple_strcmove (3),
+.BR libsimple_strncmove (3),
+.BR libsimple_memelemmove (3),
+.BR memccpy (3),
+.BR memmove (3),
+.BR memcpy (3)
diff --git a/man3/libsimple_mempmove.3 b/man3/libsimple_mempmove.3
index 99e09c3..3545412 100644
--- a/man3/libsimple_mempmove.3
+++ b/man3/libsimple_mempmove.3
@@ -73,4 +73,5 @@ None.
.BR libsimple_stpmove (3),
.BR libsimple_strnmove (3),
.BR libsimple_stpnmove (3),
+.BR libsimple_memcmove (3),
.BR memmove (3)
diff --git a/man3/libsimple_rawmemccpy.3 b/man3/libsimple_rawmemccpy.3
new file mode 120000
index 0000000..e54ed0b
--- /dev/null
+++ b/man3/libsimple_rawmemccpy.3
@@ -0,0 +1 @@
+libsimple_rawmemcmove.3 \ No newline at end of file
diff --git a/man3/libsimple_rawmemcmove.3 b/man3/libsimple_rawmemcmove.3
new file mode 100644
index 0000000..0223613
--- /dev/null
+++ b/man3/libsimple_rawmemcmove.3
@@ -0,0 +1,108 @@
+.TH LIBSIMPLE_RAWMEMCMOVE 3 2018-11-25 libsimple
+.SH NAME
+libsimple_rawmemcmove, libsimple_rawmemccpy \- copy or move bytes within an array of bytes
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+static inline void *libsimple_rawmemcmove(void *\fIdest\fP, const void *\fIsrc\fP, int \fIc\fP);
+static inline void *libsimple_rawmemccpy(void *\fIdest\fP, const void *\fIsrc\fP, int \fIc\fP);
+
+#ifndef rawmemcmove
+# define rawmemcmove libsimple_rawmemcmove
+#endif
+#ifndef rawmemccpy
+# define rawmemccpy libsimple_rawmemccpy
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_rawmemcmove ()
+and
+.BR libsimple_rawmemccpy ()
+functions all bytes in
+.I src
+to
+.IR dest
+until the character
+.I c
+(it is converted to a
+.BR char )
+has been copied.
+.PP
+The arrays may overlap in the
+.BR libsimple_rawmemcmove ()
+function but not in the
+.BR libsimple_rawmemccpy ()
+function.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_rawmemcmove ()
+and
+.BR libsimple_rawmemccpy ()
+functions return a pointer directly behind
+the position of the character
+.I c
+in
+.I dest
+after it was copied. If the character
+.I c
+does not exist in
+.IR src ,
+the behaviour is undefined.
+.SH ERRORS
+The
+.BR libsimple_rawmemcmove ()
+and
+.BR libsimple_rawmemccpy ()
+functions cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_rawmemcmove (),
+and
+.BR libsimple_rawmemccpy ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_rawmemcmove (),
+and
+.BR libsimple_rawmemccpy ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_rawmemcmove (),
+and
+.BR libsimple_rawmemccpy ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_memcmove (3),
+.BR libsimple_mempmove (3),
+.BR libsimple_mempcpy (3),
+.BR libsimple_strcmove (3),
+.BR libsimple_strncmove (3),
+.BR libsimple_rawmemelemmove (3),
+.BR memmove (3),
+.BR memcpy (3)
diff --git a/man3/libsimple_stpmove.3 b/man3/libsimple_stpmove.3
index 5b28622..62282d6 100644
--- a/man3/libsimple_stpmove.3
+++ b/man3/libsimple_stpmove.3
@@ -70,5 +70,6 @@ None.
.BR libsimple_strmove (3),
.BR libsimple_stpnmove (3),
.BR libsimple_mempmove (3),
+.BR libsimple_strcmove (3),
.BR stpcpy (3),
.BR memmove (3)
diff --git a/man3/libsimple_stpnmove.3 b/man3/libsimple_stpnmove.3
index e2ead53..eed841a 100644
--- a/man3/libsimple_stpnmove.3
+++ b/man3/libsimple_stpnmove.3
@@ -75,5 +75,6 @@ None.
.BR libsimple_strnmove (3),
.BR libsimple_stpmove (3),
.BR libsimple_mempmove (3),
+.BR libsimple_strncmove (3),
.BR stpncpy (3),
.BR memmove (3)
diff --git a/man3/libsimple_strccpy.3 b/man3/libsimple_strccpy.3
new file mode 120000
index 0000000..8c09bec
--- /dev/null
+++ b/man3/libsimple_strccpy.3
@@ -0,0 +1 @@
+libsimple_strcmove.3 \ No newline at end of file
diff --git a/man3/libsimple_strcmove.3 b/man3/libsimple_strcmove.3
new file mode 100644
index 0000000..328e696
--- /dev/null
+++ b/man3/libsimple_strcmove.3
@@ -0,0 +1,109 @@
+.TH LIBSIMPLE_STRCMOVE 3 2018-11-25 libsimple
+.SH NAME
+libsimple_strcmove, libsimple_strccpy \- copy or move a string within an array of bytes
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strcmove(char *\fIdest\fP, const char *\fIsrc\fP, int \fIc\fP);
+static inline char *libsimple_strccpy(char *restrict \fIdest\fP, const char *restrict \fIsrc\fP, int \fIc\fP);
+
+#ifndef strcmove
+# define strcmove libsimple_strcmove
+#endif
+#ifndef strccpy
+# define strccpy libsimple_strccpy
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strcmove ()
+and
+.BR libsimple_strccpy ()
+functions copy the string, including the
+NUL byte that terminates it,
+.I src
+into
+.IR dest .
+However the copying stops directly after that character
+.I c
+(it is converted to a
+.BR char )
+is copied, and a NUL byte is written behind it.
+.PP
+The arrays may overlap in the
+.BR libsimple_strcmove ()
+function but not in the
+.BR libsimple_strccpy ()
+function.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strcmove ()
+and
+.BR libsimple_strccpy ()
+functions return a pointer directly behind
+the position of the character
+.I c
+in the string
+.I dest
+after it was copied, if the character
+.I c
+was not copied
+.I NULL
+is returned.
+.SH ERRORS
+The
+.BR libsimple_strcmove ()
+and
+.BR libsimple_strccpy ()
+functions cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_strcmove (),
+.br
+.BR libsimple_strccpy ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strcmove (),
+.br
+.BR libsimple_strccpy ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strcmove (),
+.br
+.BR libsimple_strccpy ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_strmove (3),
+.BR libsimple_stpmove (3),
+.BR libsimple_strncmove (3),
+.BR libsimple_memcmove (3),
+.BR libsimple_memelemmove (3),
+.BR strcpy (3),
+.BR stpcpy (3),
+.BR memccpy (3),
diff --git a/man3/libsimple_strmove.3 b/man3/libsimple_strmove.3
index a145c62..90d5dfc 100644
--- a/man3/libsimple_strmove.3
+++ b/man3/libsimple_strmove.3
@@ -65,5 +65,6 @@ None.
.SH SEE ALSO
.BR libsimple_stpmove (3),
.BR libsimple_strnmove (3),
+.BR libsimple_strcmove (3),
.BR strcpy (3),
.BR memmove (3)
diff --git a/man3/libsimple_strnccpy.3 b/man3/libsimple_strnccpy.3
new file mode 120000
index 0000000..e229a29
--- /dev/null
+++ b/man3/libsimple_strnccpy.3
@@ -0,0 +1 @@
+libsimple_strncmove.3 \ No newline at end of file
diff --git a/man3/libsimple_strncmove.3 b/man3/libsimple_strncmove.3
new file mode 100644
index 0000000..c944372
--- /dev/null
+++ b/man3/libsimple_strncmove.3
@@ -0,0 +1,114 @@
+.TH LIBSIMPLE_STRNCMOVE 3 2018-11-25 libsimple
+.SH NAME
+libsimple_strncmove, libsimple_strnccpy \- copy or move a string within an array of bytes
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strncmove(char *\fIdest\fP, const char *\fIsrc\fP, int \fIc\fP, size_t \fIn\fP);
+static inline char *libsimple_strnccpy(char *restrict \fIdest\fP, const char *restrict \fIsrc\fP, int \fIc\fP, size_t \fIn\fP);
+
+#ifndef strncmove
+# define strncmove libsimple_strncmove
+#endif
+#ifndef strnccpy
+# define strnccpy libsimple_strnccpy
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strncmove ()
+and
+.BR libsimple_strnccpy ()
+functions copy the string, including the
+NUL byte that terminates it,
+.I src
+into
+.IR dest .
+However the copying stops directly after that character
+.I c
+(it is converted to a
+.BR char )
+is copied or after
+.I n
+characters have been copied. A NUL byte is written after
+the last copied character unless
+.I n
+chracters have been copied.
+.PP
+The arrays may overlap in the
+.BR libsimple_strncmove ()
+function but not in the
+.BR libsimple_strnccpy ()
+function.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strncmove ()
+and
+.BR libsimple_strnccpy ()
+functions return a pointer directly behind
+the position of the character
+.I c
+in the string
+.I dest
+after it was copied, if the character
+.I c
+was not copied
+.I NULL
+is returned.
+.SH ERRORS
+The
+.BR libsimple_strncmove ()
+and
+.BR libsimple_strnccpy ()
+functions cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_strncmove (),
+.br
+.BR libsimple_strnccpy ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strncmove (),
+.br
+.BR libsimple_strnccpy ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strncmove (),
+.br
+.BR libsimple_strnccpy ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_strnmove (3),
+.BR libsimple_stpnmove (3),
+.BR libsimple_strcmove (3),
+.BR libsimple_memcmove (3),
+.BR libsimple_memelemmove (3),
+.BR strncpy (3),
+.BR stpncpy (3),
+.BR memccpy (3),
diff --git a/man3/libsimple_strnmove.3 b/man3/libsimple_strnmove.3
index 46776be..593a5cb 100644
--- a/man3/libsimple_strnmove.3
+++ b/man3/libsimple_strnmove.3
@@ -67,5 +67,6 @@ None.
.SH SEE ALSO
.BR libsimple_stpnmove (3),
.BR libsimple_strmove (3),
+.BR libsimple_strncmove (3),
.BR strncpy (3),
.BR memmove (3)
diff --git a/memcmove.c b/memcmove.c
index 53b1322..ab9e6d9 100644
--- a/memcmove.c
+++ b/memcmove.c
@@ -4,7 +4,7 @@
void *
-libsimple_memcmove(void *d_, const void *s_, int c_, size_t n) /* TODO man */
+libsimple_memcmove(void *d_, const void *s_, int c_, size_t n)
{
char *d = d_, c = (char)c_, *p;
const char *s = s_;
diff --git a/strcmove.c b/strcmove.c
index 8737061..c45fa47 100644
--- a/strcmove.c
+++ b/strcmove.c
@@ -4,7 +4,7 @@
char *
-libsimple_strcmove(char *d, const char *s, int c_) /* TODO man */
+libsimple_strcmove(char *d, const char *s, int c_)
{
char c = (char)c_, *p;
size_t n;
diff --git a/strncmove.c b/strncmove.c
index 25f83bc..1a03d2d 100644
--- a/strncmove.c
+++ b/strncmove.c
@@ -4,7 +4,7 @@
char *
-libsimple_strncmove(char *d, const char *s, int c_, size_t n) /* TODO man */
+libsimple_strncmove(char *d, const char *s, int c_, size_t n)
{
char c = (char)c_, *p, *end = &d[n];
if (d <= s) {