OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [mbrtowc.c] - Blame information for rev 158

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
#include <reent.h>
2
#include <newlib.h>
3
#include <wchar.h>
4
#include <stdlib.h>
5
#include <stdio.h>
6
#include <errno.h>
7
#include <string.h>
8
 
9
size_t
10
_DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps),
11
        struct _reent *ptr _AND
12
        wchar_t *pwc _AND
13
        const char *s _AND
14
        size_t n _AND
15
        mbstate_t *ps)
16
{
17
  int retval = 0;
18
 
19
#ifdef _MB_CAPABLE
20
  if (ps == NULL)
21
    {
22
      _REENT_CHECK_MISC(ptr);
23
      ps = &(_REENT_MBRTOWC_STATE(ptr));
24
    }
25
#endif
26
 
27
  if (s == NULL)
28
    retval = _mbtowc_r (ptr, NULL, "", 1, ps);
29
  else
30
    retval = _mbtowc_r (ptr, pwc, s, n, ps);
31
 
32
  if (retval == -1)
33
    {
34
      ps->__count = 0;
35
      ptr->_errno = EILSEQ;
36
      return (size_t)(-1);
37
    }
38
  else
39
    return (size_t)retval;
40
}
41
 
42
#ifndef _REENT_ONLY
43
size_t
44
_DEFUN (mbrtowc, (pwc, s, n, ps),
45
        wchar_t *pwc _AND
46
        const char *s _AND
47
        size_t n _AND
48
        mbstate_t *ps)
49
{
50
  return _mbrtowc_r (_REENT, pwc, s, n, ps);
51
}
52
#endif /* !_REENT_ONLY */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.