summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-07-01 17:53:42 +0000
committerFrederic Culot <calcurse@culot.org>2007-07-01 17:53:42 +0000
commit7093cbefb7c979e99b662ad2b1544c5d1c1d517a (patch)
treec700ee3168b4183856d158fe45b6510eea9558c8 /src
parentff0c8aed71dd17776b4c90bd67ec6ca60384f9da (diff)
downloadcalcurse-7093cbefb7c979e99b662ad2b1544c5d1c1d517a.tar.gz
calcurse-7093cbefb7c979e99b662ad2b1544c5d1c1d517a.zip
recur_repeat_item() and recur_item_inday() prototypes updated to take into account date_t type
Diffstat (limited to 'src')
-rwxr-xr-xsrc/recur.c22
-rwxr-xr-xsrc/recur.h61
2 files changed, 45 insertions, 38 deletions
diff --git a/src/recur.c b/src/recur.c
index 01902df..d30d760 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.25 2007/04/14 18:46:54 culot Exp $ */
+/* $calcurse: recur.c,v 1.26 2007/07/01 17:53:42 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -374,6 +374,7 @@ recur_item_inday(long item_start, struct days_s *item_exc,
{
#define YEARSTODAYS(x) ((x) * 365L + (x) / 4 - (x) / 100 + (x) / 400)
+ date_t start_date;
long day_end;
struct tm *lt;
int day_month, day_year, day_yday, day_mday, diff;
@@ -440,8 +441,10 @@ recur_item_inday(long item_start, struct days_s *item_exc,
fputs(error, stderr);
exit(EXIT_FAILURE);
}
- item_start = date2sec(lt->tm_year + 1900, lt->tm_mon + 1,
- lt->tm_mday, lt->tm_hour, lt->tm_min);
+ start_date.dd = lt->tm_mday;
+ start_date.mm = lt->tm_mon + 1;
+ start_date.yyyy = lt->tm_year + 1900;
+ item_start = date2sec(start_date, lt->tm_hour, lt->tm_min);
if (item_start < day_end && item_start >= day_start)
return item_start;
@@ -565,14 +568,14 @@ void recur_apoint_erase(long start, unsigned num, unsigned delete_whole)
* and then delete the selected item to recreate it as a recurrent one
*/
void
-recur_repeat_item(int sel_year, int sel_month, int sel_day,
- int item_nb)
+recur_repeat_item(int item_nb)
{
struct tm *lt;
time_t t;
int ch = 0;
int valid_date = 0, date_entered = 0;
int year = 0, month = 0, day = 0;
+ date_t until_date;
char user_input[BUFSIZ] = "";
char *mesg_type_1 =
_("Enter the repetition type: (D)aily, (W)eekly, (M)onthly, (Y)early");
@@ -643,8 +646,11 @@ recur_repeat_item(int sel_year, int sel_month, int sel_day,
sscanf(user_input, "%d / %d / %d",
&month, &day, &year);
t = p->start; lt = localtime(&t);
- until = date2sec(year, month, day,
- lt->tm_hour, lt->tm_min);
+ until_date.dd = day;
+ until_date.mm = month;
+ until_date.yyyy = year;
+ until = date2sec(until_date,
+ lt->tm_hour, lt->tm_min);
if (until < p->start) {
status_mesg(mesg_older,
wrong_type_2);
@@ -662,7 +668,7 @@ recur_repeat_item(int sel_year, int sel_month, int sel_day,
return;
}
- date = date2sec(sel_year, sel_month, sel_day, 0, 0);
+ date = calendar_get_slctd_day_sec();
day_erase_item(date, item_nb, 0);
if (p->type == EVNT) {
re = recur_event_new(p->mesg, p->start, p->evnt_id,
diff --git a/src/recur.h b/src/recur.h
index 1574b93..aca1b3d 100755
--- a/src/recur.h
+++ b/src/recur.h
@@ -1,4 +1,4 @@
-/* $calcurse: recur.h,v 1.11 2007/03/17 16:37:43 culot Exp $ */
+/* $calcurse: recur.h,v 1.12 2007/07/01 17:53:42 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -29,6 +29,7 @@
#include "apoint.h"
#include "notify.h"
+#include "vars.h"
typedef enum { RECUR_NO,
RECUR_DAILY,
@@ -76,34 +77,34 @@ struct recur_event_s {
extern recur_apoint_llist_t *recur_alist_p;
extern struct recur_event_s *recur_elist;
-int recur_apoint_llist_init(void);
-recur_apoint_llist_node_t *recur_apoint_new(char *mesg, long start,
- long duration, char state, int type, int freq, long until,
- struct days_s *except);
-struct recur_event_s *recur_event_new(char *mesg, long day, int id,
- int type, int freq, long until, struct days_s *except);
-char recur_def2char(int define);
-int recur_char2def(char type);
-void recur_write_exc(struct days_s *exc, FILE * f);
-void recur_apoint_write(recur_apoint_llist_node_t *o, FILE * f);
-void recur_event_write(struct recur_event_s *o, FILE * f);
-recur_apoint_llist_node_t *recur_apoint_scan(FILE * f, struct tm start,
- struct tm end, char type, int freq, struct tm until, struct days_s *exc,
- char state);
-struct recur_event_s *recur_event_scan(FILE * f, struct tm start, int id,
- char type, int freq, struct tm until, struct days_s *exc);
-void recur_save_data(FILE *f);
-unsigned recur_item_inday(long item_start, struct days_s *item_exc,
- int rpt_type, int rpt_freq, long rpt_until, long day_start);
-void recur_event_erase(long start, unsigned num, unsigned delete_whole);
-void recur_apoint_erase(long start, unsigned num, unsigned delete_whole);
-void recur_repeat_item(int sel_year, int sel_month, int sel_day,
- int item_nb);
-struct days_s *recur_exc_scan(FILE *data_file);
-struct notify_app_s *recur_apoint_check_next(struct notify_app_s *app,
- long start, long day);
-recur_apoint_llist_node_t *recur_get_apoint(long day, int num);
-struct recur_event_s *recur_get_event(long day, int num);
-void recur_apoint_switch_notify(long date, int recur_nb);
+int recur_apoint_llist_init(void);
+recur_apoint_llist_node_t *recur_apoint_new(char *, long, long, char, int,
+ int, long, struct days_s *);
+struct recur_event_s *recur_event_new(char *, long, int, int, int,
+ long, struct days_s *);
+char recur_def2char(int);
+int recur_char2def(char);
+void recur_write_exc(struct days_s *, FILE *);
+void recur_apoint_write(recur_apoint_llist_node_t *,
+ FILE *);
+void recur_event_write(struct recur_event_s *,
+ FILE *);
+recur_apoint_llist_node_t *recur_apoint_scan(FILE *, struct tm, struct tm,
+ char, int, struct tm, struct days_s *,
+ char);
+struct recur_event_s *recur_event_scan(FILE *, struct tm, int, char,
+ int, struct tm, struct days_s *);
+void recur_save_data(FILE *);
+unsigned recur_item_inday(long, struct days_s *, int,
+ int, long, long);
+void recur_event_erase(long, unsigned, unsigned);
+void recur_apoint_erase(long, unsigned, unsigned);
+void recur_repeat_item(int);
+struct days_s *recur_exc_scan(FILE *);
+struct notify_app_s *recur_apoint_check_next(struct notify_app_s *,
+ long, long);
+recur_apoint_llist_node_t *recur_get_apoint(long, int);
+struct recur_event_s *recur_get_event(long, int);
+void recur_apoint_switch_notify(long, int);
#endif /* CALCURSE_RECUR_H */