mbstowcs.c 386 B

1234567891011121314151617181920
  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. size_t
  8. mbstowcs(register wchar_t *pwcs, register const char *s, size_t n)
  9. {
  10. register int i = n;
  11. while (--i >= 0) {
  12. if (!(*pwcs++ = *s++))
  13. return n - i - 1;
  14. }
  15. return n - i;
  16. }