1*e34cb67cStb /* $OpenBSD: stpcpy.c,v 1.3 2017/11/28 06:55:49 tb Exp $ */
24f2939c2Sguenther
34f2939c2Sguenther /*
44f2939c2Sguenther * Copyright (c) 1988 Regents of the University of California.
54f2939c2Sguenther * All rights reserved.
64f2939c2Sguenther *
74f2939c2Sguenther * Redistribution and use in source and binary forms, with or without
84f2939c2Sguenther * modification, are permitted provided that the following conditions
94f2939c2Sguenther * are met:
104f2939c2Sguenther * 1. Redistributions of source code must retain the above copyright
114f2939c2Sguenther * notice, this list of conditions and the following disclaimer.
124f2939c2Sguenther * 2. Redistributions in binary form must reproduce the above copyright
134f2939c2Sguenther * notice, this list of conditions and the following disclaimer in the
144f2939c2Sguenther * documentation and/or other materials provided with the distribution.
154f2939c2Sguenther * 3. Neither the name of the University nor the names of its contributors
164f2939c2Sguenther * may be used to endorse or promote products derived from this software
174f2939c2Sguenther * without specific prior written permission.
184f2939c2Sguenther *
194f2939c2Sguenther * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
204f2939c2Sguenther * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
214f2939c2Sguenther * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
224f2939c2Sguenther * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
234f2939c2Sguenther * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
244f2939c2Sguenther * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
254f2939c2Sguenther * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
264f2939c2Sguenther * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
274f2939c2Sguenther * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
284f2939c2Sguenther * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
294f2939c2Sguenther * SUCH DAMAGE.
304f2939c2Sguenther */
314f2939c2Sguenther
324f2939c2Sguenther #include <string.h>
334f2939c2Sguenther
344f2939c2Sguenther #if defined(APIWARN)
354f2939c2Sguenther __warn_references(stpcpy,
36*e34cb67cStb "stpcpy() is dangerous; do not use it");
374f2939c2Sguenther #endif
384f2939c2Sguenther
394f2939c2Sguenther char *
stpcpy(char * to,const char * from)404f2939c2Sguenther stpcpy(char *to, const char *from)
414f2939c2Sguenther {
424f2939c2Sguenther for (; (*to = *from) != '\0'; ++from, ++to);
434f2939c2Sguenther return(to);
444f2939c2Sguenther }
45