xref: /netbsd-src/lib/libc/string/stpcpy.c (revision 27c36eab533a1907f9a96000e263c2399324ce78)
1*27c36eabStron /*	$NetBSD: stpcpy.c,v 1.2 2013/11/06 21:05:27 tron Exp $	*/
2be118519Sperry 
3be118519Sperry /*
4be118519Sperry  * Copyright (c) 1999
5be118519Sperry  *	David E. O'Brien
6be118519Sperry  * Copyright (c) 1988, 1993
7be118519Sperry  *	The Regents of the University of California.  All rights reserved.
8be118519Sperry  *
9be118519Sperry  * Redistribution and use in source and binary forms, with or without
10be118519Sperry  * modification, are permitted provided that the following conditions
11be118519Sperry  * are met:
12be118519Sperry  * 1. Redistributions of source code must retain the above copyright
13be118519Sperry  *    notice, this list of conditions and the following disclaimer.
14be118519Sperry  * 2. Redistributions in binary form must reproduce the above copyright
15be118519Sperry  *    notice, this list of conditions and the following disclaimer in the
16be118519Sperry  *    documentation and/or other materials provided with the distribution.
17be118519Sperry  * 3. Neither the name of the University nor the names of its contributors
18be118519Sperry  *    may be used to endorse or promote products derived from this software
19be118519Sperry  *    without specific prior written permission.
20be118519Sperry  *
21be118519Sperry  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22be118519Sperry  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23be118519Sperry  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24be118519Sperry  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25be118519Sperry  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26be118519Sperry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27be118519Sperry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28be118519Sperry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29be118519Sperry  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30be118519Sperry  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31be118519Sperry  * SUCH DAMAGE.
32be118519Sperry  */
33be118519Sperry 
34be118519Sperry #include <sys/cdefs.h>
35be118519Sperry #if defined(LIBC_SCCS) && !defined(lint)
36be118519Sperry #if 0
37be118519Sperry static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
38be118519Sperry #else
39*27c36eabStron __RCSID("$NetBSD: stpcpy.c,v 1.2 2013/11/06 21:05:27 tron Exp $");
40be118519Sperry #endif
41be118519Sperry #endif /* LIBC_SCCS and not lint */
42be118519Sperry /* FreeBSD: src/lib/libc/string/stpcpy.c,v 1.2 2009/02/28 06:05:37 das Exp */
43be118519Sperry 
44be118519Sperry #include <string.h>
45be118519Sperry 
46*27c36eabStron #ifdef _FORTIFY_SOURCE
47*27c36eabStron #undef stpcpy
48*27c36eabStron #endif
49*27c36eabStron 
50be118519Sperry char *
stpcpy(char * __restrict to,const char * __restrict from)51be118519Sperry stpcpy(char * __restrict to, const char * __restrict from)
52be118519Sperry {
53be118519Sperry 
54be118519Sperry 	for (; (*to = *from); ++from, ++to);
55be118519Sperry 	return(to);
56be118519Sperry }
57