diff --git a/sys/teken/teken_stress.c b/sys/teken/teken_stress.c index 40d09bf903b0..1f1c57253f09 100644 --- a/sys/teken/teken_stress.c +++ b/sys/teken/teken_stress.c @@ -92,13 +92,16 @@ stress_respond(void *s __unused, const void *buf __unused, size_t len __unused) { } +static const char replacement[] = + { 0x1b, '[', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';' }; + int main(int argc __unused, char *argv[] __unused) { teken_t t; int rnd; - unsigned int iteration = 0; - char buf[2048]; + unsigned int i, iteration = 0; + unsigned char buf[2048]; rnd = open("/dev/urandom", O_RDONLY); if (rnd < 0) { @@ -114,6 +117,12 @@ main(int argc __unused, char *argv[] __unused) exit(1); } + for (i = 0; i < sizeof buf; i++) { + if (buf[i] >= 0x80) + buf[i] = + replacement[buf[i] % sizeof replacement]; + } + teken_input(&t, buf, sizeof buf); iteration++;