From 053716e4aa4071209201055683d646a9aabd5cf6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Nov 2018 12:32:21 +0100 Subject: Add man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libsimple/mem.h | 6 +-- libsimple/str.h | 6 +-- libsimple/strn.h | 6 +-- man3/libsimple_memptolower.3 | 1 + man3/libsimple_memptoupper.3 | 1 + man3/libsimple_memreplace.3 | 76 ++++++++++++++++++++++++++++++++ man3/libsimple_memreplaceelem.3 | 82 ++++++++++++++++++++++++++++++++++ man3/libsimple_memtolower.3 | 92 ++++++++++++++++++++++++++++++++++++++ man3/libsimple_memtoupper.3 | 92 ++++++++++++++++++++++++++++++++++++++ man3/libsimple_stpntolower.3 | 1 + man3/libsimple_stpntoupper.3 | 1 + man3/libsimple_stptolower.3 | 1 + man3/libsimple_stptoupper.3 | 1 + man3/libsimple_strmove.3 | 2 +- man3/libsimple_strnreplace.3 | 81 ++++++++++++++++++++++++++++++++++ man3/libsimple_strntolower.3 | 97 +++++++++++++++++++++++++++++++++++++++++ man3/libsimple_strntoupper.3 | 97 +++++++++++++++++++++++++++++++++++++++++ man3/libsimple_strreplace.3 | 76 ++++++++++++++++++++++++++++++++ man3/libsimple_strtolower.3 | 95 ++++++++++++++++++++++++++++++++++++++++ man3/libsimple_strtoupper.3 | 95 ++++++++++++++++++++++++++++++++++++++++ memptolower.c | 2 +- memptoupper.c | 2 +- memreplaceelem.c | 2 +- stpntolower.c | 2 +- stpntoupper.c | 2 +- stptolower.c | 2 +- stptoupper.c | 2 +- 27 files changed, 906 insertions(+), 17 deletions(-) create mode 120000 man3/libsimple_memptolower.3 create mode 120000 man3/libsimple_memptoupper.3 create mode 100644 man3/libsimple_memreplace.3 create mode 100644 man3/libsimple_memreplaceelem.3 create mode 100644 man3/libsimple_memtolower.3 create mode 100644 man3/libsimple_memtoupper.3 create mode 120000 man3/libsimple_stpntolower.3 create mode 120000 man3/libsimple_stpntoupper.3 create mode 120000 man3/libsimple_stptolower.3 create mode 120000 man3/libsimple_stptoupper.3 create mode 100644 man3/libsimple_strnreplace.3 create mode 100644 man3/libsimple_strntolower.3 create mode 100644 man3/libsimple_strntoupper.3 create mode 100644 man3/libsimple_strreplace.3 create mode 100644 man3/libsimple_strtolower.3 create mode 100644 man3/libsimple_strtoupper.3 diff --git a/libsimple/mem.h b/libsimple/mem.h index 5ec8f9e..61df6bc 100644 --- a/libsimple/mem.h +++ b/libsimple/mem.h @@ -690,7 +690,7 @@ libsimple_rawmemcmove(void *__d_, const void *__s_, int __c_) /* TODO man */ * @return `(void *)&((char *)s)[n]` */ static inline void * -libsimple_memreplace(void *__s_, int __old_, int __new_, size_t __n) /* TODO man */ +libsimple_memreplace(void *__s_, int __old_, int __new_, size_t __n) { char __old = (char)__old_, __new = (char)__new_, *__s = __s_; char *__ret = &__s[__n]; @@ -755,7 +755,7 @@ void *libsimple_memptoupper(void *__d, const void *__s, size_t __n); * @param n The number of bytes to copy or covert * @return `d` */ -static inline void *libsimple_memtolower(void *__d, const void *__s, size_t __n) /* TODO man */ +static inline void *libsimple_memtolower(void *__d, const void *__s, size_t __n) { libsimple_memptolower(__d, __s, __n); return __d; } #ifndef memtolower # define memtolower libsimple_memtolower @@ -775,7 +775,7 @@ static inline void *libsimple_memtolower(void *__d, const void *__s, size_t __n) * @param n The number of bytes to copy or covert * @return `d` */ -static inline void *libsimple_memtoupper(void *__d, const void *__s, size_t __n) /* TODO man */ +static inline void *libsimple_memtoupper(void *__d, const void *__s, size_t __n) { libsimple_memptoupper(__d, __s, __n); return __d; } #ifndef memtoupper # define memtoupper libsimple_memtoupper diff --git a/libsimple/str.h b/libsimple/str.h index 5a5c146..b7251f5 100644 --- a/libsimple/str.h +++ b/libsimple/str.h @@ -595,7 +595,7 @@ char *libsimple_strcmove(char *, const char *, int); */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) static inline char * -libsimple_strreplace(char *__s, int __old_, int __new_) /* TODO man */ +libsimple_strreplace(char *__s, int __old_, int __new_) { char __old = (char)__old_, __new = (char)__new_; for (; *__s; __s++) @@ -659,7 +659,7 @@ char *libsimple_stptoupper(char *__d, const char *__s); * @return `d` */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char *libsimple_strtolower(char *__d, const char *__s) /* TODO man */ +static inline char *libsimple_strtolower(char *__d, const char *__s) { libsimple_stptolower(__d, __s); return __d; } #ifndef strtolower # define strtolower libsimple_strtolower @@ -679,7 +679,7 @@ static inline char *libsimple_strtolower(char *__d, const char *__s) /* TODO man * @return `d` */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char *libsimple_strtoupper(char *__d, const char *__s) /* TODO man */ +static inline char *libsimple_strtoupper(char *__d, const char *__s) { libsimple_stptoupper(__d, __s); return __d; } #ifndef strtoupper # define strtoupper libsimple_strtoupper diff --git a/libsimple/strn.h b/libsimple/strn.h index 59539e1..69660ff 100644 --- a/libsimple/strn.h +++ b/libsimple/strn.h @@ -680,7 +680,7 @@ char *libsimple_strncmove(char *, const char *, int, size_t); */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) static inline char * -libsimple_strnreplace(char *__s, int __old_, int __new_, size_t __n) /* TODO man */ +libsimple_strnreplace(char *__s, int __old_, int __new_, size_t __n) { char __old = (char)__old_, __new = (char)__new_; for (; __n && *__s; __s++, __n--) @@ -747,7 +747,7 @@ char *libsimple_stpntoupper(char *__d, const char *__s, size_t __n); * @return `d` */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char *libsimple_strntolower(char *__d, const char *__s, size_t __n) /* TODO man */ +static inline char *libsimple_strntolower(char *__d, const char *__s, size_t __n) { libsimple_stpntolower(__d, __s, __n); return __d; } #ifndef strntolower # define strntolower libsimple_strntolower @@ -768,7 +768,7 @@ static inline char *libsimple_strntolower(char *__d, const char *__s, size_t __n * @return `d` */ _LIBSIMPLE_GCC_ONLY(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char *libsimple_strntoupper(char *__d, const char *__s, size_t __n) /* TODO man */ +static inline char *libsimple_strntoupper(char *__d, const char *__s, size_t __n) { libsimple_stpntoupper(__d, __s, __n); return __d; } #ifndef strntoupper # define strntoupper libsimple_strntoupper diff --git a/man3/libsimple_memptolower.3 b/man3/libsimple_memptolower.3 new file mode 120000 index 0000000..15069ef --- /dev/null +++ b/man3/libsimple_memptolower.3 @@ -0,0 +1 @@ +libsimple_memtolower.3 \ No newline at end of file diff --git a/man3/libsimple_memptoupper.3 b/man3/libsimple_memptoupper.3 new file mode 120000 index 0000000..61fe5ba --- /dev/null +++ b/man3/libsimple_memptoupper.3 @@ -0,0 +1 @@ +libsimple_memtoupper.3 \ No newline at end of file diff --git a/man3/libsimple_memreplace.3 b/man3/libsimple_memreplace.3 new file mode 100644 index 0000000..25fd6d1 --- /dev/null +++ b/man3/libsimple_memreplace.3 @@ -0,0 +1,76 @@ +.TH LIBSIMPLE_MEMREPLACE 3 2018-11-25 libsimple +.SH NAME +libsimple_memreplace \- replace bytes in an array of bytes +.SH SYNOPSIS +.nf +#include + +static inline void *libsimple_memreplace(void *\fIs\fP, int \fIold\fP, int \fInew\fP, size_t \fIn\fP); + +#ifndef memreplace +# define memreplace libsimple_memreplace +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memreplace () +function replaces all instances of the byte +.I old +(it is converted to a +.BR char ) +in the byte array +.IR s , +with the size +.IR n , +with the byte +.IR new . +.PP +The comparison is case-sensitive. +.SH RETURN VALUE +The +.BR libsimple_memreplace () +function returns +.IR &s[n] . +.SH ERRORS +The +.BR libsimple_memreplace () +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_memreplace () +T} Thread safety MT-Safe +T{ +.BR libsimple_memreplace () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memreplace () +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_memtolower (3), +.BR libsimple_memtoupper (3), +.BR libsimple_strreplace (3), +.BR libsimple_strnreplace (3), +.BR libsimple_memreplaceelem (3) diff --git a/man3/libsimple_memreplaceelem.3 b/man3/libsimple_memreplaceelem.3 new file mode 100644 index 0000000..02e0f06 --- /dev/null +++ b/man3/libsimple_memreplaceelem.3 @@ -0,0 +1,82 @@ +.TH LIBSIMPLE_MEMREPLACEELEM 3 2018-11-25 libsimple +.SH NAME +libsimple_memreplaceelem \- replace elements in an array +.SH SYNOPSIS +.nf +#include + +void *libsimple_memreplaceelem(void *\fIs\fP, int \fIold\fP, int \fInew\fP, size_t \fIn\fP, size_t \fIwidth\fP); + +#ifndef memreplaceelem +# define memreplaceelem libsimple_memreplaceelem +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memreplaceelem () +function replaces all instances of the element +.IR old , +with size +.IR width , +in the array +.IR s , +with the size of +.I n +elements of size +.IR width , +with the element +.IR new , +also with the size +.IR width . +The replace elements in +.I s +are aligned by +.I width +bytes in +.IR s . +.SH RETURN VALUE +The +.BR libsimple_memreplaceelem () +function returns +.IR &s[n*width] . +.SH ERRORS +The +.BR libsimple_memreplaceelem () +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_memreplaceelem () +T} Thread safety MT-Safe +T{ +.BR libsimple_memreplaceelem () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memreplaceelem () +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_memreplace (3), +.BR libsimple_strreplace (3), +.BR libsimple_strnreplace (3) diff --git a/man3/libsimple_memtolower.3 b/man3/libsimple_memtolower.3 new file mode 100644 index 0000000..be09689 --- /dev/null +++ b/man3/libsimple_memtolower.3 @@ -0,0 +1,92 @@ +.TH LIBSIMPLE_MEMTOLOWER 3 2018-11-25 libsimple +.SH NAME +libsimple_memtolower, libsimple_memptolower \- convert a character array to lower case +.SH SYNOPSIS +.nf +#include + +static inline void *libsimple_memtolower(void *\fIdest\fP, const void *\fIsrc\fP, size_t \fIn\fP); +void *libsimple_memptolower(void *\fIdest\fP, const void *\fIsrc\fP, size_t \fIn\fP); + +#ifndef memtolower +# define memtolower libsimple_memtolower +#endif +#ifndef memptolower +# define memptolower libsimple_memptolower +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memtolower () +and +.BR libsimple_memptolower () +functions copies the first +.I n +characters from the array +.I src +into the +.I array. +All upper case ASCII characters will be converted +to lower case. The arrays may overlap, and there +is an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_memtolower () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_memptolower () +function returns +.IR &dest[n] . +.SH ERRORS +The +.BR libsimple_memtolower () +and +.BR libsimple_memptolower () +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_memtolower (), +.br +.BR libsimple_memptolower () +T} Thread safety MT-Safe +T{ +.BR libsimple_memtolower (), +.br +.BR libsimple_memptolower () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memtolower (), +.br +.BR libsimple_memptolower () +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_memtoupper (3), +.BR libsimple_memreplace (3), +.BR libsimple_strtolower (3), +.BR libsimple_strntolower (3) diff --git a/man3/libsimple_memtoupper.3 b/man3/libsimple_memtoupper.3 new file mode 100644 index 0000000..6f45d54 --- /dev/null +++ b/man3/libsimple_memtoupper.3 @@ -0,0 +1,92 @@ +.TH LIBSIMPLE_MEMTOUPPER 3 2018-11-25 libsimple +.SH NAME +libsimple_memtoupper, libsimple_memptoupper \- convert a character array to upper case +.SH SYNOPSIS +.nf +#include + +static inline void *libsimple_memtoupper(void *\fIdest\fP, const void *\fIsrc\fP, size_t \fIn\fP); +void *libsimple_memptoupper(void *\fIdest\fP, const void *\fIsrc\fP, size_t \fIn\fP); + +#ifndef memtoupper +# define memtoupper libsimple_memtoupper +#endif +#ifndef memptoupper +# define memptoupper libsimple_memptoupper +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memtoupper () +and +.BR libsimple_memptoupper () +functions copies the first +.I n +characters from the array +.I src +into the +.I array. +All lower case ASCII characters will be converted +to upper case. The arrays may overlap, and there +is an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_memtoupper () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_memptoupper () +function returns +.IR &dest[n] . +.SH ERRORS +The +.BR libsimple_memtoupper () +and +.BR libsimple_memptoupper () +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_memtoupper (), +.br +.BR libsimple_memptoupper () +T} Thread safety MT-Safe +T{ +.BR libsimple_memtoupper (), +.br +.BR libsimple_memptoupper () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memtoupper (), +.br +.BR libsimple_memptoupper () +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_memtolower (3), +.BR libsimple_memreplace (3), +.BR libsimple_strtoupper (3), +.BR libsimple_strntoupper (3) diff --git a/man3/libsimple_stpntolower.3 b/man3/libsimple_stpntolower.3 new file mode 120000 index 0000000..8ed56d9 --- /dev/null +++ b/man3/libsimple_stpntolower.3 @@ -0,0 +1 @@ +libsimple_strntolower.3 \ No newline at end of file diff --git a/man3/libsimple_stpntoupper.3 b/man3/libsimple_stpntoupper.3 new file mode 120000 index 0000000..72dc5e6 --- /dev/null +++ b/man3/libsimple_stpntoupper.3 @@ -0,0 +1 @@ +libsimple_strntoupper.3 \ No newline at end of file diff --git a/man3/libsimple_stptolower.3 b/man3/libsimple_stptolower.3 new file mode 120000 index 0000000..cc6ac1f --- /dev/null +++ b/man3/libsimple_stptolower.3 @@ -0,0 +1 @@ +libsimple_strtolower.3 \ No newline at end of file diff --git a/man3/libsimple_stptoupper.3 b/man3/libsimple_stptoupper.3 new file mode 120000 index 0000000..ec7e542 --- /dev/null +++ b/man3/libsimple_stptoupper.3 @@ -0,0 +1 @@ +libsimple_strtoupper.3 \ No newline at end of file diff --git a/man3/libsimple_strmove.3 b/man3/libsimple_strmove.3 index 39c4572..a145c62 100644 --- a/man3/libsimple_strmove.3 +++ b/man3/libsimple_strmove.3 @@ -5,7 +5,7 @@ libsimple_strmove \- move a string within an array of bytes .nf #include -static inline void *libsimple_strmove(void *\fIdest\fP, const void *\fIsrc\fP); +static inline char *libsimple_strmove(char *\fIdest\fP, const char *\fIsrc\fP); #ifndef strmove # define strmove libsimple_strmove diff --git a/man3/libsimple_strnreplace.3 b/man3/libsimple_strnreplace.3 new file mode 100644 index 0000000..ef2a4fe --- /dev/null +++ b/man3/libsimple_strnreplace.3 @@ -0,0 +1,81 @@ +.TH LIBSIMPLE_STRNREPLACE 3 2018-11-25 libsimple +.SH NAME +libsimple_strnreplace \- replace characters in a string +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strnreplace(char *\fIs\fP, int \fIold\fP, int \fInew\fP, size_t \fIn\fP); + +#ifndef strnreplace +# define strnreplace libsimple_strnreplace +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strnreplace () +function replaces all instances of the character +.I old +(it is converted to a +.BR char ) +in the string +.I s +with the character +.IR new , +up to the +.I n th +character (up the last character +.I s +is shorter). +.PP +The comparison is case-sensitive. +.SH RETURN VALUE +The +.BR libsimple_strnreplace () +function returns the end of +.IR s , +that is +.I &s[strnlen(s,n)] +(as evaluated before the function call). +.SH ERRORS +The +.BR libsimple_strnreplace () +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_strnreplace () +T} Thread safety MT-Safe +T{ +.BR libsimple_strnreplace () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strnreplace () +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_strntolower (3), +.BR libsimple_strntoupper (3), +.BR libsimple_strreplace (3), +.BR libsimple_memreplace (3) diff --git a/man3/libsimple_strntolower.3 b/man3/libsimple_strntolower.3 new file mode 100644 index 0000000..805adf4 --- /dev/null +++ b/man3/libsimple_strntolower.3 @@ -0,0 +1,97 @@ +.TH LIBSIMPLE_STRNTOLOWER 3 2018-11-25 libsimple +.SH NAME +libsimple_strntolower, libsimple_stpntolower \- convert a string to lower case +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strntolower(char *\fIdest\fP, const char *\fIsrc\fP, size_t \fIn\fP); +char *libsimple_stpntolower(char *\fIdest\fP, const char *\fIsrc\fP, size_t \fIn\fP); + +#ifndef strntolower +# define strntolower libsimple_strntolower +#endif +#ifndef stpntolower +# define stpntolower libsimple_stpntolower +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strntolower () +and +.BR libsimple_stpntolower () +functions copies and covert a string, including the +NUL byte that terminates it, to lower case. +The string +.I src +is copied into +.IR dest , +with all upper case ASCII characters converted to +lower case; however no more than +.I n +bytes will be copied or coverted. The arrays may overlap, +and there is an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_strntolower () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_stpntolower () +function returns the pointer +end of the string copied into +.IR dest , +that is +.IR &dest[strnlen(src,n)] . +.SH ERRORS +The +.BR libsimple_strntolower () +and +.BR libsimple_stpntolower () +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_strntolower (), +.br +.BR libsimple_stpntolower () +T} Thread safety MT-Safe +T{ +.BR libsimple_strntolower (), +.br +.BR libsimple_stpntolower () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strntolower (), +.br +.BR libsimple_stpntolower () +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_strntoupper (3), +.BR libsimple_strnreplace (3), +.BR libsimple_strnntolower (3), +.BR libsimple_memntolower (3) diff --git a/man3/libsimple_strntoupper.3 b/man3/libsimple_strntoupper.3 new file mode 100644 index 0000000..f045291 --- /dev/null +++ b/man3/libsimple_strntoupper.3 @@ -0,0 +1,97 @@ +.TH LIBSIMPLE_STRNTOUPPER 3 2018-11-25 libsimple +.SH NAME +libsimple_strntoupper, libsimple_stpntoupper \- convert a string to upper case +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strntoupper(char *\fIdest\fP, const char *\fIsrc\fP, size_t \fIn\fP); +char *libsimple_stpntoupper(char *\fIdest\fP, const char *\fIsrc\fP, size_t \fIn\fP); + +#ifndef strntoupper +# define strntoupper libsimple_strntoupper +#endif +#ifndef stpntoupper +# define stpntoupper libsimple_stpntoupper +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strntoupper () +and +.BR libsimple_stpntoupper () +functions copies and covert a string, including the +NUL byte that terminates it, to upper case. +The string +.I src +is copied into +.IR dest , +with all lower case ASCII characters converted to +upper case; however no more than +.I n +bytes will be copied or coverted. The arrays may overlap, +and there is an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_strntoupper () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_stpntoupper () +function returns the pointer +end of the string copied into +.IR dest , +that is +.IR &dest[strnlen(src,n)] . +.SH ERRORS +The +.BR libsimple_strntoupper () +and +.BR libsimple_stpntoupper () +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_strntoupper (), +.br +.BR libsimple_stpntoupper () +T} Thread safety MT-Safe +T{ +.BR libsimple_strntoupper (), +.br +.BR libsimple_stpntoupper () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strntoupper (), +.br +.BR libsimple_stpntoupper () +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_strntolower (3), +.BR libsimple_strnreplace (3), +.BR libsimple_strnntoupper (3), +.BR libsimple_memntoupper (3) diff --git a/man3/libsimple_strreplace.3 b/man3/libsimple_strreplace.3 new file mode 100644 index 0000000..96d20e0 --- /dev/null +++ b/man3/libsimple_strreplace.3 @@ -0,0 +1,76 @@ +.TH LIBSIMPLE_STRREPLACE 3 2018-11-25 libsimple +.SH NAME +libsimple_strreplace \- replace characters in a string +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strreplace(char *\fIs\fP, int \fIold\fP, int \fInew\fP); + +#ifndef strreplace +# define strreplace libsimple_strreplace +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strreplace () +function replaces all instances of the character +.I old +(it is converted to a +.BR char ) +in the string +.I s +with the character +.IR new . +.PP +The comparison is case-sensitive. +.SH RETURN VALUE +The +.BR libsimple_strreplace () +function returns the end of +.IR s , +that is +.I &s[strlen(s)] +(as evaluated before the function call). +.SH ERRORS +The +.BR libsimple_strreplace () +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_strreplace () +T} Thread safety MT-Safe +T{ +.BR libsimple_strreplace () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strreplace () +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_strtolower (3), +.BR libsimple_strtoupper (3), +.BR libsimple_strnreplace (3), +.BR libsimple_memreplace (3) diff --git a/man3/libsimple_strtolower.3 b/man3/libsimple_strtolower.3 new file mode 100644 index 0000000..385de39 --- /dev/null +++ b/man3/libsimple_strtolower.3 @@ -0,0 +1,95 @@ +.TH LIBSIMPLE_STRTOLOWER 3 2018-11-25 libsimple +.SH NAME +libsimple_strtolower, libsimple_stptolower \- convert a string to lower case +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strtolower(char *\fIdest\fP, const char *\fIsrc\fP); +char *libsimple_stptolower(char *\fIdest\fP, const char *\fIsrc\fP); + +#ifndef strtolower +# define strtolower libsimple_strtolower +#endif +#ifndef stptolower +# define stptolower libsimple_stptolower +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strtolower () +and +.BR libsimple_stptolower () +functions copies and covert a string, including the +NUL byte that terminates it, to lower case. +The string +.I src +is copied into +.IR dest , +with all upper case ASCII characters converted to +lower case. The arrays may overlap, and there is +an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_strtolower () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_stptolower () +function returns the pointer +end of the string copied into +.IR dest , +that is +.IR &dest[strlen(src)] . +.SH ERRORS +The +.BR libsimple_strtolower () +and +.BR libsimple_stptolower () +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_strtolower (), +.br +.BR libsimple_stptolower () +T} Thread safety MT-Safe +T{ +.BR libsimple_strtolower (), +.br +.BR libsimple_stptolower () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strtolower (), +.br +.BR libsimple_stptolower () +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_strtoupper (3), +.BR libsimple_strreplace (3), +.BR libsimple_strntolower (3), +.BR libsimple_memtolower (3) diff --git a/man3/libsimple_strtoupper.3 b/man3/libsimple_strtoupper.3 new file mode 100644 index 0000000..cc1de4f --- /dev/null +++ b/man3/libsimple_strtoupper.3 @@ -0,0 +1,95 @@ +.TH LIBSIMPLE_STRTOUPPER 3 2018-11-25 libsimple +.SH NAME +libsimple_strtoupper, libsimple_stptoupper \- convert a string to upper case +.SH SYNOPSIS +.nf +#include + +static inline char *libsimple_strtoupper(char *\fIdest\fP, const char *\fIsrc\fP); +char *libsimple_stptoupper(char *\fIdest\fP, const char *\fIsrc\fP); + +#ifndef strtoupper +# define strtoupper libsimple_strtoupper +#endif +#ifndef stptoupper +# define stptoupper libsimple_stptoupper +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strtoupper () +and +.BR libsimple_stptoupper () +functions copies and covert a string, including the +NUL byte that terminates it, to upper case. +The string +.I src +is copied into +.IR dest , +with all lower case ASCII characters converted to +upper case. The arrays may overlap, and there is +an optimisation for the case where +.IR dest==src . +.SH RETURN VALUE +The +.BR libsimple_strtoupper () +function returns the pointer +.IR dest . +.PP +The +.BR libsimple_stptoupper () +function returns the pointer +end of the string copied into +.IR dest , +that is +.IR &dest[strlen(src)] . +.SH ERRORS +The +.BR libsimple_strtoupper () +and +.BR libsimple_stptoupper () +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_strtoupper (), +.br +.BR libsimple_stptoupper () +T} Thread safety MT-Safe +T{ +.BR libsimple_strtoupper (), +.br +.BR libsimple_stptoupper () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strtoupper (), +.br +.BR libsimple_stptoupper () +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_strtolower (3), +.BR libsimple_strreplace (3), +.BR libsimple_strntoupper (3), +.BR libsimple_memtoupper (3) diff --git a/memptolower.c b/memptolower.c index de813e5..251a13a 100644 --- a/memptolower.c +++ b/memptolower.c @@ -4,7 +4,7 @@ void * -libsimple_memptolower(void *d_, const void *s_, size_t n) /* TODO man */ +libsimple_memptolower(void *d_, const void *s_, size_t n) { char *ret, *d = d_; const char *s = s_; diff --git a/memptoupper.c b/memptoupper.c index 55d5e45..f9798f4 100644 --- a/memptoupper.c +++ b/memptoupper.c @@ -4,7 +4,7 @@ void * -libsimple_memptoupper(void *d_, const void *s_, size_t n) /* TODO man */ +libsimple_memptoupper(void *d_, const void *s_, size_t n) { char *ret, *d = d_; const char *s = s_; diff --git a/memreplaceelem.c b/memreplaceelem.c index fc4762d..44f94a5 100644 --- a/memreplaceelem.c +++ b/memreplaceelem.c @@ -4,7 +4,7 @@ void * -libsimple_memreplaceelem(void *restrict s_, const void *old_, const void *new_, size_t n, size_t width) /* TODO man */ +libsimple_memreplaceelem(void *restrict s_, const void *old_, const void *new_, size_t n, size_t width) { switch (width) { case 0: diff --git a/stpntolower.c b/stpntolower.c index 9fc4466..9aca9f9 100644 --- a/stpntolower.c +++ b/stpntolower.c @@ -4,7 +4,7 @@ char * -libsimple_stpntolower(char *d, const char *s, size_t n) /* TODO man */ +libsimple_stpntolower(char *d, const char *s, size_t n) { size_t i; char *ret; diff --git a/stpntoupper.c b/stpntoupper.c index 588cb89..a6e3769 100644 --- a/stpntoupper.c +++ b/stpntoupper.c @@ -4,7 +4,7 @@ char * -libsimple_stpntoupper(char *d, const char *s, size_t n) /* TODO man */ +libsimple_stpntoupper(char *d, const char *s, size_t n) { size_t i; char *ret; diff --git a/stptolower.c b/stptolower.c index ce9dbf8..61108ad 100644 --- a/stptolower.c +++ b/stptolower.c @@ -4,7 +4,7 @@ char * -libsimple_stptolower(char *d, const char *s) /* TODO man */ +libsimple_stptolower(char *d, const char *s) { size_t n; char *ret; diff --git a/stptoupper.c b/stptoupper.c index fca38ce..ad6c73e 100644 --- a/stptoupper.c +++ b/stptoupper.c @@ -4,7 +4,7 @@ char * -libsimple_stptoupper(char *d, const char *s) /* TODO man */ +libsimple_stptoupper(char *d, const char *s) { size_t n; char *ret; -- cgit v1.2.3-70-g09d2