#!/usr/bin/env perl # # scriptreplay - play back typescript of terminal session # # # Author(s): # Joey Hess # Marc Schoechlin # Hendrik Brueckner # # use strict; use warnings; use File::Basename; use Getopt::Long; use IO::Select; use POSIX; use Term::ReadKey; sub main(); sub show_usage(); sub __exit($;@); sub open_expr($); my $progname = fileparse($0, qr/\.[^.]+/); $SIG{__WARN__} = sub { print STDERR "$progname: $_[0]"; }; $SIG{__DIE__} = sub { print STDERR "$progname: $_[0]"; __exit 254; }; sub main() { my $time_file; my $script_file; my $accel = 1; # parse command line options unless (GetOptions("t|timing=s" => \$time_file, "a|accelerate=f" => \$accel, "<>" => sub { $script_file = shift; }, "h|help" => sub { show_usage(); exit 0; })) { show_usage(); exit 1; } # check parameters die "You need to specify a script file (see also option '-h')\n" unless defined $script_file; die "Acceleration factor must be greater than 0\n" unless $accel > 0; # open script_file open (SCRIPT, open_expr($script_file)) or die "Cannot open typescript file $script_file: $!\n"; unless (