Author: pmichaud
Date: Tue Dec 9 13:47:06 2008
New Revision: 33727
Modified:
trunk/src/pmc/filehandle.pmc
Log:
[io]: Make readline_interactive more consistent when readline lib isn't present.
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc (original)
+++ trunk/src/pmc/filehandle.pmc Tue Dec 9 13:47:06 2008
@@ -299,14 +299,33 @@
mem_sys_free(r);
RETURN(STRING *string_result);
}
-#endif
+
+ RETURN(PMC *PMCNULL);
+#else
+ UINTVAL len;
+
+ if (got_prompt)
+ fprintf(stderr, "%s", prompt->strstart);
if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))
Parrot_io_setlinebuf(INTERP, SELF);
string_result = Parrot_io_reads(INTERP, SELF, 0);
+ if (!string_result)
+ RETURN(PMC *PMCNULL);
+ len = string_length(INTERP, string_result);
+ if (len < 1)
+ RETURN(PMC *PMCNULL);
+ while (len > 0 &&
+ (((char*)string_result->strstart)[len - 1] == '\n' ||
+ ((char*)string_result->strstart)[len - 1] == '\r')) {
+ --len;
+ --string_result->strlen;
+ --string_result->bufused;
+ }
RETURN(STRING *string_result);
+#endif
}
/*