wok diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.31-scriptreplay.u Wed Apr 19 10:00:25 2023 +0000 1.3 @@ -0,0 +1,56 @@ 1.4 +--- busybox-1.31/util-linux/scriptreplay.c 1.5 ++++ busybox-1.31/util-linux/scriptreplay.c 1.6 +@@ -17,10 +17,20 @@ 1.7 + 1.8 + //kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o 1.9 + 1.10 ++//config:config SCRIPTREPLAY_HOTKEYS 1.11 ++//config: bool "speed control hotkeys" 1.12 ++//config: default n 1.13 ++//config: depends on SCRIPTREPLAY 1.14 ++//config: help 1.15 ++//config: Tune replay speed with + - = space return hotkeys. 1.16 ++ 1.17 + //usage:#define scriptreplay_trivial_usage 1.18 + //usage: "TIMINGFILE [TYPESCRIPT [DIVISOR]]" 1.19 + //usage:#define scriptreplay_full_usage "\n\n" 1.20 + //usage: "Play back typescripts, using timing information" 1.21 ++//usage: IF_SCRIPTREPLAY_HOTKEYS( 1.22 ++//usage: " and + - = space return hotkeys" 1.23 ++//usage: ) 1.24 + 1.25 + #include "libbb.h" 1.26 + 1.27 +@@ -30,6 +40,10 @@ 1.28 + const char *script = "typescript"; 1.29 + double delay, factor = 1000000.0; 1.30 + int fd; 1.31 ++#if ENABLE_SCRIPTREPLAY_HOTKEYS 1.32 ++ int timeout = -1; 1.33 ++ char buffer[KEYCODE_BUFFER_SIZE]; 1.34 ++#endif 1.35 + unsigned long count; 1.36 + FILE *tfp; 1.37 + 1.38 +@@ -47,6 +61,21 @@ 1.39 + while (fscanf(tfp, "%lf %lu\n", &delay, &count) == 2) { 1.40 + usleep(delay * factor); 1.41 + bb_copyfd_exact_size(fd, STDOUT_FILENO, count); 1.42 ++#if ENABLE_SCRIPTREPLAY_HOTKEYS 1.43 ++ switch (read_key(0, buffer, timeout)) { 1.44 ++ case ' ': 1.45 ++ timeout = INT_MAX; 1.46 ++ break; 1.47 ++ case '=': 1.48 ++ factor = 1000000.0/2; 1.49 ++ case '-': 1.50 ++ factor *= 4; 1.51 ++ case '+': 1.52 ++ factor /= 2; 1.53 ++ default : 1.54 ++ timeout = -1; 1.55 ++ } 1.56 ++#endif 1.57 + } 1.58 + if (ENABLE_FEATURE_CLEAN_UP) { 1.59 + close(fd);