wok annotate busybox/stuff/busybox-1.27-scriptreplay.u @ rev 21205
Add lbzip2 (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Apr 07 20:34:36 2019 +0200 (2019-04-07) |
parents | |
children |
rev | line source |
---|---|
pascal@19991 | 1 --- busybox-1.26/util-linux/scriptreplay.c |
pascal@19991 | 2 +++ busybox-1.26/util-linux/scriptreplay.c |
pascal@19991 | 3 @@ -18,10 +18,20 @@ |
pascal@19991 | 4 |
pascal@19991 | 5 //kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o |
pascal@19991 | 6 |
pascal@19991 | 7 +//config:config SCRIPTREPLAY_HOTKEYS |
pascal@19991 | 8 +//config: bool "speed control hotkeys" |
pascal@19991 | 9 +//config: default n |
pascal@19991 | 10 +//config: depends on SCRIPTREPLAY |
pascal@19991 | 11 +//config: help |
pascal@19991 | 12 +//config: Tune replay speed with + - = space return hotkeys. |
pascal@19991 | 13 + |
pascal@19991 | 14 //usage:#define scriptreplay_trivial_usage |
pascal@19991 | 15 //usage: "timingfile [typescript [divisor]]" |
pascal@19991 | 16 //usage:#define scriptreplay_full_usage "\n\n" |
pascal@19991 | 17 //usage: "Play back typescripts, using timing information" |
pascal@19991 | 18 +//usage: IF_SCRIPTREPLAY_HOTKEYS( |
pascal@19991 | 19 +//usage: " and + - = space return hotkeys" |
pascal@19991 | 20 +//usage: ) |
pascal@19991 | 21 |
pascal@19991 | 22 #include "libbb.h" |
pascal@19991 | 23 |
pascal@19991 | 24 @@ -31,6 +41,10 @@ |
pascal@19991 | 25 const char *script = "typescript"; |
pascal@19991 | 26 double delay, factor = 1000000.0; |
pascal@19991 | 27 int fd; |
pascal@19991 | 28 +#if ENABLE_SCRIPTREPLAY_HOTKEYS |
pascal@19991 | 29 + int timeout = -1; |
pascal@19991 | 30 + char buffer[KEYCODE_BUFFER_SIZE]; |
pascal@19991 | 31 +#endif |
pascal@19991 | 32 unsigned long count; |
pascal@19991 | 33 FILE *tfp; |
pascal@19991 | 34 |
pascal@19991 | 35 @@ -48,6 +62,21 @@ |
pascal@19991 | 36 while (fscanf(tfp, "%lf %lu\n", &delay, &count) == 2) { |
pascal@19991 | 37 usleep(delay * factor); |
pascal@19991 | 38 bb_copyfd_exact_size(fd, STDOUT_FILENO, count); |
pascal@19991 | 39 +#if ENABLE_SCRIPTREPLAY_HOTKEYS |
pascal@19991 | 40 + switch (read_key(0, buffer, timeout)) { |
pascal@19991 | 41 + case ' ': |
pascal@19991 | 42 + timeout = INT_MAX; |
pascal@19991 | 43 + break; |
pascal@19991 | 44 + case '=': |
pascal@19991 | 45 + factor = 1000000.0/2; |
pascal@19991 | 46 + case '-': |
pascal@19991 | 47 + factor *= 4; |
pascal@19991 | 48 + case '+': |
pascal@19991 | 49 + factor /= 2; |
pascal@19991 | 50 + default : |
pascal@19991 | 51 + timeout = -1; |
pascal@19991 | 52 + } |
pascal@19991 | 53 +#endif |
pascal@19991 | 54 } |
pascal@19991 | 55 if (ENABLE_FEATURE_CLEAN_UP) { |
pascal@19991 | 56 close(fd); |