1169695Skan/* Implement the stpcpy function.
2169695Skan   Copyright (C) 2003 Free Software Foundation, Inc.
3169695Skan   Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
4169695Skan
5169695SkanThis file is part of the libiberty library.
6169695SkanLibiberty is free software; you can redistribute it and/or
7169695Skanmodify it under the terms of the GNU Library General Public
8169695SkanLicense as published by the Free Software Foundation; either
9169695Skanversion 2 of the License, or (at your option) any later version.
10169695Skan
11169695SkanLibiberty is distributed in the hope that it will be useful,
12169695Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of
13169695SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14169695SkanLibrary General Public License for more details.
15169695Skan
16169695SkanYou should have received a copy of the GNU Library General Public
17169695SkanLicense along with libiberty; see the file COPYING.LIB.  If
18169695Skannot, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19169695SkanBoston, MA 02110-1301, USA.  */
20169695Skan
21169695Skan/*
22169695Skan
23169695Skan@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src})
24169695Skan
25169695SkanCopies the string @var{src} into @var{dst}.  Returns a pointer to
26169695Skan@var{dst} + strlen(@var{src}).
27169695Skan
28169695Skan@end deftypefn
29169695Skan
30169695Skan*/
31169695Skan
32169695Skan#include <ansidecl.h>
33169695Skan#include <stddef.h>
34169695Skan
35169695Skanextern size_t strlen (const char *);
36169695Skanextern PTR memcpy (PTR, const PTR, size_t);
37169695Skan
38169695Skanchar *
39169695Skanstpcpy (char *dst, const char *src)
40169695Skan{
41169695Skan  const size_t len = strlen (src);
42169695Skan  return (char *) memcpy (dst, src, len + 1) + len;
43169695Skan}
44