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