aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix memory leak by freeing linked lists in recurrence rulesMax Kunzelmann2024-01-261-2/+12
| | | | | | | | | | | | The function responsible for freeing a recurring appointment or event did not free the linked lists contained in the `struct rpt` holding the recurrence rules. This led to memory leaks if a user had recurring appointments or events. Found with ASAN. Signed-off-by: Max Kunzelmann <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix memory leak in keys initializationMax Kunzelmann2024-01-261-30/+61
| | | | | | | | | | | | | | Previous to this commit, a strdup took place for every key name including those that were replaced with customized key names later on while never calling free on the pointer returned by strdup. This fix only calls strdup for key names that are not replaced with custom key names. Found with ASAN. Signed-off-by: Max Kunzelmann <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix out of bounds memory access (off by one)Max Kunzelmann2023-12-141-1/+1
| | | | | | | | | | | | If fgets reads a line that only contains a `\n`, then the pointer `eol` will point to the first byte in that buffer. The subsequent dereference of `*(eol -1 )` will access the byte before that buffer. This fix makes sure that that length of the current line read by fgets is at least 2 bytes long. Signed-off-by: Max Kunzelmann <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* add missing call to `va_end()` for copied `va_list`Max2023-11-061-0/+1
| | | | | | | | | The man page stdarg(3) states that each invocation of `va_copy()` must be matched by a corresponding invocation of `va_end()` in the same function. Signed-off-by: Max <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* correctness: kill returns -1 on errorMax2023-11-061-1/+1
| | | | | Signed-off-by: Max <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* remove unnecessary set of sidebar widthMax2023-11-061-2/+0
| | | | | | | | | | | When the function is called, `col` is zero, which leads to setting the sidebar width (in percent) to zero. As the variable holding the percentage is `static unsigned sbarwidth_perc` it is initialized to zero anyway and we set the percentage later to the value loaded from the configuration, too. Signed-off-by: Max <max@mxzero.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix segmentation fault when exporting ical fileBenedikt Wildenhain2023-11-051-1/+2
| | | | | | | | | | | | If a note file gets accidently deleted this leads to ical_export_note trying to execute fclose(NULL) which leads to a segmentation fault on current Debian GNU/Linux using libc6 (according to fclose's manpage, the behaviour is undefined in this case). The fix tests whether fopen returned a non-NULL-pointer before trying to close it. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix characters in weekly viewLukas Fleischer2023-04-151-6/+5
| | | | | | Fixes GitHub issue #441. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright ranges for 2023Lukas Fleischer2023-04-1140-41/+41
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix segfault when importing iCal filesMarian Buschsieweke2023-04-111-0/+8
| | | | | | | | Previously, events / appointments without a description resulted in a segfault. This provides a trivial fix by adding an `<emtpy>` as description in this case. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Check that note files open before reading themNicholas Johnson2023-01-312-0/+13
| | | | | | | | | | | This fixes the scenario where a note file referenced by a todo, event, or appointment is modified from outside the program in such a way that it cannot be opened by the program, resulting in a segmentation fault. The least surprising way to proceed is to ignore the note. Signed-off-by: Nicholas Johnson <nick@nicksphere.ch> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix handling of recurrent open-ended appointments at 00:00Lukas Fleischer2023-01-011-7/+13
| | | | | | | | | Prior to this commit, a recurrent appointment ending at 00:00 on a given day was not considered to span the day. This is the correct behavior for all cases, except appointments without end time (both starting and ending at midnight on a given day). Handle this edge case explicitly. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend default description to all item typesLukas Fleischer2022-12-252-17/+24
| | | | | | | | | | Show default description "(empty description)" for all types of items (appointments, events, recurring appointments/events, TODOs). Follow-up to 7b350ac (Add text for displaying empty event description, 2022-06-21). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add text for displaying empty event descriptionJonathan van der Steege2022-12-252-2/+8
| | | | | Signed-off-by: Jonathan van der Steege <jonathan@jonakeys.nl> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Layout change recognizes changed appointment spaceMorgan Seltzer2022-04-034-66/+72
| | | | | | | | | | | Before a layout change did not update the maximum number of appointments visible, until the config menu was exited. Now the maximum number of appointments are visible immediately after the layout screen is exited. Addresses GitHub issue #381 Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Allow newlines in SUMMARY by replacing them with blanksLars Henriksen2022-03-191-6/+3
| | | | | | Addresses Github issue #414 (Android calendar allows them). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright ranges for 2022Lukas Fleischer2022-03-1140-41/+41
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix compiler warning in SHA1 implementationLukas Fleischer2022-03-111-1/+1
| | | | | | | | | Update the signature of sha1_final() to fix the following warning: sha1.c:208:43: warning: argument 2 of type ‘uint8_t[20]’ {aka ‘unsigned char[20]’} with mismatched bound [-Warray-parameter=] Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix SHA1 calculation on big-endian systemsLukas Fleischer2022-03-111-0/+1
| | | | | | | | | Add the AC_C_BIGENDIAN macro to determine endianness and set WORDS_BIGENDIAN accordingly. Fixes GitHub issue #397. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make Home/End keys work as expected in text input modenobody2021-08-071-0/+2
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* First day of week can now be any dayMorgan Seltzer2021-08-073-10/+16
| | | | | | | | | | | | | Previously only Sunday and Monday were allowed as the first day of the week, and this was internally treated as a binary variable. This patch allows for users to change the first day of the week to any day. Addresses GitHub feature request #321. Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Backend changes for first day of weekMorgan Seltzer2021-08-076-81/+82
| | | | | | | | | | | | | Previously only Sunday and Monday were allowed for the first day of the week, and was internally treated as a binary variable. This patch changes the backend so all days are accepted, a future patch will allow users to actually select other days. Addresses GitHub feature request #321. Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fixed sidebar config sometime not increasing widthMorgan Seltzer2021-08-072-1/+3
| | | | | | | | | | | | | | The sidebar has a numerical mimumum width that is statically defined, and users may set the width of the sidebar in config by incrementing the percentage of the screen between this minimum and a maximum value of 50%. However, internally the mimimum percentage could be set as low as zero, and while that did not decrease the sidebar size below the numerical minimum width, did mean that between 0 and the mimimum width increasing the percentage had no visual effect to indicate change. Now the mimimum percent is not decremented below the mimimum width. Signed-off-by: Morgan Seltzer <MorganSeltzer000@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Allow configuration of appointment time formatmercurialmoon2021-04-115-8/+32
| | | | | | | | | | Added the option to configure the format in which appointment time is displayed. The setting is called "format.appointmenttime" under the general settings menu. Setting defaults to previous behavior, which was "%H:%M". Signed-off-by: mercurialmoon <mercurialmoon@protonmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add generic-prev-view key bindingAurora2021-04-115-0/+27
| | | | | | | This can be used to cycle backwards through windows (similarly to generic-change-view). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Allow undefined actions in keys configuration fileLars Henriksen2021-04-115-252/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the keys file there are three possibilities for each action: 1. One or several keys are assigned to it 2. It is marked as UNDEFINED (new) 3. It is missing from the file On load of the keys file, calcurse respectively 1. Assigns the key(s) 2. Assigns "UNDEFINED" (new) 3. Assigns a default key if possible If default keys were assigned, the user is informed of the number of actions affected, and the keys file is updated. After load each action must either have keys assigned or be undefined. If not, calcurse exits with a failure. If there are syntax/semantic errors in the file, calcurse rejects the file and exits. When an interactive user leaves the keys configuration menu, a warning is issued if any action is UNDEFINED. The keys file is always updated. Addresses GitHub issue #298. Additionally: Description of concepts and data structures used for keyboard keys and virtual keys (actions) as well as name changes and comments to improve readability. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Call setsid() for hook/notification commandsLukas Fleischer2021-04-047-12/+19
| | | | | | | | | We do not want hook or notification commands to interact with the terminal in any way. Create a new session for them. Addresses GitHub issue #326. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Redirect standard descriptors for hook/notify commandsLukas Fleischer2021-04-043-26/+11
| | | | | | | | | | | | | Disconnect stdin, stdout and stderr when running an external hook or notification command. The previous solution of appending "<&- >&- 2>&-" to the shell command line does not work if the command includes pipes. Use shell_exec() in notify_launch_cmd() instead of a custom (and incomplete) reimplementation of that command. Partially addresses GitHub issue #326. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add parameter to redirect stderr to shell_exec()Lukas Fleischer2021-04-046-18/+37
| | | | | | | Add a function parameter to allows redirecting stderr in addition to stdin and stdout. The parameter will be used with a follow-up change. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Todo resort() optimizationLars Henriksen2021-01-311-3/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Keep a linked list sortedLars Henriksen2021-01-163-59/+148
| | | | | | | | | | | | | | | | | | | | | | | | A general linked list function, llist_reorder(), is introduced that will reorder a list after a list element has changed. Some refactoring to avoid code dupliction. Background The four linked lists of appointment panel items (appointments, recurring appointments, events, recurring events) are kept sorted by inserting elements in order, either when they are first loaded from disk or when new are added. The ordering is by start time (numerical) and description (alphabetical). The user is allowed to change start time as well as description. A change is committed directly to the list item (unlike cut/paste where an item is deleted and then inserted). This may break the order. The order property is used when events are loaded from the evenlist into the day_item vector, see LLIST_FIND_FOREACH_CONT, and when looking for the next upcoming appointment, see apoint_check_next(). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* docs: fix simple typo, mulitple -> multipleTim Gates2020-12-191-1/+1
| | | | | | | | There is a small typo in src/wins.c. Should read `multiple` rather than `mulitple`. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve performance of recur_prev_occurrence()Lars Henriksen2020-12-193-13/+19
| | | | | | | And fix item start day for prev command Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Introduce macro DAYLars Henriksen2020-12-198-39/+32
| | | | | | | DAY(t) is midnight (the day) of time_t t. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix parsing of UNTIL in iCal importLars Henriksen2020-12-191-3/+10
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not remove an empty note file after edit sessionLars Henriksen2020-11-154-21/+4
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Avoid double free on iCal import errorsLukas Fleischer2020-11-071-2/+13
| | | | | | | Set pointers to NULL after calling free() to prevent double free on cleanup. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Return failure if import skips any itemLars Henriksen2020-11-073-8/+13
| | | | | | | | | Other items may have been imported succesfully. Adresses Github issue #323, last part. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make iCal event import independent of property orderingLars Henriksen2020-11-071-122/+135
| | | | | | | | | | Refactoring of ical.c: properties DTSTART, DTEND, DURATION, RRULE and EXDATE are saved and only processed after encountering END:VEVENT. Adresses Github issue #323, follow-up question. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Use dynamically allocated string in struct io_fileLukas Fleischer2020-10-112-2/+3
| | | | | | Avoid using fixed-size buffers and strncpy(). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Implemented rendering of notes in events/appts as wellAmbika Eshwar2020-10-111-4/+38
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Implemented rendering of notes in todo viewAmbika Eshwar2020-10-113-1/+33
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix memory leak in run_hook()Lukas Fleischer2020-10-111-4/+5
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Redesign the item deletion menuLukas Fleischer2020-10-111-58/+66
| | | | | | | | | | | | | | | | | | | Instead of the previous inconsistent and potentially nested menus, the following message is now displayed when deleting an item: Delete (s)elected occurrence, (a)ll occurrences, or only the (n)ote? Options that are not available (e.g. because the item is not recurrent or does not have a note) are omitted. For a non-recurrent item without a note the message becomes Delete (s)elected occurrence? and is skipped if general.confirmdelete is disabled. Implements GitHub feature request #308. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add p(revious) commandLars Henriksen2020-10-113-3/+74
| | | | | | | | | | The p(rev) command finds the previous occurrence of a recurrent item, analogous to the n(ext) command. A bug in the next command is corrected.. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Replace 'ical_rpt_t' with 'struct rpt'Lars Henriksen2020-10-071-113/+71
| | | | | | | | Refactoring and simplification only, no functional change. All error checking and logging done before call of ical_store_event/apoint(). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Always exit with failure in case of option parsing errorsLars Henriksen2020-10-071-14/+9
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend icalendar exportLars Henriksen2020-08-261-82/+219
| | | | | | | | Export now covers advanced recurrence rules and properties imported to a note file. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update use of note file for importLars Henriksen2020-08-261-62/+8
| | | | | | | | | | | Removes the parts of commit 'Extend use of note file for ical import' that relate to STATUS. The STATUS property is (partly) supported for todos already. Corrects insertion of a separator: always insert it before imported properties (also when there is no description). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve event text for cancelled periodic saveLars Henriksen2020-07-261-1/+2
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>