reporting djgpp fgets to fgetws, with wine test the old version did fail on reading string, it did to far.

now we do not have a any bug in fgetws, acoding wine test, I ran the test in win2k and reactos to be 100% sure it was not wine test fualt.

svn path=/trunk/; revision=21964
This commit is contained in:
Magnus Olsen 2006-05-21 13:38:45 +00:00
parent 2ef8f0fea0
commit c79c53d3b3

View file

@ -32,23 +32,19 @@
wchar_t* fgetws(wchar_t* s, int n, FILE* f)
{
wchar_t c = 0;
wchar_t* cs;
int c=0;
wchar_t *cs;
cs = s;
//while (--n > 0 && (c = getwc(f)) != WEOF) {
while (n > 0) {
c = getwc(f);
if (c == WEOF)
break;
n--;
while (--n>0 && (c = getwc(f)) != WEOF)
{
*cs++ = c;
if (c == L'\n')
break;
}
if (c == WEOF && cs == s) {
if (c == WEOF && cs == s)
return NULL;
}
*cs++ = L'\0';
return s;
}