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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [btowc.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 <wchar.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <reent.h>
5
#include <string.h>
6
 
7
wint_t
8
btowc (int c)
9
{
10
  mbstate_t mbs;
11
  int retval = 0;
12
  wchar_t pwc;
13
  unsigned char b;
14
 
15
  b = (unsigned char)c;
16
 
17
  /* Put mbs in initial state. */
18
  memset (&mbs, '\0', sizeof (mbs));
19
 
20
  _REENT_CHECK_MISC(_REENT);
21
 
22
  retval = _mbtowc_r (_REENT, &pwc, &b, 1, &mbs);
23
 
24
  if (c == EOF || retval != 1)
25
    return WEOF;
26
  else
27
    return (wint_t)pwc;
28
}

powered by: WebSVN 2.1.0

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