#include #include #include static void restore(int sig) { char buf[] = "\e]R"; write(0, buf, sizeof(buf)); exit(EXIT_SUCCESS); } #define to_hex(v) ((v) > 9 ? (v) + 'a' - 10 : (v) + '0') int main(int argc, char** argv) { char buf[] = "\e]P0000000"; int i; signal(SIGINT, restore); while (1) { for (i = 0; i < 512; i += 16) { if (i < 256) { buf[6] = buf[8] = to_hex(i / 16); buf[7] = buf[9] = to_hex(i % 16); } else { buf[6] = buf[8] = to_hex((511 - i) / 16); buf[7] = buf[9] = to_hex((511 - i) % 16); } write(0, buf, sizeof(buf)); } } return EXIT_SUCCESS; } /* vim: set ts=4 sts=4 sw=4 et: */