add crappy filter. better than nothing.
authorDarron Broad <darron@kewl.org>
Wed, 04 Feb 2015 18:36:58 +0000
changeset 14 43838b52d123
parent 13 27e8f05e8ffc
child 15 7373981af485
add crappy filter. better than nothing.
espy.c
--- a/espy.c	Wed Feb 04 12:35:49 2015 +0000
+++ b/espy.c	Wed Feb 04 18:36:58 2015 +0000
@@ -71,7 +71,7 @@
 /*
  * LUA interpreter delay
  */
-#define SHORTDELAY (200)
+#define SHORTDELAY (150)
 #define LONGDELAY (2000)
 
 /*******************************************************************************
@@ -515,22 +515,27 @@
 	int rc = readchar(fd, &buffer[ix], BUFLEN - ix, TIMEOUT);
 	if (rc <= 0)
 		return 0;
-
 	ix += rc;
 
 	char *cp;
         while ((cp = strnchr(buffer, '\n', ix)) != NULL) {
-
 	        int i = cp - buffer;
-	        assert(i < BUFLEN);
 
 	        buffer[i++] = '\0';
 	        ix -= i;
-	        assert(ix >= 0 && ix < BUFLEN);
 #if 0
 		dump_hex(buffer, i);
 #endif
-	        fprintf(stderr, "%s\n", buffer);
+		/*
+		 * Prompt filter
+		 *
+		 * This is problematic of course, but what else can be done?
+		 */
+		int j = 0;
+		while (buffer[j] == 0x3E || buffer[j] == 0x20)
+			j++;
+		if (buffer[j] != '\r')
+		        fprintf(stderr, "%s\n", &buffer[j]);
 
 	        memmove(buffer, &buffer[i], ix);
 	}