Util-Linux Archive on lore.kernel.org
 help / color / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Damien Goutte-Gattat <dgouttegattat@incenp.org>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] chfn: Make readline prompt for each field on a separate line
Date: Mon, 29 Jun 2020 12:02:42 +0200
Message-ID: <20200629100242.luuaj3quee2d5kds@ws.net.home> (raw)
In-Reply-To: <20200627185813.17837-1-dgouttegattat@incenp.org>

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@redhat.com>
 http://karelzak.blogspot.com


      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27 18:58 Damien Goutte-Gattat
2020-06-29 10:02 ` Karel Zak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629100242.luuaj3quee2d5kds@ws.net.home \
    --to=kzak@redhat.com \
    --cc=dgouttegattat@incenp.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org
	public-inbox-index util-linux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git