summaryrefslogtreecommitdiff
path: root/misc-utils/cal.c
AgeCommit message (Collapse)AuthorFilesLines
2010-11-15cal: follow HAVE_LANGINFOKarel Zak1-20/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07cal: use EXIT_* and program_invocation_short_nameKarel Zak1-13/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-16cal: factor out and update multibyte alignment codePádraig Brady1-79/+7
* include/mbsalign.h: New module interface * lib/mbsalign.c: Updated implementation synced from coreutils * include/Makefile.am: Add mbsalign.h * misc-utils/Makefile.am: Make cal dependent on mbsalign module * misc-utils/cal.c: Call mbsalign() [kzak@redhat.com: - use min() macro from c.h] Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-11cal: fix first day of the week calculation on BE systemsKarel Zak1-1/+5
This reverts commit dcb54fafb128ab41772ae217afc6a7612e2cc446, "cal: remove gcc-ism from nl_langinfo() call". The code: int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY); does not work on big-endian machines. The original solution based on union is better. Note that the "type punning" is not gcc-ism any more, it's allowed by C99 (6.5.2.3). Reported-by: Joseph Jezak <josejx@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16cal: use c.hKarel Zak1-9/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-09cal: remove obsolete <localeinfo.h> includeGuillem Jover1-2/+0
The fact that the system does not have <langinfo.h> does not imply that it has <localeinfo.h> (which is an ancient header from Linux libc4). Signed-off-by: Guillem Jover <guillem@hadrons.org>
2009-07-20cal: fix broken computation for Sep 1752Peter Breitenlohner1-9/+14
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de> Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-07-20cal: fix (harmless) typoPeter Breitenlohner1-1/+1
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de> Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-05-19cal: uClibc has langinfo.h but not _NL_TIME_WEEK_1STDAY.Tom Prince1-1/+1
Signed-off-by: Tom Prince <cougar@hermes>
2009-05-07cal: Highlight today even when month or year specifiedRajeev V. Pillai1-2/+5
* misc-utils/cal.c: Unconditionally call time() and highlight today where possible. Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-03-10cal: remove gcc-ism from nl_langinfo() callKarel Zak1-5/+1
> On Tue, Mar 10, 2009 at 01:15:14PM +0100, Samuel Thibault wrote: > That will only work with the gcc compiler, which allows to read a > union field what you wrote in another. Shouldn't > (int)(intptr_t)nl_langinfo() be just fine? Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-10cal: determine the first day of week from the localePádraig Brady1-26/+39
Previously it defaulted to Sunday rather than using the value from the locale. Lauri Nurmi <lanurmi@iki.fi> provided the detailed argument for this change while Samuel Thibault <samuel.thibault@ens-lyon.org> provided the information on how to read the first day of the week from the locale correctly. [kzak@redhat.com: - fix "cast from pointer to integer", nl_langinfo(_NL_TIME_WEEK_1STDAY) call)] Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2008-04-16cal: use HAVE_LIB{NCURSES,NCURSESW} instead HAVE_NCURSESKarel Zak1-4/+4
The HAVE_NCURSES is obsolete macro. The autotool generates HAVE_LIBxxx macros. Signed-off-by: Karel Zak <kzak@redhat.com>
2008-01-17cal: fix weekday alignment for certain localesPádraig Brady1-63/+86
For example this had too much padding: LANG=zh_CN.utf8 cal -j while this had too little padding: LANG=hu_HU.utf8 cal This had invalid chars: LANG=li_BE.utf8 cal This had too few chars: LANG=si_LK.utf8 cal Note some locales may display with slightly worse alignment (fa_IR.utf8 for example), but that is only because the terminal is not merging the combining characters. This happens on gnome-terminal-2.18.3-1.fc8 at least. Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-16cal: replace errs.h with libc err.hKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-11cal: add support for highlighting an arbitrary datePádraig Brady1-21/+28
This is done by calling cal with the extra day parameter like: cal 14 9 1752 Note the tests were updated to use the new syntax. Note also that this patch changes the -y option to always print a full year, even if a month or the -[13] options are specified. This matches the cal operation from bsdmainutils on debian and also allows one to print a full year while highlighting a particular date. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2007-10-03cal: avoid -Wformat warningsJim Meyering1-2/+2
Avoid this warning from gcc -Wformat: "format not a string literal and no format arguments". Signed-off-by: Jim Meyering <jim@meyering.net>
2007-09-19build-sys: nls/locale handling in util-linux-ng generalMike Frysinger1-1/+0
On Monday 03 September 2007, Karel Zak wrote: > http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592 > > I agree that we need a better support for compilation without > locales, but from my point of view NLS != all locales stuff. The NLS > support is subset only. thinking about the input from everyone, i'd propose the attached ... Only pull in locale.h as needed and move it to the common nls.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2007-07-10cal: add test codeKarel Zak1-1/+10
This patch allows to override the time() and define a different time by TEST_TIME env. variable. The code has to be compiled with -DTEST_CAL. Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-12cal: widechar code cleanupKarel Zak1-21/+17
This patch make widechar code (cal headers initialization) more robust. That's possible to format wide char strings by swprintf() and non-widechar version by sprintf(). This is better than the old solution with wcscat(). Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-12cal: ifdef cleanup, non-curses/tempcap code fixesKarel Zak1-20/+16
This patche: - removes extra #ifdef-s, - fixes \n usage when compiled without curses/termcap Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-12cal: fix a segfault and -3m highlightingKarel Zak1-9/+38
Fixes a segfault for certain values of $TERM Fixes alignment issues when the highlighted day (today) is in the last week of the month. Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-30build-sys: fix ifdef ENABLE_WIDECHAR usageKarel Zak1-8/+8
There has been unexpected mix of HAVE_WIDECHAR and ENABLE_WIDECHAR macros. The ENABLE_WIDECHAR is old version and has to be replaced everywhere otherwise we will see bugs with multibyte stuff. Signed-off-by: Karel Zak <kzak@redhat.com>
2006-12-07Imported from util-linux-2.13-pre2 tarball.Karel Zak1-2/+2
2006-12-07Imported from util-linux-2.13-pre1 tarball.Karel Zak1-17/+17
2006-12-07Imported from util-linux-2.12j tarball.Karel Zak1-164/+268
2006-12-07Imported from util-linux-2.11x tarball.Karel Zak1-0/+2
2006-12-07Imported from util-linux-2.11v tarball.Karel Zak1-1/+1
2006-12-07Imported from util-linux-2.11r tarball.Karel Zak1-1/+1
2006-12-07Imported from util-linux-2.11o tarball.Karel Zak1-3/+6
2006-12-07Imported from util-linux-2.11n tarball.Karel Zak1-4/+28
2006-12-07Imported from util-linux-2.11m tarball.Karel Zak1-17/+83
2006-12-07Imported from util-linux-2.11b tarball.Karel Zak1-1/+1
2006-12-07Imported from util-linux-2.10s tarball.Karel Zak1-9/+104
2006-12-07Imported from util-linux-2.10m tarball.Karel Zak1-5/+2
2006-12-07Imported from util-linux-2.10f tarball.Karel Zak1-9/+14
2006-12-07Imported from util-linux-2.9v tarball.Karel Zak1-23/+17
2006-12-07Imported from util-linux-2.9i tarball.Karel Zak1-15/+36
2006-12-07Imported from util-linux-2.8 tarball.Karel Zak1-6/+0
2006-12-07Imported from util-linux-2.7.1 tarball.Karel Zak1-9/+20
2006-12-07Imported from util-linux-2.5 tarball.Karel Zak1-23/+39
2006-12-07Imported from util-linux-2.2 tarball.Karel Zak1-0/+450