wcstombs.c 428 B

1234567891011121314151617181920212223
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Header$ */
  6. #include <stdlib.h>
  7. #include <locale.h>
  8. #include <limits.h>
  9. size_t
  10. wcstombs(register char *s, register const wchar_t *pwcs, size_t n)
  11. {
  12. register int i = 0;
  13. while (i < n) {
  14. i++;
  15. *s++ = *pwcs++;
  16. if (*s == '\0')
  17. return i;
  18. }
  19. return n;
  20. }