mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-23 22:25:46 +00:00
Add man pages for memset_s(3) and memcpy_s(3)
This commit is contained in:
parent
c73fd34d97
commit
d6e82b474f
3 changed files with 230 additions and 0 deletions
|
@ -22,6 +22,8 @@ libcryb_core_la_SOURCES = \
|
|||
EXTRA_DIST = cryb_string_impl.c
|
||||
|
||||
dist_man3_MANS = \
|
||||
cryb_memcpy_s.3 \
|
||||
cryb_memset_s.3 \
|
||||
cryb_strlcat.3 \
|
||||
cryb_strlcpy.3
|
||||
|
||||
|
|
117
lib/core/cryb_memcpy_s.3
Normal file
117
lib/core/cryb_memcpy_s.3
Normal file
|
@ -0,0 +1,117 @@
|
|||
.\"-
|
||||
.\" Copyright (c) 2015 Universitetet i Oslo
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 15, 2015
|
||||
.Dt cryb_memcpy_s 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm cryb_memcpy_s
|
||||
.Nd safely copy one buffer to another
|
||||
.Sh LIBRARY
|
||||
.Lb libcryb-core
|
||||
.Sh SYNOPSIS
|
||||
.In cryb/memcpy_s.h
|
||||
.Ft void *
|
||||
.Fn cryb_memcpy_s "void *d" "size_t dsz" "const void *s" "size_t n"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm cryb_memcpy_s
|
||||
function copies the first
|
||||
.Va n
|
||||
bytes of the buffer pointed to by
|
||||
.Va s
|
||||
into the buffer pointed to by
|
||||
.Va d ,
|
||||
of size
|
||||
.Va dsz .
|
||||
If
|
||||
.Va s
|
||||
is
|
||||
.Dv NULL ,
|
||||
.Va n
|
||||
is greater than
|
||||
.Va dsz
|
||||
or
|
||||
.Dv SIZE_MAX
|
||||
or the source and destination overlap, the buffer pointed to by
|
||||
.Va d
|
||||
is filled with zeroes and an error is returned.
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn cryb_memcpy_s
|
||||
function returns zero if successful and a non-zero error code if an
|
||||
error occurred.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Va d
|
||||
argument was
|
||||
.Dv NULL
|
||||
or the source and destination ranges were found to overlap.
|
||||
.It Bq Er ERANGE
|
||||
Either or both of the
|
||||
.Va dsz
|
||||
and
|
||||
.Va n
|
||||
arguments were greater than
|
||||
.Dv SIZE_MAX .
|
||||
.It Bq Er EOVERFLOW
|
||||
The
|
||||
.Va n
|
||||
argument was greater than the
|
||||
.Va dsz
|
||||
argument.
|
||||
.El
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
If the
|
||||
.Dv HAVE_MEMCPY_S
|
||||
preprocessor macro is defined to 0 or undefined, the
|
||||
.In cryb/memcpy_s.h
|
||||
header provides a
|
||||
.Fn memcpy_s
|
||||
macro as an alias to
|
||||
.Fn cryb_memcpy_s .
|
||||
.Pp
|
||||
The argument and return types for
|
||||
.Nm
|
||||
differ from those of its C11 equivalent, as it is expected to be used
|
||||
in environments in which
|
||||
.Vt rsize_t
|
||||
and
|
||||
.Dv RSIZE_MAX
|
||||
are not defined.
|
||||
.Sh SEE ALSO
|
||||
.Xr cryb_memset_s 3 ,
|
||||
.Xr memcpy 3
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Fn cryb_memcpy_s
|
||||
function and this manual page were written for the University of Oslo
|
||||
by
|
||||
.An Dag-Erling Sm\(/orgrav Aq Mt d.e.smorgrav@usit.uio.no .
|
111
lib/core/cryb_memset_s.3
Normal file
111
lib/core/cryb_memset_s.3
Normal file
|
@ -0,0 +1,111 @@
|
|||
.\"-
|
||||
.\" Copyright (c) 2015 Universitetet i Oslo
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 15, 2015
|
||||
.Dt cryb_memset_s 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm cryb_memset_s
|
||||
.Nd safely fill a buffer
|
||||
.Sh LIBRARY
|
||||
.Lb libcryb-core
|
||||
.Sh SYNOPSIS
|
||||
.In cryb/memset_s.h
|
||||
.Ft void *
|
||||
.Fn cryb_memset_s "void *d" "size_t dsz" "int ch" "size_t n"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm cryb_memset_s
|
||||
function overwrites the first
|
||||
.Va n
|
||||
bytes of the buffer pointed to by
|
||||
.Va d ,
|
||||
of size
|
||||
.Va dsz ,
|
||||
with copies of the least-significant byte of
|
||||
.Va ch .
|
||||
If
|
||||
.Va n
|
||||
is greater than
|
||||
.Va dsz ,
|
||||
only
|
||||
.Va dsz
|
||||
bytes are overwritten, and an error is returned.
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Nm
|
||||
function returns zero if successful and a non-zero error code if an
|
||||
error occurred.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Va d
|
||||
argument was
|
||||
.Dv NULL .
|
||||
.It Bq Er ERANGE
|
||||
Either or both of the
|
||||
.Va dsz
|
||||
and
|
||||
.Va n
|
||||
arguments were greater than
|
||||
.Dv SIZE_MAX .
|
||||
.It Bq Er EOVERFLOW
|
||||
The
|
||||
.Va n
|
||||
argument was greater than the
|
||||
.Va dsz
|
||||
argument.
|
||||
.El
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
If the
|
||||
.Dv HAVE_MEMSET_S
|
||||
preprocessor macro is defined to 0 or undefined, the
|
||||
.In cryb/memset_s.h
|
||||
header provides a
|
||||
.Fn memset_s
|
||||
macro as an alias to
|
||||
.Fn cryb_memset_s .
|
||||
.Pp
|
||||
The argument and return types for
|
||||
.Nm
|
||||
differ from those of its C11 equivalent, as it is expected to be used
|
||||
in environments in which
|
||||
.Vt rsize_t
|
||||
and
|
||||
.Dv RSIZE_MAX
|
||||
are not defined.
|
||||
.Sh SEE ALSO
|
||||
.Xr cryb_memcpy_s 3 ,
|
||||
.Xr memset 3
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Fn cryb_memset_s
|
||||
function and this manual page were written for the University of Oslo
|
||||
by
|
||||
.An Dag-Erling Sm\(/orgrav Aq Mt d.e.smorgrav@usit.uio.no .
|
Loading…
Reference in a new issue