1.\" $OpenBSD: stpcpy.3,v 1.2 2012/01/17 08:12:12 jmc Exp $ 2.\" 3.\" Copyright (c) 1990, 1991 The Regents of the University of California. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" Chris Torek and the American National Standards Committee X3, 8.\" on Information Processing Systems. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.Dd $Mdocdate: January 17 2012 $ 35.Dt STPCPY 3 36.Os 37.Sh NAME 38.Nm stpcpy , 39.Nm stpncpy 40.Nd copy strings 41.Sh SYNOPSIS 42.Fd #include <string.h> 43.Ft char * 44.Fn stpcpy "char *dst" "const char *src" 45.Ft char * 46.Fn stpncpy "char *dst" "const char *src" "size_t len" 47.Sh DESCRIPTION 48The 49.Fn stpcpy 50and 51.Fn stpncpy 52functions copy the string 53.Fa src 54to 55.Fa dst 56(including the terminating 57.Ql \e0 58character). 59.Pp 60The 61.Fn stpncpy 62function copies not more than 63.Fa len 64characters into 65.Fa dst , 66appending 67.Ql \e0 68characters if 69.Fa src 70is less than 71.Fa len 72characters long, and 73.Em not 74terminating 75.Fa dst 76if the length of 77.Fa src 78is greater than or equal to 79.Fa len . 80.Sh RETURN VALUES 81The 82.Fn stpcpy 83function returns a pointer to the terminating 84.Ql \e0 85character written into 86.Fa dst . 87.Pp 88The 89.Fn stpncpy 90function returns a pointer to the first 91.Ql \e0 92character written into 93.Fa dst , 94or to 95.Fa &dst[len] 96if the length of 97.Fa src 98is greater than or equal to 99.Fa len . 100.Sh SEE ALSO 101.Xr strcpy 3 , 102.Xr strlcpy 3 , 103.Xr strncpy 3 104.Sh STANDARDS 105The 106.Fn stpcpy 107and 108.Fn stpncpy 109functions conform to 110.St -p1003.1-2008 . 111.Sh HISTORY 112The 113.Fn stpcpy 114and 115.Fn stpncpy 116functions first appeared in 117.Ox 5.1 . 118