mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
* ports.c (scm_add_to_port_table, scm_remove_from_port_table):
Handle new fields. (scm_generic_fgets), fports.c (local_fgets): Use a loop to read unread characters. Use SCM_TRY_CLRDY instead of SCM_CLRDY.
This commit is contained in:
parent
b8af68db88
commit
64e764482e
1 changed files with 13 additions and 3 deletions
|
@ -397,10 +397,12 @@ static int
|
|||
local_fgetc (SCM port)
|
||||
{
|
||||
FILE *s = (FILE *) SCM_STREAM (port);
|
||||
#if 0
|
||||
pre_read (port);
|
||||
if (feof (s))
|
||||
return EOF;
|
||||
else
|
||||
#endif
|
||||
return fgetc (s);
|
||||
}
|
||||
|
||||
|
@ -414,7 +416,9 @@ local_fgets (SCM port, int *len)
|
|||
char *p; /* pointer to current buffer position */
|
||||
int limit = 80; /* current size of buffer */
|
||||
|
||||
#if 0
|
||||
pre_read (port);
|
||||
#endif
|
||||
|
||||
/* If this is a socket port or something where we can't rely on
|
||||
ftell to determine how much we've read, then call the generic
|
||||
|
@ -435,11 +439,11 @@ local_fgets (SCM port, int *len)
|
|||
|
||||
/* If a char has been pushed onto the port with scm_ungetc,
|
||||
read that first. */
|
||||
if (SCM_CRDYP (port))
|
||||
while (SCM_CRDYP (port))
|
||||
{
|
||||
buf[*len] = SCM_CGETUN (port);
|
||||
SCM_CLRDY (port);
|
||||
if (buf[(*len)++] == '\n')
|
||||
SCM_TRY_CLRDY (port);
|
||||
if (buf[(*len)++] == '\n' || *len == limit - 1)
|
||||
{
|
||||
buf[*len] = '\0';
|
||||
return buf;
|
||||
|
@ -519,7 +523,9 @@ local_fputc (int c, SCM port)
|
|||
{
|
||||
FILE *fp = (FILE *) SCM_STREAM (port);
|
||||
|
||||
#if 0
|
||||
pre_write (port);
|
||||
#endif
|
||||
return fputc (c, fp);
|
||||
}
|
||||
|
||||
|
@ -527,7 +533,9 @@ static int
|
|||
local_fputs (char *s, SCM port)
|
||||
{
|
||||
FILE *fp = (FILE *) SCM_STREAM (port);
|
||||
#if 0
|
||||
pre_write (port);
|
||||
#endif
|
||||
return fputs (s, fp);
|
||||
}
|
||||
|
||||
|
@ -538,7 +546,9 @@ local_ffwrite (char *ptr,
|
|||
SCM port)
|
||||
{
|
||||
FILE *fp = (FILE *) SCM_STREAM (port);
|
||||
#if 0
|
||||
pre_write (port);
|
||||
#endif
|
||||
return ffwrite (ptr, size, nitems, fp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue