wok-current diff busybox/stuff/busybox-1.27-scriptreplay.u @ rev 21779
linld: fix strdup (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Jul 11 16:53:39 2019 +0200 (2019-07-11) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.27-scriptreplay.u Thu Jul 11 16:53:39 2019 +0200 1.3 @@ -0,0 +1,56 @@ 1.4 +--- busybox-1.26/util-linux/scriptreplay.c 1.5 ++++ busybox-1.26/util-linux/scriptreplay.c 1.6 +@@ -18,10 +18,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 +@@ -31,6 +41,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 +@@ -48,6 +62,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);