aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rwxr-xr-xsrc/utils.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c
index d2963a5..22cda23 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,8 +1,8 @@
-/* $calcurse: utils.c,v 1.38 2007/12/30 16:27:59 culot Exp $ */
+/* $calcurse: utils.c,v 1.39 2008/01/13 12:40:45 culot Exp $ */
/*
* Calcurse - text-based organizer
- * Copyright (c) 2004-2007 Frederic Culot
+ * Copyright (c) 2004-2008 Frederic Culot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -900,3 +900,20 @@ new_tempfile(const char *prefix, int trailing_len)
return (strdup(fullname + prefix_len));
}
+
+/* Erase a note previously attached to a todo, event or appointment. */
+void
+erase_note(char **note)
+{
+ char fullname[BUFSIZ];
+
+ if (*note == NULL)
+ ierror(_("FATAL ERROR in erase_note: null pointer!\n"),
+ IERROR_FATAL);
+ snprintf(fullname, BUFSIZ, "%s%s", path_notes, *note);
+ if (unlink(fullname) != 0)
+ ierror(_("FATAL ERROR in erase_note: could not remove note\n"),
+ IERROR_FATAL);
+ free(*note);
+ *note = NULL;
+}