wcstombs.c 414 B

123456789101112131415161718192021
  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. /* $Id$ */
  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 = n;
  13. while (--i >= 0) {
  14. if (!(*s++ = *pwcs++))
  15. break;
  16. }
  17. return n - i - 1;
  18. }