mbstowcs.c 429 B

123456789101112131415161718192021222324
  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. mbstowcs(register wchar_t *pwcs, register const char *s, size_t n)
  11. {
  12. register int i = 0;
  13. while (i < n) {
  14. i++;
  15. *pwcs++ = *s++;
  16. if (*s == '\0')
  17. return i;
  18. }
  19. return n;
  20. }