make SWIgetc check for EOF and \n
This commit is contained in:
parent
cede94f6d2
commit
ae89fa5728
20
C/iopreds.c
20
C/iopreds.c
@ -827,12 +827,16 @@ IOSWIPutc(int sno, int ch)
|
|||||||
static int
|
static int
|
||||||
IOSWIGetc(int sno)
|
IOSWIGetc(int sno)
|
||||||
{
|
{
|
||||||
int i;
|
int ch;
|
||||||
Yap_StartSlots();
|
Yap_StartSlots();
|
||||||
i = (SWIGetc)(Stream[sno].u.swi_stream.swi_ptr);
|
ch = (SWIGetc)(Stream[sno].u.swi_stream.swi_ptr);
|
||||||
|
if (ch == EOF) {
|
||||||
|
return post_process_eof(Stream+sno);
|
||||||
|
}
|
||||||
|
return post_process_read_char(ch, Stream+sno);
|
||||||
Yap_CloseSlots();
|
Yap_CloseSlots();
|
||||||
YENV = ENV;
|
YENV = ENV;
|
||||||
return i;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@ -851,12 +855,16 @@ IOSWIWidePutc(int sno, int ch)
|
|||||||
static int
|
static int
|
||||||
IOSWIWideGetc(int sno)
|
IOSWIWideGetc(int sno)
|
||||||
{
|
{
|
||||||
int i;
|
int ch;
|
||||||
Yap_StartSlots();
|
Yap_StartSlots();
|
||||||
i = (SWIWideGetc)(Stream[sno].u.swi_stream.swi_ptr);
|
ch = (SWIWideGetc)(Stream[sno].u.swi_stream.swi_ptr);
|
||||||
|
if (ch == EOF) {
|
||||||
|
return post_process_eof(Stream+sno);
|
||||||
|
}
|
||||||
|
return post_process_read_char(ch, Stream+sno);
|
||||||
Yap_CloseSlots();
|
Yap_CloseSlots();
|
||||||
YENV = ENV;
|
YENV = ENV;
|
||||||
return i;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_SOCKET
|
#if USE_SOCKET
|
||||||
|
Reference in New Issue
Block a user