From: Karel Zak Date: Tue, 30 Jul 2019 12:27:51 +0000 (+0200) Subject: scriptreplay: (utils) detect empty steps X-Git-Tag: v2.35-rc1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a46e54583d13b0bd79a6de27310ccbdbcc4cbc72;p=thirdparty%2Futil-linux.git scriptreplay: (utils) detect empty steps Signed-off-by: Karel Zak --- diff --git a/term-utils/script-playutils.c b/term-utils/script-playutils.c index 39662250d9..593af5dbe2 100644 --- a/term-utils/script-playutils.c +++ b/term-utils/script-playutils.c @@ -277,6 +277,13 @@ const char *replay_step_get_filename(struct replay_step *step) return step->data->filename; } +int replay_step_is_empty(struct replay_step *step) +{ + assert(step); + return step->size == 0 && step->type == 0; +} + + static int read_multistream_step(struct replay_step *step, FILE *f, char type) { int rc = 0; diff --git a/term-utils/script-playutils.h b/term-utils/script-playutils.h index 9e2e8aa247..18d96d9620 100644 --- a/term-utils/script-playutils.h +++ b/term-utils/script-playutils.h @@ -42,6 +42,7 @@ int replay_set_delay_div(struct replay_setup *stp, const double divi); struct timeval *replay_step_get_delay(struct replay_step *step); const char *replay_step_get_filename(struct replay_step *step); +int replay_step_is_empty(struct replay_step *step); int replay_get_next_step(struct replay_setup *stp, char *streams, struct replay_step **xstep); int replay_emit_step_data(struct replay_setup *stp, struct replay_step *step, int fd);