patch for `interact'

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 18 Dec 2001 10:56:36 +0000


There is a bug in Dec2001 Hugs (and earlier releases too) which causes
the Prelude function `interact' to behave unexpectedly - the user's
input is not echoed to the screen as she types it.  A patch is attached
which solves the problem.

Regards,
    Malcolm

--- src/iomonad.c	Tue Dec 11 00:54:51 2001
+++ src/iomonad.c.patched	Tue Dec 18 10:53:47 2001
@@ -844,6 +844,7 @@
     HandleArg(h,1);
     if (handles[h].hmode&HSEMICLOSED) {	/* read requires semi-closed handle*/
 	Int c = (h==HSTDIN ? readTerminalChar() : getc(handles[h].hfp));
+	if (h==HSTDIN) putchar(c);
 	if (c!=EOF && c>=0 && c<NUM_CHARS) {
 	    updapRoot(consChar(c),ap(nameHreader,primArg(1)));
 	    return;