summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko2017-08-07 01:53:17 +0200
committerDenys Vlasenko2017-08-07 01:53:17 +0200
commitdd55d5d53c394edb65d392f77087049540568997 (patch)
tree1a34bd794d90b82fae295314ee745836eecb8a54 /util-linux
parent7b8372b81926ef6aa8d91945a95261bbb93d0b9e (diff)
downloadbusybox-dd55d5d53c394edb65d392f77087049540568997.zip
busybox-dd55d5d53c394edb65d392f77087049540568997.tar.gz
script: make -t independent of scriptreplay
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/script.c22
-rw-r--r--util-linux/scriptreplay.c3
2 files changed, 16 insertions, 9 deletions
diff --git a/util-linux/script.c b/util-linux/script.c
index 9eebb51..6e80943 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -21,15 +21,23 @@
//kbuild:lib-$(CONFIG_SCRIPT) += script.o
//usage:#define script_trivial_usage
-//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]"
+//usage: "[-afqt] [-c PROG] [OUTFILE]"
//usage:#define script_full_usage "\n\n"
//usage: " -a Append output"
//usage: "\n -c PROG Run PROG, not shell"
//usage: "\n -f Flush output after each write"
//usage: "\n -q Quiet"
-//usage: IF_SCRIPTREPLAY(
//usage: "\n -t Send timing to stderr"
-//usage: )
+
+//util-linux-2.28:
+//-t[FILE]
+//-e: return exit code of the child
+
+//FYI (reported as bbox bug #2749):
+// > script -q -c 'echo -e -n "1\n2\n3\n"' /dev/null </dev/null >123.txt
+// > The output file on full-blown ubuntu system contains 6 bytes.
+// > Output on Busybox system (arm-linux) contains extra '\r' byte in each line.
+//however, in my test, "script" from util-linux-2.28 seems to also add '\r' bytes.
#include "libbb.h"
#include "common_bufsiz.h"
@@ -64,14 +72,14 @@ int script_main(int argc UNUSED_PARAM, char **argv)
"command\0" Required_argument "c"
"flush\0" No_argument "f"
"quiet\0" No_argument "q"
- IF_SCRIPTREPLAY("timing\0" No_argument "t")
+ "timing\0" No_argument "t"
;
applet_long_options = getopt_longopts;
#endif
opt_complementary = "?1"; /* max one arg */
- opt = getopt32(argv, "ac:fq" IF_SCRIPTREPLAY("t") , &shell_arg);
+ opt = getopt32(argv, "ac:fqt", &shell_arg);
//argc -= optind;
argv += optind;
if (argv[0]) {
@@ -120,7 +128,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
/* parent */
struct pollfd pfd[2];
int outfd, count, loop;
- double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0;
+ double oldtime = time(NULL);
smallint fd_count = 2;
#define buf bb_common_bufsiz1
setup_common_bufsiz();
@@ -151,7 +159,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
goto restore;
}
if (count > 0) {
- if (ENABLE_SCRIPTREPLAY && (opt & OPT_t)) {
+ if (opt & OPT_t) {
struct timeval tv;
double newtime;
diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c
index 7e98501..e3083ab 100644
--- a/util-linux/scriptreplay.c
+++ b/util-linux/scriptreplay.c
@@ -5,7 +5,6 @@
* pascal.bellard@ads-lu.com
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
- *
*/
//config:config SCRIPTREPLAY
//config: bool "scriptreplay (2.6 kb)"
@@ -19,7 +18,7 @@
//kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o
//usage:#define scriptreplay_trivial_usage
-//usage: "timingfile [typescript [divisor]]"
+//usage: "TIMINGFILE [TYPESCRIPT [DIVISOR]]"
//usage:#define scriptreplay_full_usage "\n\n"
//usage: "Play back typescripts, using timing information"