From 738a3a417071bfaed53297cbefad39b996e55dfb Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sun, 13 Jan 2008 12:40:45 +0000 Subject: Ability to attach notes to appointments and events added --- src/utils.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/utils.c') 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; +} -- cgit v1.2.3-54-g00ecf