41 lines
644 B
C
41 lines
644 B
C
|
#include <stdbool.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
char randascii() {
|
||
|
while (true) {
|
||
|
char r = rand() & 0x7f;
|
||
|
if (r >= 0x20 && r <= 0x7e) {
|
||
|
return r;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv) {
|
||
|
char last = 0x1f;
|
||
|
int skips = 0;
|
||
|
int line_len = 0;
|
||
|
|
||
|
while (true) {
|
||
|
char c = randascii();
|
||
|
putchar(c);
|
||
|
if (c == last + 1 && skips++ == 10) {
|
||
|
last = c;
|
||
|
if (line_len++ == 15) {
|
||
|
putchar('\n');
|
||
|
line_len = 0;
|
||
|
}
|
||
|
if (c == 0x7e) {
|
||
|
break;
|
||
|
}
|
||
|
skips = 0;
|
||
|
} else {
|
||
|
putchar('\b');
|
||
|
}
|
||
|
usleep(200);
|
||
|
}
|
||
|
|
||
|
putchar('\n');
|
||
|
}
|