]> git.ipfire.org Git - thirdparty/util-linux.git/commit
cal: do not use putp(), directly use stdio functions
authorKarel Zak <kzak@redhat.com>
Wed, 21 Oct 2020 08:19:26 +0000 (10:19 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 21 Oct 2020 08:19:26 +0000 (10:19 +0200)
commit07c8462fb7f38b5872fc83fb98b8e9d81c6e41ef
tree239b5efaed522b2deeac9fe4c02385e5f1726711
parent97c9ec9ce3db2fe0266218b287484bc9d848e1a4
cal: do not use putp(), directly use stdio functions

It seems our putp() based output is not portable as some ncurses
implementations strictly follow POSIX where putp() accepts only
terminfo capability strings and nothing else.

We already use standard stdio.h functions to output terminfo strings
(e.g.  for colors). It seems we can do the same for cal(1) to
highlight the current day.

Note that mix putp() and fputs() is bad idea due to different
buffering ways in some cases (see cal.c git log for more details).

This patch also reduces complexity of the code as we can directly
output to stdout without snprintf to string.

Addresses: https://github.com/karelzak/util-linux/pull/1167
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/cal.c