4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 11:00:04 +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

26 lines
405 B
C

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