~foura/wired

f5bdf0d83ce15094842bcb851488c5af35e51868 — james palmer 11 months ago 14f9b60
strip eot before newlines.

this prevents the message:

test
<EOT>

from sending multiple newlines
1 files changed, 8 insertions(+), 9 deletions(-)

M main.c
M main.c => main.c +8 -9
@@ 99,15 99,6 @@ filter(char *s)
	int len;
	int i, j;

	len = strlen(s);
	
	/* strip trailing nl */
	for(i = len-1; i > 0; i--)
		if(s[i] == '\n')
			s[i] = 0;
		else
			break;

	/* strip eot */
	j = 0; len = strlen(s);
	for(i = 0; i < len; i++) {


@@ 117,6 108,14 @@ filter(char *s)
		}
	}
	s[j] = 0;
	
	/* strip trailing nl */
	len = strlen(s);
	for(i = len-1; i > 0; i--)
		if(s[i] == '\n')
			s[i] = 0;
		else
			break;
}

void