1 /* vi: set sw=4 ts=4: */
3 * scriptreplay - play back typescripts, using timing information
5 * pascal.bellard@ads-lu.com
7 * Licensed under GPLv2 or later, see file License in this tarball for details.
12 int scriptreplay_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
13 int scriptreplay_main(int argc UNUSED_PARAM, char **argv)
15 const char *script = "typescript";
16 double delay, factor = 1000000.0;
27 factor /= atof(argv[3]);
30 tfp = xfopen_for_read(argv[1]);
31 fd = xopen(script, O_RDONLY);
32 while (fscanf(tfp, "%lf %lu\n", &delay, &count) == 2) {
33 usleep(delay * factor);
34 bb_copyfd_exact_size(fd, STDOUT_FILENO, count);
36 if (ENABLE_FEATURE_CLEAN_UP) {