Re: [PATCH] chfn: Make readline prompt for each field on a separate line

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

 



On Sat, Jun 27, 2020 at 07:58:13PM +0100, Damien Goutte-Gattat wrote:
>   $ chfn
>   Changing finger information for user.
>   Password:
>   Name []: Office []: Office Phone []: Home Phone []:

Good catch. Applied, thanks!

> --- a/login-utils/chfn.c
> +++ b/login-utils/chfn.c
> @@ -235,12 +235,13 @@ static char *ask_new_field(struct chfn_control *ctl, const char *question,
>  	if (!def_val)
>  		def_val = "";
>  	while (true) {
> -		printf("%s [%s]: ", question, def_val);
> +		printf("%s [%s]:", question, def_val);
>  		__fpurge(stdin);
>  #ifdef HAVE_LIBREADLINE
>  		rl_bind_key('\t', rl_insert);
> -		if ((buf = readline(NULL)) == NULL)
> +		if ((buf = readline(" ")) == NULL)
>  #else
> +		putchar('\n');

I have replaced '\n with ' ', otherwise for non-readline version it
it prints extra line.

I have also applied your change also to chsh.
https://github.com/karelzak/util-linux/commit/49848aa53ae3a599277e8ceb50feda565f140b45


    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[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