[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gcal] gcal must use _NL_TIME_FIRST_WEEKDAY to get correct defau
From: |
Giuseppe Scrivano |
Subject: |
Re: [Bug-gcal] gcal must use _NL_TIME_FIRST_WEEKDAY to get correct defaults for -s N option |
Date: |
Fri, 14 Feb 2014 23:48:28 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Olaf Hering <address@hidden> writes:
> Since a very long time it bothers me alot that gcal fails to get the
> starting of the week right. It may be Sunday in some parts of the World,
> but for us its Monday.
>
> So today I finally looked into the source once I figured that 3.6.3 still
> fails. It turned out that gcal.c assumes a define is provided by glibc for
> _NL_TIME_FIRST_WEEKDAY. But in fact its an enum, so the incorrect fallback is
> used.
>
> Please add a fix equivalent to the following:
I am going to push the following patch in your name:
>From bbdb79552a31b0c50a27bb3d09509d368a715cff Mon Sep 17 00:00:00 2001
From: Olaf Hering <address@hidden>
Date: Fri, 14 Feb 2014 23:36:27 +0100
Subject: [PATCH] Use _NL_TIME_FIRST_WEEKDAY to get correct defaults for -s N
option
---
src/gcal.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gcal.c b/src/gcal.c
index f6611e5..8e9e4a3 100644
--- a/src/gcal.c
+++ b/src/gcal.c
@@ -6025,9 +6025,10 @@ check_command_line (argc, argv)
/*
Set starting day of week to language/territory default value.
*/
-#if defined GCAL_NLS && defined _NL_TIME_FIRST_WEEKDAY
+#if defined GCAL_NLS
start_day = (nl_langinfo (_NL_TIME_FIRST_WEEKDAY)[0] + 5) % 7 + 1;
#else /* !GCAL_NLS */
+#error MUST USE _NL_TIME_FIRST_WEEKDAY !
start_day = DAY_MAX;
#endif /* !GCAL_NLS */
}
--
1.8.5.3