Package: bsdutils Version: 1:2.17~rc3-1 Severity: wishlist Tags: patch We use script(1) to record major upgrades or maintenance. Sometimes, there are long pauses as commands execute or we pause to check documentation, etc.
When replaying these scripts, it would be nice to have a limit on the delay between output so we don't have to wait for minutes at a time in these situations. The existing divisor argument is useful, but we'd like to have quick operations played back at regular speed so they're easy to watch. If we set the divisor argument high enough to shorten long delays, the rest of the output speeds by too quickly. The attached patch (which should apply cleanly to the version of util-linux in experimental, hence the Version:) adds a "limit" argument to scriptreplay(1) that sets the maximum amount of delay between output. It also fixes a think-o in argument parsing (&& -> || in the argc check). -- System Information: Debian Release: 5.0.3 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages bsdutils depends on: ii libc6 2.7-18 GNU C Library: Shared libraries Versions of packages bsdutils recommends: ii bsdmainutils 6.1.10 collection of more utilities from bsdutils suggests no packages. -- no debconf information
--- scriptreplay.c.orig 2009-12-29 23:19:20.107793000 +0000 +++ scriptreplay.c 2009-12-29 23:33:31.592856000 +0000 @@ -35,7 +35,7 @@ void __attribute__((__noreturn__)) usage(int rc) { - printf(_("%s <timingfile> [<typescript> [<divisor>]]\n"), + printf(_("%s <timingfile> [<typescript> [<divisor> [<limit>]]]\n"), program_invocation_short_name); exit(rc); } @@ -118,7 +118,7 @@ { FILE *tfile, *sfile; const char *sname, *tname; - double divi; + double divi, limit; int c; unsigned long line; size_t oldblk = 0; @@ -133,12 +133,13 @@ bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - if (argc < 2 && argc > 4) + if (argc < 2 || argc > 5) usage(EXIT_FAILURE); tname = argv[1]; - sname = argc > 2 ? argv[2] : "typescript"; - divi = argc == 4 ? getnum(argv[3]) : 1; + sname = argc >= 3 ? argv[2] : "typescript"; + divi = argc >= 4 ? getnum(argv[3]) : 1; + limit = argc == 5 ? getnum(argv[4]) : -1; tfile = fopen(tname, "r"); if (!tfile) @@ -167,6 +168,9 @@ tname, line); } delay /= divi; + if (limit != -1 && delay > limit) { + delay = limit; + } if (delay > SCRIPT_MIN_DELAY) delay_for(delay); --- scriptreplay.1.orig 2009-12-29 23:20:48.541585000 +0000 +++ scriptreplay.1 2009-12-29 23:22:48.793858000 +0000 @@ -148,6 +148,7 @@ .I timingfile .RI [ typescript .RI [ divisor ]] +.RI [ ceiling ]] .SH "DESCRIPTION" .IX Header "DESCRIPTION" This program replays a typescript, using timing information to ensure that @@ -180,6 +181,11 @@ .B scriptreplay go twice as fast and a speed-up of 0.1 makes it go ten times slower than the original session. +.PP +If the fourth parameter is specified, it is used as a delay limit. For +example, a limit of 2 makes +.B scriptreplay +never pause between output for more than two seconds. .SH "EXAMPLE" .IX Header "EXAMPLE" .Vb 7