util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruediger Meier <sweet_f_a@gmx.de>
To: Sami Kerola <kerolasa@iki.fi>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 02/11] line: do not print new line if nothing else was printed
Date: Fri, 9 Jun 2017 14:01:23 +0200	[thread overview]
Message-ID: <201706091401.24156.sweet_f_a@gmx.de> (raw)
In-Reply-To: <20170608195215.1702-3-kerolasa@iki.fi>

On Thursday 08 June 2017, Sami Kerola wrote:
> Earlier the following printed stray new line.
>
> $ printf "" | ./line

This breaks test "misc/line", see commit caad4ded
and
https://github.com/karelzak/util-linux/issues/236

> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  text-utils/line.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/text-utils/line.c b/text-utils/line.c
> index 486e5dd31..ae10809c2 100644
> --- a/text-utils/line.c
> +++ b/text-utils/line.c
> @@ -42,7 +42,7 @@ static void __attribute__((__noreturn__))
> usage(FILE *out) int main(int argc, char **argv)
>  {
>  	wint_t c;
> -	int opt;
> +	int opt, print_nl = 0;
>  	int status = EXIT_SUCCESS;
>
>  	static const struct option longopts[] = {
> @@ -77,8 +77,10 @@ int main(int argc, char **argv)
>  		if (c == '\n')
>  			break;
>  		putwchar(c);
> +		print_nl = 1;
>  	}
> -	putwchar(L'\n');
> +	if (print_nl)
> +		putwchar(L'\n');
>
>  	return status;
>  }

  reply	other threads:[~2017-06-09 12:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 19:52 [PATCH 00/11] pull: various small changes Sami Kerola
2017-06-08 19:52 ` [PATCH 01/11] misc: fallthrough fixes Sami Kerola
2017-06-09 11:14   ` Ruediger Meier
2017-06-09 21:10     ` Rüdiger Meier
2017-06-11  8:36       ` Sami Kerola
2017-06-12  8:40         ` Rüdiger Meier
2017-06-12 21:54           ` Sami Kerola
2017-06-12 23:16             ` Rüdiger Meier
2017-06-13 12:51               ` Karel Zak
2017-06-13 13:03                 ` Rüdiger Meier
2017-06-13 13:41                   ` Karel Zak
2017-06-13 14:52                     ` Rüdiger Meier
2017-06-13 20:00                       ` Karel Zak
2017-06-13 20:11                         ` Rüdiger Meier
2017-06-13 21:02                           ` Karel Zak
2017-06-17  8:23                             ` Sami Kerola
2017-06-08 19:52 ` [PATCH 02/11] line: do not print new line if nothing else was printed Sami Kerola
2017-06-09 12:01   ` Ruediger Meier [this message]
2017-06-11  8:19     ` Sami Kerola
2017-06-08 19:52 ` [PATCH 03/11] rename: notice when expression and replacement are the same string Sami Kerola
2017-06-08 19:52 ` [PATCH 04/11] uuidgen: slice up the usage text Sami Kerola
2017-06-08 19:52 ` [PATCH 05/11] uuidgen: add --date option to display time when uuid was generated Sami Kerola
2017-06-13 13:16   ` Karel Zak
2017-06-17  8:26     ` Sami Kerola
2017-06-08 19:52 ` [PATCH 06/11] isosize: avoid reading more data than what is needed Sami Kerola
2017-06-08 19:52 ` [PATCH 07/11] misc: fix reassigned values before old ones has been used [cppcheck] Sami Kerola
2017-06-08 19:52 ` [PATCH 08/11] losetup: add missing initializer [clang] Sami Kerola
2017-06-08 19:52 ` [PATCH 09/11] misc: remove stray semicolons Sami Kerola
2017-06-08 19:52 ` [PATCH 10/11] lib: simplify cpuset if clauses that return Sami Kerola
2017-06-08 19:52 ` [PATCH 11/11] lib: remove _RLD_ from forbid environment variable list Sami Kerola
2017-06-14 10:30 ` [PATCH 00/11] pull: various small changes Karel Zak

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=201706091401.24156.sweet_f_a@gmx.de \
    --to=sweet_f_a@gmx.de \
    --cc=kerolasa@iki.fi \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).