Re: [PATCH 4/6] scriptreplay: allow arguments as command line switches

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

 



On Sat, Apr 09, 2011 at 09:40:43PM +0200, Sami Kerola wrote:
> The command line switches override old style arguments
> 
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  term-utils/scriptreplay.c |   36 ++++++++++++++++++++++++++++--------
>  1 files changed, 28 insertions(+), 8 deletions(-)

 Fixed & Applied, thanks.

> -	if (argc < 1 || 3 < argc) {
> +	if ((argc < 1 && tname == NULL) || 3 < argc) {
>  		warnx(_("wrong number of arguments"));
>  		usage(stderr);
>  	}
> -
> -	tname = argv[0];
> -	sname = argc > 2 ? argv[1] : "typescript";
> -	divi = argc == 4 ? getnum(argv[2]) : 1;
> +	if (argv[0] && tname == NULL)
> +		tname = argv[0];
> +	else
> +		argc++;
> +	if (sname == NULL)
> +		sname = argc > 2 ? argv[1] : "typescript";
> +	if (diviopt == FALSE)
> +		divi = argc == 4 ? getnum(argv[2]) : 1;

I did some changes to the code, so it supports arbitrary combination
of old/new syntax:

    $ script --timing=foo.tm foo

    $ scriptreplay --typescript foo --timing too.tm --divisor 50
    $ scriptreplay foo.tm foo
    $ scriptreplay --typescript foo too.tm
    $ scriptreplay --divisor 50 foo.tm foo

    ...


        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