xref: /freebsd/lib/libc/string/stpcpy.c (revision e55512504d0178983978d64d67eed1cc85826523)
18a16b7a1SPedro F. Giffuni /*-
28a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni  *
48269e8c8SDavid E. O'Brien  * Copyright (c) 1999
58269e8c8SDavid E. O'Brien  *	David E. O'Brien
68269e8c8SDavid E. O'Brien  * Copyright (c) 1988, 1993
78269e8c8SDavid E. O'Brien  *	The Regents of the University of California.  All rights reserved.
88269e8c8SDavid E. O'Brien  *
98269e8c8SDavid E. O'Brien  * Redistribution and use in source and binary forms, with or without
108269e8c8SDavid E. O'Brien  * modification, are permitted provided that the following conditions
118269e8c8SDavid E. O'Brien  * are met:
128269e8c8SDavid E. O'Brien  * 1. Redistributions of source code must retain the above copyright
138269e8c8SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer.
148269e8c8SDavid E. O'Brien  * 2. Redistributions in binary form must reproduce the above copyright
158269e8c8SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer in the
168269e8c8SDavid E. O'Brien  *    documentation and/or other materials provided with the distribution.
178269e8c8SDavid E. O'Brien  * 3. Neither the name of the University nor the names of its contributors
188269e8c8SDavid E. O'Brien  *    may be used to endorse or promote products derived from this software
198269e8c8SDavid E. O'Brien  *    without specific prior written permission.
208269e8c8SDavid E. O'Brien  *
218269e8c8SDavid E. O'Brien  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
228269e8c8SDavid E. O'Brien  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
238269e8c8SDavid E. O'Brien  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
248269e8c8SDavid E. O'Brien  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
258269e8c8SDavid E. O'Brien  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
268269e8c8SDavid E. O'Brien  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
278269e8c8SDavid E. O'Brien  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
288269e8c8SDavid E. O'Brien  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
298269e8c8SDavid E. O'Brien  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
308269e8c8SDavid E. O'Brien  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
318269e8c8SDavid E. O'Brien  * SUCH DAMAGE.
328269e8c8SDavid E. O'Brien  */
338269e8c8SDavid E. O'Brien 
348269e8c8SDavid E. O'Brien #include <string.h>
358269e8c8SDavid E. O'Brien 
36*e5551250SKyle Evans #undef stpcpy	/* _FORTIFY_SOURCE */
37*e5551250SKyle Evans 
388269e8c8SDavid E. O'Brien char *
stpcpy(char * __restrict to,const char * __restrict from)399c5cb6d8SDavid Schultz stpcpy(char * __restrict to, const char * __restrict from)
408269e8c8SDavid E. O'Brien {
418269e8c8SDavid E. O'Brien 
428269e8c8SDavid E. O'Brien 	for (; (*to = *from); ++from, ++to);
438269e8c8SDavid E. O'Brien 	return(to);
448269e8c8SDavid E. O'Brien }
45