1caaf71ebb358f811fe7602bbadb90b897e93eaf7Elliott Hughes/*	$OpenBSD: stpcpy.c,v 1.2 2014/07/09 17:08:21 naddy Exp $	*/
2950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris
3950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris/*
4950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * Copyright (c) 1988 Regents of the University of California.
5950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * All rights reserved.
6950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *
7950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * Redistribution and use in source and binary forms, with or without
8950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * modification, are permitted provided that the following conditions
9950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * are met:
10950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * 1. Redistributions of source code must retain the above copyright
11950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *    notice, this list of conditions and the following disclaimer.
12950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * 2. Redistributions in binary form must reproduce the above copyright
13950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *    notice, this list of conditions and the following disclaimer in the
14950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *    documentation and/or other materials provided with the distribution.
15950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * 3. Neither the name of the University nor the names of its contributors
16950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *    may be used to endorse or promote products derived from this software
17950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *    without specific prior written permission.
18950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris *
19950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris * SUCH DAMAGE.
30950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris */
31950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris
32950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris#include <string.h>
33950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris
34950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris#if defined(APIWARN)
35950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris__warn_references(stpcpy,
36caaf71ebb358f811fe7602bbadb90b897e93eaf7Elliott Hughes    "warning: stpcpy() is dangerous; do not use it");
37950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris#endif
38950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris
39950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferrischar *
40950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferrisstpcpy(char *to, const char *from)
41950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris{
42950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris	for (; (*to = *from) != '\0'; ++from, ++to);
43950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris	return(to);
44950a58e24d1019eb9d814dbb16f111a6b61e3f23Christopher Ferris}
45