1*84d9c625SLionel Sambuc /* $NetBSD: stpcpy.c,v 1.2 2013/11/06 21:05:27 tron Exp $ */
22fe8fb19SBen Gras
32fe8fb19SBen Gras /*
42fe8fb19SBen Gras * Copyright (c) 1999
52fe8fb19SBen Gras * David E. O'Brien
62fe8fb19SBen Gras * Copyright (c) 1988, 1993
72fe8fb19SBen Gras * The Regents of the University of California. All rights reserved.
82fe8fb19SBen Gras *
92fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without
102fe8fb19SBen Gras * modification, are permitted provided that the following conditions
112fe8fb19SBen Gras * are met:
122fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright
132fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer.
142fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright
152fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the
162fe8fb19SBen Gras * documentation and/or other materials provided with the distribution.
172fe8fb19SBen Gras * 3. Neither the name of the University nor the names of its contributors
182fe8fb19SBen Gras * may be used to endorse or promote products derived from this software
192fe8fb19SBen Gras * without specific prior written permission.
202fe8fb19SBen Gras *
212fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
222fe8fb19SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
232fe8fb19SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
242fe8fb19SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
252fe8fb19SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
262fe8fb19SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
272fe8fb19SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
282fe8fb19SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
292fe8fb19SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
302fe8fb19SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
312fe8fb19SBen Gras * SUCH DAMAGE.
322fe8fb19SBen Gras */
332fe8fb19SBen Gras
342fe8fb19SBen Gras #include <sys/cdefs.h>
352fe8fb19SBen Gras #if defined(LIBC_SCCS) && !defined(lint)
362fe8fb19SBen Gras #if 0
372fe8fb19SBen Gras static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
382fe8fb19SBen Gras #else
39*84d9c625SLionel Sambuc __RCSID("$NetBSD: stpcpy.c,v 1.2 2013/11/06 21:05:27 tron Exp $");
402fe8fb19SBen Gras #endif
412fe8fb19SBen Gras #endif /* LIBC_SCCS and not lint */
422fe8fb19SBen Gras /* FreeBSD: src/lib/libc/string/stpcpy.c,v 1.2 2009/02/28 06:05:37 das Exp */
432fe8fb19SBen Gras
442fe8fb19SBen Gras #include <string.h>
452fe8fb19SBen Gras
46*84d9c625SLionel Sambuc #ifdef _FORTIFY_SOURCE
47*84d9c625SLionel Sambuc #undef stpcpy
48*84d9c625SLionel Sambuc #endif
49*84d9c625SLionel Sambuc
502fe8fb19SBen Gras char *
stpcpy(char * __restrict to,const char * __restrict from)512fe8fb19SBen Gras stpcpy(char * __restrict to, const char * __restrict from)
522fe8fb19SBen Gras {
532fe8fb19SBen Gras
542fe8fb19SBen Gras for (; (*to = *from); ++from, ++to);
552fe8fb19SBen Gras return(to);
562fe8fb19SBen Gras }
57