Re: [PATCH] scriptreplay: determine if script --quiet was used to create typescript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 April 2017 at 21:39, Sami Kerola <kerolasa@xxxxxx> wrote:
> diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
> index 5fd3ecb16..365b73de4 100644
> --- a/term-utils/scriptreplay.c
> +++ b/term-utils/scriptreplay.c
> @@ -58,6 +59,25 @@ usage(FILE *out)
>         exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
>  }
>
> +static int
> +sfile_has_header(FILE *sfile, FILE *tfile)
> +{
> +       double delay;
> +       size_t blk, total = 0;
> +       char nl;
> +       struct stat st;
> +
> +       if (fstat(fileno(sfile), &st) < 0)
> +               return 0;
> +       while (fscanf(tfile, "%lf %zu%c\n", &delay, &blk, &nl) == 3)
> +               total += blk;
> +       fseek(sfile, 0, SEEK_SET);

sfile file position does not need updating, fixed in:

https://github.com/kerolasa/lelux-utiliteetit/commit/419a5cb277068eea395fdbdf41d9f8cad9296357

branch name: script

> +       fseek(tfile, 0, SEEK_SET);
> +       if ((size_t)st.st_size <= total)
> +               return 0;
> +       return 1;
> +}
> +
>  static double
>  getnum(const char *s)
>  {

-- 
Sami Kerola
http://www.iki.fi/kerolasa/
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux