diff options
author | Frederic Culot <calcurse@culot.org> | 2008-01-17 19:35:42 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2008-01-17 19:35:42 +0000 |
commit | 54c2b6004102de55c8ebed7d9ce5f1ece7eeb449 (patch) | |
tree | 32c7ed579f07b957f7fe931d935585e2f49fd43e | |
parent | 738a3a417071bfaed53297cbefad39b996e55dfb (diff) | |
download | calcurse-54c2b6004102de55c8ebed7d9ce5f1ece7eeb449.zip |
minor improvements and bugfixes
-rwxr-xr-x | ChangeLog | 6 | ||||
-rwxr-xr-x | src/day.c | 27 | ||||
-rwxr-xr-x | src/io.c | 12 | ||||
-rwxr-xr-x | src/utils.c | 5 |
4 files changed, 35 insertions, 15 deletions
@@ -1,3 +1,9 @@ +17 Jan 2008: + exit_calcurse() improved: screen is now cleared completely when + calcurse exits + io_export_data() improved: it is now possible to cancel calendar export + bugfix in day_edit_item(): null-terminating character missing + 13 Jan 2008: Ability to attach notes to appointments and events added @@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.32 2008/01/13 12:40:45 culot Exp $ */ +/* $calcurse: day.c,v 1.33 2008/01/17 19:35:42 culot Exp $ */ /* * Calcurse - text-based organizer @@ -432,7 +432,8 @@ day_write_pad(long date, int width, int length, int incolor) } /* Display an item inside a popup window. */ -void day_popup_item(void) +void +day_popup_item(void) { char *error = _("FATAL ERROR in day_popup_item: unknown item type\n"); @@ -452,7 +453,9 @@ void day_popup_item(void) * Need to know if there is an item for the current selected day inside * calendar. This is used to put the correct colors inside calendar panel. */ -int day_check_if_item(date_t day) { +int +day_check_if_item(date_t day) +{ struct recur_event_s *re; recur_apoint_llist_node_t *ra; struct event_s *e; @@ -490,8 +493,8 @@ int day_check_if_item(date_t day) { } /* Update an existing item. */ -static void update_item(long date, int item_num, struct day_item_s *p, - struct rpt_s *rpt) +static void +update_item(long date, int item_num, struct day_item_s *p, struct rpt_s *rpt) { recur_apoint_llist_node_t *ra_new; @@ -546,10 +549,11 @@ day_edit_time(long time) void day_edit_item(void) { -#define STRT '1' -#define END '2' -#define DESC '3' -#define REPT '4' +#define SINGLECHAR 2 +#define STRT '1' +#define END '2' +#define DESC '3' +#define REPT '4' struct day_item_s *p; struct recur_event_s *re; @@ -666,8 +670,9 @@ day_edit_item(void) while ( (ch != 'D') && (ch != 'W') && (ch != 'M') && (ch != 'Y') ) { status_mesg(mesg_type_1, mesg_type_2); - typestr = (char *)malloc(sizeof(char) * 2); - *typestr = recur_def2char(rpt->type); + typestr = (char *)malloc(sizeof(char) * SINGLECHAR); + snprintf(typestr, SINGLECHAR, "%c", + recur_def2char(rpt->type)); cancel = updatestring(win[STA].p, &typestr, 0, 1); ch = toupper(*typestr); free(typestr); @@ -1,4 +1,4 @@ -/* $calcurse: io.c,v 1.25 2008/01/13 12:40:45 culot Exp $ */ +/* $calcurse: io.c,v 1.26 2008/01/17 19:35:42 culot Exp $ */ /* * Calcurse - text-based organizer @@ -126,6 +126,7 @@ io_get_export_stream(void) _("The file cannot be accessed, please enter another file name."); char *press_enter = _("Press [ENTER] to continue."); + int cancel; stream = NULL; stream_name = (char *)malloc(BUFSIZ); @@ -136,7 +137,11 @@ io_get_export_stream(void) while (stream == NULL) { status_mesg(question, ""); - updatestring(win[STA].p, &stream_name, 0, 1); + cancel = updatestring(win[STA].p, &stream_name, 0, 1); + if (cancel) { + free(stream_name); + return (NULL); + } stream = fopen(stream_name, "w"); if (stream == NULL) { status_mesg(wrong_name, press_enter); @@ -841,6 +846,9 @@ io_export_data(export_mode_t mode, conf_t *conf) /* NOTREACHED */ } + if (stream == NULL) + return; + io_export_header(stream); if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE) diff --git a/src/utils.c b/src/utils.c index 22cda23..0e9cc4d 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $calcurse: utils.c,v 1.39 2008/01/13 12:40:45 culot Exp $ */ +/* $calcurse: utils.c,v 1.40 2008/01/17 19:35:42 culot Exp $ */ /* * Calcurse - text-based organizer @@ -45,7 +45,8 @@ void exit_calcurse(int status) { endwin(); - erase(); + clear(); + refresh(); calendar_stop_date_thread(); exit(status); } |