diff options
-rw-r--r-- | NOFORK_NOEXEC.lst | 4 | ||||
-rw-r--r-- | util-linux/script.c | 22 | ||||
-rw-r--r-- | util-linux/scriptreplay.c | 3 |
3 files changed, 18 insertions, 11 deletions
diff --git a/NOFORK_NOEXEC.lst b/NOFORK_NOEXEC.lst index ac04f75da..21f09728d 100644 --- a/NOFORK_NOEXEC.lst +++ b/NOFORK_NOEXEC.lst | |||
@@ -299,8 +299,8 @@ runlevel - noexec. can be nofork if "endutxent()" is called unconditionally, but | |||
299 | runsv - daemon | 299 | runsv - daemon |
300 | runsvdir - daemon | 300 | runsvdir - daemon |
301 | rx - runner | 301 | rx - runner |
302 | script | 302 | script - longterm: pumps script output from slave pty |
303 | scriptreplay | 303 | scriptreplay - longterm: plays back "script" saved output, sleeping as necessary. |
304 | sed - runner | 304 | sed - runner |
305 | sendmail - runner | 305 | sendmail - runner |
306 | seq - noexec. runner | 306 | seq - noexec. runner |
diff --git a/util-linux/script.c b/util-linux/script.c index 9eebb51a4..6e8094312 100644 --- a/util-linux/script.c +++ b/util-linux/script.c | |||
@@ -21,15 +21,23 @@ | |||
21 | //kbuild:lib-$(CONFIG_SCRIPT) += script.o | 21 | //kbuild:lib-$(CONFIG_SCRIPT) += script.o |
22 | 22 | ||
23 | //usage:#define script_trivial_usage | 23 | //usage:#define script_trivial_usage |
24 | //usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" | 24 | //usage: "[-afqt] [-c PROG] [OUTFILE]" |
25 | //usage:#define script_full_usage "\n\n" | 25 | //usage:#define script_full_usage "\n\n" |
26 | //usage: " -a Append output" | 26 | //usage: " -a Append output" |
27 | //usage: "\n -c PROG Run PROG, not shell" | 27 | //usage: "\n -c PROG Run PROG, not shell" |
28 | //usage: "\n -f Flush output after each write" | 28 | //usage: "\n -f Flush output after each write" |
29 | //usage: "\n -q Quiet" | 29 | //usage: "\n -q Quiet" |
30 | //usage: IF_SCRIPTREPLAY( | ||
31 | //usage: "\n -t Send timing to stderr" | 30 | //usage: "\n -t Send timing to stderr" |
32 | //usage: ) | 31 | |
32 | //util-linux-2.28: | ||
33 | //-t[FILE] | ||
34 | //-e: return exit code of the child | ||
35 | |||
36 | //FYI (reported as bbox bug #2749): | ||
37 | // > script -q -c 'echo -e -n "1\n2\n3\n"' /dev/null </dev/null >123.txt | ||
38 | // > The output file on full-blown ubuntu system contains 6 bytes. | ||
39 | // > Output on Busybox system (arm-linux) contains extra '\r' byte in each line. | ||
40 | //however, in my test, "script" from util-linux-2.28 seems to also add '\r' bytes. | ||
33 | 41 | ||
34 | #include "libbb.h" | 42 | #include "libbb.h" |
35 | #include "common_bufsiz.h" | 43 | #include "common_bufsiz.h" |
@@ -64,14 +72,14 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
64 | "command\0" Required_argument "c" | 72 | "command\0" Required_argument "c" |
65 | "flush\0" No_argument "f" | 73 | "flush\0" No_argument "f" |
66 | "quiet\0" No_argument "q" | 74 | "quiet\0" No_argument "q" |
67 | IF_SCRIPTREPLAY("timing\0" No_argument "t") | 75 | "timing\0" No_argument "t" |
68 | ; | 76 | ; |
69 | 77 | ||
70 | applet_long_options = getopt_longopts; | 78 | applet_long_options = getopt_longopts; |
71 | #endif | 79 | #endif |
72 | 80 | ||
73 | opt_complementary = "?1"; /* max one arg */ | 81 | opt_complementary = "?1"; /* max one arg */ |
74 | opt = getopt32(argv, "ac:fq" IF_SCRIPTREPLAY("t") , &shell_arg); | 82 | opt = getopt32(argv, "ac:fqt", &shell_arg); |
75 | //argc -= optind; | 83 | //argc -= optind; |
76 | argv += optind; | 84 | argv += optind; |
77 | if (argv[0]) { | 85 | if (argv[0]) { |
@@ -120,7 +128,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
120 | /* parent */ | 128 | /* parent */ |
121 | struct pollfd pfd[2]; | 129 | struct pollfd pfd[2]; |
122 | int outfd, count, loop; | 130 | int outfd, count, loop; |
123 | double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; | 131 | double oldtime = time(NULL); |
124 | smallint fd_count = 2; | 132 | smallint fd_count = 2; |
125 | #define buf bb_common_bufsiz1 | 133 | #define buf bb_common_bufsiz1 |
126 | setup_common_bufsiz(); | 134 | setup_common_bufsiz(); |
@@ -151,7 +159,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
151 | goto restore; | 159 | goto restore; |
152 | } | 160 | } |
153 | if (count > 0) { | 161 | if (count > 0) { |
154 | if (ENABLE_SCRIPTREPLAY && (opt & OPT_t)) { | 162 | if (opt & OPT_t) { |
155 | struct timeval tv; | 163 | struct timeval tv; |
156 | double newtime; | 164 | double newtime; |
157 | 165 | ||
diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c index 7e9850103..e3083ab93 100644 --- a/util-linux/scriptreplay.c +++ b/util-linux/scriptreplay.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * pascal.bellard@ads-lu.com | 5 | * pascal.bellard@ads-lu.com |
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
8 | * | ||
9 | */ | 8 | */ |
10 | //config:config SCRIPTREPLAY | 9 | //config:config SCRIPTREPLAY |
11 | //config: bool "scriptreplay (2.6 kb)" | 10 | //config: bool "scriptreplay (2.6 kb)" |
@@ -19,7 +18,7 @@ | |||
19 | //kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o | 18 | //kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o |
20 | 19 | ||
21 | //usage:#define scriptreplay_trivial_usage | 20 | //usage:#define scriptreplay_trivial_usage |
22 | //usage: "timingfile [typescript [divisor]]" | 21 | //usage: "TIMINGFILE [TYPESCRIPT [DIVISOR]]" |
23 | //usage:#define scriptreplay_full_usage "\n\n" | 22 | //usage:#define scriptreplay_full_usage "\n\n" |
24 | //usage: "Play back typescripts, using timing information" | 23 | //usage: "Play back typescripts, using timing information" |
25 | 24 | ||