strncpy.c 408 B

12345678910111213141516171819202122
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /* Copy t into s, upto n characters
  7. */
  8. #include "ack_string.h"
  9. char *
  10. strncpy(s, t, n)
  11. register char *s;
  12. register _CONST char *t;
  13. register _SIZET n;
  14. {
  15. register char *b = s;
  16. while ((n-- > 0) && (*s++ = *t++))
  17. ;
  18. return b;
  19. }