From 0c723f3490df9ee9a5e133de374a06b06fdad76f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 30 Jul 2008 12:39:04 +0200 Subject: [PATCH] scriptreplay: new implementation is out-of-sync Reproduction steps: 1. Run "script -t 2>timing". 2. When the prompt comes up, hit return. 3. New prompt. Wait several seconds, then type "true" and hit return. 4. Repeat (3) as desired, then exit scripted shell. 5. Run "scriptreplay timing". You'll find on the replay that, rather than waiting several seconds between the prompt and true, the wait will actually occur after the first "t" of true. Reported-by: Micah Cowan Signed-off-by: Karel Zak --- misc-utils/scriptreplay.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc-utils/scriptreplay.c b/misc-utils/scriptreplay.c index 6c351a35..8a254de9 100644 --- a/misc-utils/scriptreplay.c +++ b/misc-utils/scriptreplay.c @@ -121,6 +121,7 @@ main(int argc, char *argv[]) double divi; int c; unsigned long line; + size_t oldblk = 0; /* Because we use space as a separator, we can't afford to use any * locale which tolerates a space in a number. In any case, script.c @@ -170,7 +171,9 @@ main(int argc, char *argv[]) if (delay > SCRIPT_MIN_DELAY) delay_for(delay); - emit(sfile, sname, blk); + if (oldblk) + emit(sfile, sname, oldblk); + oldblk = blk; } fclose(sfile); -- 2.39.5