aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-01-17 19:35:42 +0000
committerFrederic Culot <calcurse@culot.org>2008-01-17 19:35:42 +0000
commit54c2b6004102de55c8ebed7d9ce5f1ece7eeb449 (patch)
tree32c7ed579f07b957f7fe931d935585e2f49fd43e
parent738a3a417071bfaed53297cbefad39b996e55dfb (diff)
downloadcalcurse-54c2b6004102de55c8ebed7d9ce5f1ece7eeb449.tar.gz
calcurse-54c2b6004102de55c8ebed7d9ce5f1ece7eeb449.zip
minor improvements and bugfixes
-rwxr-xr-xChangeLog6
-rwxr-xr-xsrc/day.c27
-rwxr-xr-xsrc/io.c12
-rwxr-xr-xsrc/utils.c5
4 files changed, 35 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 10af4c4..9e401fc 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/src/day.c b/src/day.c
index 052bda2..13f1bdf 100755
--- a/src/day.c
+++ b/src/day.c
@@ -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);
diff --git a/src/io.c b/src/io.c
index 4cce160..ad9f445 100755
--- a/src/io.c
+++ b/src/io.c
@@ -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);
}