1 /* $NetBSD: stpcpy.c,v 1.1.1.1 2016/01/10 21:36:19 christos Exp $ */
2
3 /* stpcpy.c -- copy a string and return pointer to end of new string
4 Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
5
6 NOTE: The canonical source of this file is maintained with the GNU C Library.
7 Bugs can be reported to bug-glibc@prep.ai.mit.edu.
8
9 This program is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 2, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 USA. */
23
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27
28 #include <string.h>
29
30 #undef __stpcpy
31 #undef stpcpy
32
33 #ifndef weak_alias
34 # define __stpcpy stpcpy
35 #endif
36
37 /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
38 char *
__stpcpy(char * dest,const char * src)39 __stpcpy (char *dest, const char *src)
40 {
41 register char *d = dest;
42 register const char *s = src;
43
44 do
45 *d++ = *s;
46 while (*s++ != '\0');
47
48 return d - 1;
49 }
50 #ifdef weak_alias
51 weak_alias (__stpcpy, stpcpy)
52 #endif
53