From: "Pádraig Brady" <P@draigBrady.com>
To: Ruediger Meier <sweet_f_a@gmx.de>
Cc: util-linux@vger.kernel.org, Sami Kerola <kerolasa@iki.fi>
Subject: Re: BUG: cal prints bad month headers
Date: Tue, 27 May 2014 12:29:19 +0100 [thread overview]
Message-ID: <5384770F.7040402@draigBrady.com> (raw)
In-Reply-To: <201405271250.41256.sweet_f_a@gmx.de>
On 05/27/2014 11:50 AM, Ruediger Meier wrote:
> On Tuesday 27 May 2014, Ruediger Meier wrote:
>> This happens only if output is redirected into a file
>> $ ./cal -ym > bla ;cat bla
>> It looks good in terminal.
>>
>> Reverting 95f4adde (plus 0c6dc4b9 and 4a7424a5) fixes the problem.
>
> Just another hint. Adding a fflush() like you see below also "fixes" the
> problem. Maybe we are mixing several output methods (printf, puts,
> my_putstring, etc.) like we shouldn't.
>
> diff --git a/misc-utils/cal.c b/misc-utils/cal.c
> index 81375fe..2b61a30 100644
> --- a/misc-utils/cal.c
> +++ b/misc-utils/cal.c
> @@ -760,6 +760,7 @@ static void yearly(const struct cal_control *ctl)
> set_consecutive_months(&m1, month, ctl->req.year);
> for (i = &m1; i; i = i->next)
> cal_fill_month(i, ctl);
> + fflush(NULL);
> cal_output_header(&m1, ctl);
> cal_output_months(&m1, ctl);
> }
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
This would avoid the problem.
The correct fix would to have all output go through
the same channel (buffer), i.e. all output should use
my_putstring()
cheers,
Pádraig.
next prev parent reply other threads:[~2014-05-28 11:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 9:45 BUG: cal prints bad month headers Ruediger Meier
2014-05-27 10:50 ` Ruediger Meier
2014-05-27 11:29 ` Pádraig Brady [this message]
2014-05-27 13:07 ` [PATCH] cal: all output must use my_putstring Ruediger Meier
2014-05-27 14:12 ` Karel Zak
2014-05-27 14:50 ` Ruediger Meier
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=5384770F.7040402@draigBrady.com \
--to=p@draigbrady.com \
--cc=kerolasa@iki.fi \
--cc=sweet_f_a@gmx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.