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 Fri, Apr 14, 2017 at 09:39:48PM +0100, Sami Kerola wrote:
> Recent commit that removed header timestamp from typescript output when
> --quiet option is defined broke scriptreplay.  Trouble was that scriptreplay
> always skipped first line of the typescript.  But --quiet makes that line to
> be part of what must be printed by scriptreplay.

This explain why I had bad feeing from the patch ;-)

> +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);
> +	fseek(tfile, 0, SEEK_SET);
> +	if ((size_t)st.st_size <= total)
> +		return 0;
> +	return 1;
> +}

Not sure about it. It seems like overkill... 

I have reverted Rui's change and fixed the man page.

It seems better to keep things simple and stupid... it means keep
typescript file completely independent on the --quit option (for the
both, start and done messages).

Note that Rui also suggested to avoid strftime() for the messages due
to problems with \n (and I have suggested to use ISO times). It's
already committed.


Anyway, I don't like officially supported file formats without any
header. IMHO it would be really nice to add to the typescript:

 ### script(1) typescript; Version: util-linux v2.30; Date: 2017-04-18 12:10:43+0200

... and maybe more information. The same for timing file.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
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