summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/calcurse.h1
-rw-r--r--src/io.c5
-rw-r--r--src/todo.c9
3 files changed, 11 insertions, 4 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index 315f8e1..e18d754 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -827,6 +827,7 @@ int todo_hilt_pos (void);
char *todo_saved_mesg (void);
void todo_new_item (void);
struct todo *todo_add (char *, int, char *);
+void todo_write (struct todo *, FILE *);
void todo_flag (void);
void todo_delete (struct conf *);
void todo_chg_priority (int);
diff --git a/src/io.c b/src/io.c
index f82de50..2588a29 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1023,10 +1023,7 @@ io_save_todo (void)
LLIST_FOREACH (&todolist, i)
{
struct todo *todo = LLIST_TS_GET_DATA (i);
- if (todo->note)
- (void)fprintf (fp, "[%d]>%s %s\n", todo->id, todo->note, todo->mesg);
- else
- (void)fprintf (fp, "[%d] %s\n", todo->id, todo->mesg);
+ todo_write (todo, fp);
}
file_close (fp, __FILE_POS__);
diff --git a/src/todo.c b/src/todo.c
index a6b5687..935109f 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -183,6 +183,15 @@ todo_add (char *mesg, int id, char *note)
return todo;
}
+void
+todo_write (struct todo *todo, FILE *f)
+{
+ if (todo->note)
+ (void)fprintf (f, "[%d]>%s %s\n", todo->id, todo->note, todo->mesg);
+ else
+ (void)fprintf (f, "[%d] %s\n", todo->id, todo->mesg);
+}
+
/* Delete a note previously attached to a todo item. */
static void
todo_delete_note_bynum (unsigned num)