mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-26 06:21:07 +00:00
118 lines
3.1 KiB
Groff
118 lines
3.1 KiB
Groff
|
.\"-
|
||
|
.\" 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 .
|