xref: /freebsd/lib/libc/string/stpcpy.c (revision 9c5cb6d8ae38a9fd39e344721a729d05cf121ce3)
18269e8c8SDavid E. O'Brien /*
28269e8c8SDavid E. O'Brien  * Copyright (c) 1999
38269e8c8SDavid E. O'Brien  *	David E. O'Brien
48269e8c8SDavid E. O'Brien  * Copyright (c) 1988, 1993
58269e8c8SDavid E. O'Brien  *	The Regents of the University of California.  All rights reserved.
68269e8c8SDavid E. O'Brien  *
78269e8c8SDavid E. O'Brien  * Redistribution and use in source and binary forms, with or without
88269e8c8SDavid E. O'Brien  * modification, are permitted provided that the following conditions
98269e8c8SDavid E. O'Brien  * are met:
108269e8c8SDavid E. O'Brien  * 1. Redistributions of source code must retain the above copyright
118269e8c8SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer.
128269e8c8SDavid E. O'Brien  * 2. Redistributions in binary form must reproduce the above copyright
138269e8c8SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer in the
148269e8c8SDavid E. O'Brien  *    documentation and/or other materials provided with the distribution.
158269e8c8SDavid E. O'Brien  * 3. Neither the name of the University nor the names of its contributors
168269e8c8SDavid E. O'Brien  *    may be used to endorse or promote products derived from this software
178269e8c8SDavid E. O'Brien  *    without specific prior written permission.
188269e8c8SDavid E. O'Brien  *
198269e8c8SDavid E. O'Brien  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
208269e8c8SDavid E. O'Brien  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
218269e8c8SDavid E. O'Brien  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
228269e8c8SDavid E. O'Brien  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
238269e8c8SDavid E. O'Brien  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
248269e8c8SDavid E. O'Brien  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
258269e8c8SDavid E. O'Brien  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
268269e8c8SDavid E. O'Brien  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
278269e8c8SDavid E. O'Brien  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
288269e8c8SDavid E. O'Brien  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
298269e8c8SDavid E. O'Brien  * SUCH DAMAGE.
308269e8c8SDavid E. O'Brien  */
318269e8c8SDavid E. O'Brien 
328269e8c8SDavid E. O'Brien #if defined(LIBC_SCCS) && !defined(lint)
338269e8c8SDavid E. O'Brien static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
348269e8c8SDavid E. O'Brien #endif /* LIBC_SCCS and not lint */
358269e8c8SDavid E. O'Brien #include <sys/cdefs.h>
368269e8c8SDavid E. O'Brien __FBSDID("$FreeBSD$");
378269e8c8SDavid E. O'Brien 
388269e8c8SDavid E. O'Brien #include <string.h>
398269e8c8SDavid E. O'Brien 
408269e8c8SDavid E. O'Brien char *
419c5cb6d8SDavid Schultz stpcpy(char * __restrict to, const char * __restrict from)
428269e8c8SDavid E. O'Brien {
438269e8c8SDavid E. O'Brien 
448269e8c8SDavid E. O'Brien 	for (; (*to = *from); ++from, ++to);
458269e8c8SDavid E. O'Brien 	return(to);
468269e8c8SDavid E. O'Brien }
47