Fix date output in calcurse 'one-shot' mode ('-d' or '-Q --filter-type cal
--days') on 32-bit arch following 64-bit time_t. Reported by Raf Czlonka, ok ajacoutot@
This commit is contained in:
parent
516987fcdf
commit
7ee41cb7cb
@ -1,8 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.20 2015/03/15 08:29:08 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.21 2015/10/14 10:04:16 sthen Exp $
|
||||
|
||||
COMMENT= text-based calendar and scheduling application
|
||||
|
||||
DISTNAME= calcurse-4.0.0
|
||||
REVISION= 0
|
||||
EPOCH= 0
|
||||
|
||||
CATEGORIES= productivity
|
||||
|
16
productivity/calcurse/patches/patch-src_args_c
Normal file
16
productivity/calcurse/patches/patch-src_args_c
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-src_args_c,v 1.1 2015/10/14 10:04:16 sthen Exp $
|
||||
--- src/args.c.orig Sun Feb 22 10:34:11 2015
|
||||
+++ src/args.c Tue Oct 13 23:07:51 2015
|
||||
@@ -274,10 +274,11 @@ static void next_arg(void)
|
||||
/*
|
||||
* Print the date on stdout.
|
||||
*/
|
||||
-static void arg_print_date(long date)
|
||||
+static void arg_print_date(long date_l)
|
||||
{
|
||||
char date_str[BUFSIZ];
|
||||
struct tm lt;
|
||||
+ time_t date = date_l;
|
||||
|
||||
localtime_r((time_t *) & date, <);
|
||||
strftime(date_str, BUFSIZ, conf.output_datefmt, <);
|
50
productivity/calcurse/patches/patch-src_utils_c
Normal file
50
productivity/calcurse/patches/patch-src_utils_c
Normal file
@ -0,0 +1,50 @@
|
||||
$OpenBSD: patch-src_utils_c,v 1.1 2015/10/14 10:04:16 sthen Exp $
|
||||
--- src/utils.c.orig Tue Oct 13 22:55:09 2015
|
||||
+++ src/utils.c Tue Oct 13 23:00:58 2015
|
||||
@@ -349,17 +349,19 @@ long get_item_time(long date)
|
||||
get_item_min(date) * MININSEC);
|
||||
}
|
||||
|
||||
-int get_item_hour(long date)
|
||||
+int get_item_hour(long date_l)
|
||||
{
|
||||
struct tm lt;
|
||||
+ time_t date = date_l;
|
||||
|
||||
localtime_r((time_t *) & date, <);
|
||||
return lt.tm_hour;
|
||||
}
|
||||
|
||||
-int get_item_min(long date)
|
||||
+int get_item_min(long date_l)
|
||||
{
|
||||
struct tm lt;
|
||||
+ time_t date = date_l;
|
||||
|
||||
localtime_r((time_t *) & date, <);
|
||||
return lt.tm_min;
|
||||
@@ -387,10 +389,11 @@ long date2sec(struct date day, unsigned hour, unsigned
|
||||
}
|
||||
|
||||
/* Return a string containing the date, given a date in seconds. */
|
||||
-char *date_sec2date_str(long sec, const char *datefmt)
|
||||
+char *date_sec2date_str(long sec_l, const char *datefmt)
|
||||
{
|
||||
struct tm lt;
|
||||
char *datestr = (char *)mem_calloc(BUFSIZ, sizeof(char));
|
||||
+ time_t sec = sec_l;
|
||||
|
||||
if (sec == 0) {
|
||||
strncpy(datestr, "0", BUFSIZ);
|
||||
@@ -403,8 +406,10 @@ char *date_sec2date_str(long sec, const char *datefmt)
|
||||
}
|
||||
|
||||
/* Generic function to format date. */
|
||||
-void date_sec2date_fmt(long sec, const char *fmt, char *datef)
|
||||
+void date_sec2date_fmt(long sec_l, const char *fmt, char *datef)
|
||||
{
|
||||
+ time_t sec = sec_l;
|
||||
+
|
||||
#if ENABLE_NLS
|
||||
/* TODO: Find a better way to deal with localization and strftime(). */
|
||||
char *locale_old = mem_strdup(setlocale(LC_ALL, NULL));
|
Loading…
Reference in New Issue
Block a user