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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [wcrtomb.c] - Blame information for rev 182

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
 
8
size_t
9
_DEFUN (_wcrtomb_r, (ptr, s, wc, ps),
10
        struct _reent *ptr _AND
11
        char *s _AND
12
        wchar_t wc _AND
13
        mbstate_t *ps)
14
{
15
  int retval = 0;
16
  char buf[10];
17
 
18
#ifdef _MB_CAPABLE
19
  if (ps == NULL)
20
    {
21
      _REENT_CHECK_MISC(ptr);
22
      ps = &(_REENT_WCRTOMB_STATE(ptr));
23
    }
24
#endif
25
 
26
  if (s == NULL)
27
    retval = _wctomb_r (ptr, buf, L'\0', ps);
28
  else
29
    retval = _wctomb_r (ptr, s, wc, ps);
30
 
31
  if (retval == -1)
32
    {
33
      ps->__count = 0;
34
      ptr->_errno = EILSEQ;
35
      return (size_t)(-1);
36
    }
37
  else
38
    return (size_t)retval;
39
}
40
 
41
#ifndef _REENT_ONLY
42
size_t
43
_DEFUN (wcrtomb, (s, wc, ps),
44
        char *s _AND
45
        wchar_t wc _AND
46
        mbstate_t *ps)
47
{
48
  return _wcrtomb_r (_REENT, s, wc, ps);
49
}
50
#endif /* !_REENT_ONLY */

powered by: WebSVN 2.1.0

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