Re: [PATCH 13/17] setterm: tell user when options does not effect

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

 



On Sun, May 18, 2014 at 03:05:37PM +0100, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  term-utils/setterm.c | 83 ++++++++++++++++++++++++++++------------------------
>  1 file changed, 45 insertions(+), 38 deletions(-)
> 
> diff --git a/term-utils/setterm.c b/term-utils/setterm.c
> index f1ed862..2a0162e 100644
> --- a/term-utils/setterm.c
> +++ b/term-utils/setterm.c
> @@ -792,6 +792,17 @@ static void screendump(struct setterm_control *ctl)
>  	return;
>  }
>  
> +/* Some options are applicable when terminal is virtual console. */
> +static int vc_only(struct setterm_control *ctl, const char *err)
> +{
> +	if (!ctl->vcterm) {
> +		if (err)
> +			warnx(_("terminal %s does not support %s"),
> +			      ctl->opt_te_terminal_name, err);
> +	}
> +	return ctl->vcterm;
> +}
> +
>  static void perform_sequence(struct setterm_control *ctl)
>  {
>  	int result;
> @@ -812,49 +823,45 @@ static void perform_sequence(struct setterm_control *ctl)
>  			putp(ti_entry("civis"));
>  	}
>  
> -	/* -linewrap [on|off]. Vc only (vt102) */
> -	if (ctl->opt_linewrap && ctl->vcterm)
> +	/* -linewrap [on|off]. */
> +	if (ctl->opt_linewrap && vc_only(ctl, "-linewrap"))
>  		fputs(ctl->opt_li_on ? "\033[?7h" : "\033[?7l", stdout);
>  
> -	/* -repeat [on|off]. Vc only (vt102) */
> -	if (ctl->opt_repeat && ctl->vcterm)
> +	/* -repeat [on|off]. */
> +	if (ctl->opt_repeat && vc_only(ctl, "-repeat"))

 Please use complete long options in error messages ("--repeat" rather 
 than "-repeat").

    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