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