diff options
author | Morgan Seltzer <MorganSeltzer000@gmail.com> | 2021-06-07 18:11:43 -0400 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2021-08-07 13:42:28 -0400 |
commit | ee8ebebf9210abaa7bb6e9accc3ceed3909c2f12 (patch) | |
tree | 63e50d382048cfd424f1997c9d573225f70fb21d /src/config.c | |
parent | e3fc73e0c76addc0893ad3ceeba7ef8442133a51 (diff) | |
download | calcurse-ee8ebebf9210abaa7bb6e9accc3ceed3909c2f12.tar.gz calcurse-ee8ebebf9210abaa7bb6e9accc3ceed3909c2f12.zip |
First day of week can now be any day
Previously only Sunday and Monday were allowed as the first day of the
week, and this was internally treated as a binary variable.
This patch allows for users to change the first day of the week to any
day.
Addresses GitHub feature request #321.
Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index 2df2559..3627cb8 100644 --- a/src/config.c +++ b/src/config.c @@ -36,6 +36,8 @@ #include <ctype.h> #include <unistd.h> +#include <string.h> +#include <strings.h> #include "calcurse.h" @@ -261,14 +263,16 @@ static int config_parse_default_panel(void *dummy, const char *val) static int config_parse_first_day_of_week(void *dummy, const char *val) { - if (!strcmp(val, "monday")) - ui_calendar_set_first_day_of_week(MONDAY); - else if (!strcmp(val, "sunday")) - ui_calendar_set_first_day_of_week(SUNDAY); - else - return 0; + int i; - return 1; + for (i = 0; i < WEEKINDAYS; i++) { + if(!strcasecmp(val, get_wday_default_string(i))) { + ui_calendar_set_first_day_of_week(i); + return 1; + } + } + + return 0; } static int config_parse_color_theme(void *dummy, const char *val) |