12a6b7db3Sskrll /* Implement the stpcpy function.
2*f22f0ef4Schristos    Copyright (C) 2003-2022 Free Software Foundation, Inc.
32a6b7db3Sskrll    Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
42a6b7db3Sskrll 
52a6b7db3Sskrll This file is part of the libiberty library.
62a6b7db3Sskrll Libiberty is free software; you can redistribute it and/or
72a6b7db3Sskrll modify it under the terms of the GNU Library General Public
82a6b7db3Sskrll License as published by the Free Software Foundation; either
92a6b7db3Sskrll version 2 of the License, or (at your option) any later version.
102a6b7db3Sskrll 
112a6b7db3Sskrll Libiberty is distributed in the hope that it will be useful,
122a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of
132a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
142a6b7db3Sskrll Library General Public License for more details.
152a6b7db3Sskrll 
162a6b7db3Sskrll You should have received a copy of the GNU Library General Public
172a6b7db3Sskrll License along with libiberty; see the file COPYING.LIB.  If
182a6b7db3Sskrll not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
192a6b7db3Sskrll Boston, MA 02110-1301, USA.  */
202a6b7db3Sskrll 
212a6b7db3Sskrll /*
222a6b7db3Sskrll 
232a6b7db3Sskrll @deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src})
242a6b7db3Sskrll 
252a6b7db3Sskrll Copies the string @var{src} into @var{dst}.  Returns a pointer to
262a6b7db3Sskrll @var{dst} + strlen(@var{src}).
272a6b7db3Sskrll 
282a6b7db3Sskrll @end deftypefn
292a6b7db3Sskrll 
302a6b7db3Sskrll */
312a6b7db3Sskrll 
322a6b7db3Sskrll #include <ansidecl.h>
332a6b7db3Sskrll #include <stddef.h>
342a6b7db3Sskrll 
352a6b7db3Sskrll extern size_t strlen (const char *);
36*f22f0ef4Schristos extern void *memcpy (void *, const void *, size_t);
372a6b7db3Sskrll 
382a6b7db3Sskrll char *
stpcpy(char * dst,const char * src)392a6b7db3Sskrll stpcpy (char *dst, const char *src)
402a6b7db3Sskrll {
412a6b7db3Sskrll   const size_t len = strlen (src);
422a6b7db3Sskrll   return (char *) memcpy (dst, src, len + 1) + len;
432a6b7db3Sskrll }
44