Blame gnu/stpcpy.c

Packit 1ef1a9
/* stpcpy.c -- copy a string and return pointer to end of new string
Packit 1ef1a9
   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2015 Free Software
Packit 1ef1a9
   Foundation, Inc.
Packit 1ef1a9
Packit 1ef1a9
   NOTE: The canonical source of this file is maintained with the GNU C Library.
Packit 1ef1a9
   Bugs can be reported to bug-glibc@prep.ai.mit.edu.
Packit 1ef1a9
Packit 1ef1a9
   This program is free software: you can redistribute it and/or modify it
Packit 1ef1a9
   under the terms of the GNU General Public License as published by the
Packit 1ef1a9
   Free Software Foundation; either version 3 of the License, or any
Packit 1ef1a9
   later version.
Packit 1ef1a9
Packit 1ef1a9
   This program is distributed in the hope that it will be useful,
Packit 1ef1a9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1ef1a9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 1ef1a9
   GNU General Public License for more details.
Packit 1ef1a9
Packit 1ef1a9
   You should have received a copy of the GNU General Public License
Packit 1ef1a9
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 1ef1a9
Packit 1ef1a9
#include <config.h>
Packit 1ef1a9
Packit 1ef1a9
#include <string.h>
Packit 1ef1a9
Packit 1ef1a9
#undef __stpcpy
Packit 1ef1a9
#ifdef _LIBC
Packit 1ef1a9
# undef stpcpy
Packit 1ef1a9
#endif
Packit 1ef1a9
Packit 1ef1a9
#ifndef weak_alias
Packit 1ef1a9
# define __stpcpy stpcpy
Packit 1ef1a9
#endif
Packit 1ef1a9
Packit 1ef1a9
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
Packit 1ef1a9
char *
Packit 1ef1a9
__stpcpy (char *dest, const char *src)
Packit 1ef1a9
{
Packit 1ef1a9
  register char *d = dest;
Packit 1ef1a9
  register const char *s = src;
Packit 1ef1a9
Packit 1ef1a9
  do
Packit 1ef1a9
    *d++ = *s;
Packit 1ef1a9
  while (*s++ != '\0');
Packit 1ef1a9
Packit 1ef1a9
  return d - 1;
Packit 1ef1a9
}
Packit 1ef1a9
#ifdef weak_alias
Packit 1ef1a9
weak_alias (__stpcpy, stpcpy)
Packit 1ef1a9
#endif