mbtowc.c 414 B

123456789101112131415161718
  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 <limits.h>
  8. int
  9. mbtowc(wchar_t *pwc, register const char *s, size_t n)
  10. {
  11. if (s == (const char *)NULL) return 0;
  12. if (*s == '\0') return 0;
  13. if (n <= 0) return 0;
  14. if (pwc) *pwc = *s;
  15. return (*s != 0);
  16. }