4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 19:09:58 +08:00
Eric Blake b206478328 Avoid more compiler warnings.
* libc/stdlib/btowc.c: Add missing header.
* libc/stdlib/getopt.c (getopt_internal): Initialize variable.
* libc/stdlib/system.c (do_system) [__CYGWIN__]: Add declaration.
* libc/stdlib/wctob.c: Add missing header.
* libc/string/strcpy.c (strcpy): Avoid warnings.
* libc/string/strrchr.c (strrchr): Likewise.
2007-05-29 21:26:59 +00:00

29 lines
450 B
C

#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <reent.h>
#include <string.h>
wint_t
btowc (int c)
{
mbstate_t mbs;
int retval = 0;
wchar_t pwc;
unsigned char b;
b = (unsigned char)c;
/* Put mbs in initial state. */
memset (&mbs, '\0', sizeof (mbs));
_REENT_CHECK_MISC(_REENT);
retval = _mbtowc_r (_REENT, &pwc, &b, 1, &mbs);
if (c == EOF || retval != 1)
return WEOF;
else
return (wint_t)pwc;
}