Blame lib/stpcpy.c

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