mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-25 15:15:42 +00:00
80 lines
2.8 KiB
Groff
80 lines
2.8 KiB
Groff
.\"-
|
|
.\" Copyright (c) 2015 The University of Oslo
|
|
.\" Copyright (c) 2016-2017 Dag-Erling Smørgrav
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modificpyion, 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 May 2, 2017
|
|
.Dt cryb_strlcpy 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm cryb_strlcpy
|
|
.Nd safely copy a string into a buffer
|
|
.Sh LIBRARY
|
|
.Lb libcryb
|
|
.Sh SYNOPSIS
|
|
.In stddef.h
|
|
.In cryb/strlcpy.h
|
|
.Ft size_t
|
|
.Fn cryb_strlcpy "char *dst" "const char *src" "size_t size"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Nm cryb_strlcpy
|
|
function copies the NUL-terminated string pointed to by
|
|
.Va src
|
|
into the buffer pointed to by
|
|
.Va dst .
|
|
The
|
|
.Va size
|
|
argument specifies the total size of the buffer, including the space
|
|
required for the terminating NUL character.
|
|
If the length of the string exceeds the available space, the result is
|
|
truncated.
|
|
In either case, the destination buffer is properly NUL-terminated.
|
|
.Sh RETURN VALUES
|
|
The
|
|
.Fn cryb_strlcpy
|
|
function returns the length of the original string.
|
|
If this number is equal to or greater than the value of
|
|
.Va size ,
|
|
the string was too long to fit in the buffer.
|
|
.Sh IMPLEMENTATION NOTES
|
|
If the
|
|
.Dv HAVE_STRLCPY
|
|
preprocessor macro is defined to 0 or undefined, the
|
|
.In cryb/strlcpy.h
|
|
header provides a
|
|
.Fn strlcpy
|
|
macro as an alias to
|
|
.Fn cryb_strlcpy .
|
|
.Sh SEE ALSO
|
|
.Xr cryb_strlcat 3
|
|
.Sh AUTHORS
|
|
The
|
|
.Fn cryb_strlcpy
|
|
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 .
|