1998-03-31 20:09:55 +08:00
|
|
|
/* stpcpy.c -- copy a string and return pointer to end of new string
|
2000-08-07 23:48:18 +08:00
|
|
|
Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
|
1992-11-01 04:42:48 +08:00
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
|
|
|
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
1992-11-01 04:42:48 +08:00
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
1992-11-01 04:42:48 +08:00
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1992-11-01 04:42:48 +08:00
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-14 15:58:06 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
1997-11-13 22:16:21 +08:00
|
|
|
USA. */
|
1997-09-02 10:15:10 +08:00
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
1997-09-14 11:12:35 +08:00
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
1997-09-02 10:15:10 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
1997-11-13 22:16:21 +08:00
|
|
|
#undef __stpcpy
|
|
|
|
#undef stpcpy
|
|
|
|
|
1997-09-02 10:15:10 +08:00
|
|
|
#ifndef weak_alias
|
|
|
|
# define __stpcpy stpcpy
|
1994-10-17 21:24:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
|
1992-11-01 04:42:48 +08:00
|
|
|
char *
|
1998-12-07 11:12:10 +08:00
|
|
|
__stpcpy (char *dest, const char *src)
|
1992-11-01 04:42:48 +08:00
|
|
|
{
|
1997-09-02 10:15:10 +08:00
|
|
|
register char *d = dest;
|
|
|
|
register const char *s = src;
|
|
|
|
|
|
|
|
do
|
|
|
|
*d++ = *s;
|
|
|
|
while (*s++ != '\0');
|
|
|
|
|
|
|
|
return d - 1;
|
1992-11-01 04:42:48 +08:00
|
|
|
}
|
1997-09-02 10:15:10 +08:00
|
|
|
#ifdef weak_alias
|
|
|
|
weak_alias (__stpcpy, stpcpy)
|
|
|
|
#endif
|