forked from KolibriOS/kolibrios
libc testsuite + fixes
git-svn-id: svn://kolibrios.org@6433 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -4,13 +4,24 @@ int ungetc(int c,FILE* file)
|
||||
{
|
||||
dword res;
|
||||
|
||||
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
|
||||
if(!file)
|
||||
{
|
||||
errno = E_INVALIDPTR;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0))
|
||||
{
|
||||
errno = E_ACCESS;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (file->filepos>file->filesize || file->filepos==0)
|
||||
{
|
||||
errno = E_EOF;
|
||||
return EOF;
|
||||
}
|
||||
file->filepos--;
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user