The peek character of an fdport doesn't get reset to #f when
read_fdport_substring() is called. Here's an example.
The first line of the opened file begins "(define".
tabitha% scsh
Scsh 0.4
> (define ip (open-input-file "gscsh.scm"))
> (peek-char ip)
#\(
> (read-string 4 ip)
"(def"
> (peek-char ip)
#\(
> (read-string 4 ip)
"(ine"
>
Here's a patch:
Index: fdports1.c
===================================================================
RCS file: /nfs/sw/scsh/scsh/scsh/fdports1.c,v
retrieving revision 1.8
diff -u -r1.8 fdports1.c
--- 1.8 1996/09/12 01:42:34
+++ fdports1.c 1996/10/16 15:56:55
@@ -395,6 +395,7 @@
if( len > 0 ) {
char *p = StrByte(buf,start);
*p++ = EXTRACT_CHAR(peek);
+ *PortData_Peek(data) = SCHFALSE;
return 1 + fread(p, 1, MIN(len-1, fbufcount(f)), f);
}
else return 0;
|