strncat.c 694 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include "_string.h"
  8. #ifdef WANT_WIDE
  9. # define __Wstrncat __wcsncat
  10. # define Wstrncat wcsncat
  11. #else
  12. # define __Wstrncat __strncat
  13. # define Wstrncat strncat
  14. #endif
  15. Wchar attribute_hidden *__Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
  16. size_t n)
  17. {
  18. register Wchar *s = s1;
  19. while (*s++);
  20. --s;
  21. #if __BCC__
  22. while (n-- && ((*s = *s2++) != 0)) ++s;
  23. #else
  24. while (n && ((*s = *s2++) != 0)) {
  25. --n;
  26. ++s;
  27. }
  28. #endif
  29. *s = 0;
  30. return s1;
  31. }
  32. strong_alias(__Wstrncat,Wstrncat)