summaryrefslogtreecommitdiffstats
path: root/src/io.c
Commit message (Collapse)AuthorAgeFilesLines
* Extract config file handlers into a separate fileLukas Fleischer2011-12-091-142/+1
| | | | | | | | We used custom_load_conf() to load the configuration file and io_save_conf() to save configuration. Move these functions, including all helpers, to a central location. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2011-11-151-2/+5
|\
| * src/io.c: Avoid use of memcpy()Lukas Fleischer2011-11-111-2/+4
| | | | | | | | | | | | | | | | Use strncpy() and a proper limit, which ensures we never read more characters than the buffer can hold. Also, ensure we always null-terminate strings here. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * src/io.c: Null-terminate the ical_readline() bufferLukas Fleischer2011-11-111-0/+1
| | | | | | | | | | | | | | Ensure we always return with a null-terminated buffer, even if we read more than BUFSIZ characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use a global configuration variableLukas Fleischer2011-11-141-28/+26
| | | | | | | | | | | | | | This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-11-111-1/+7
|\| | | | | | | | | | | Conflicts: src/calcurse.h src/io.c
| * Cleanup joinable threads on terminationLukas Fleischer2011-10-041-1/+4
| | | | | | | | | | | | | | Always invoke pthread_join() when we blow up a thread via pthread_cancel() (avoid zombie threads). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * src/io.c: Update todo item count on iCal importLukas Fleischer2011-10-041-0/+3
| | | | | | | | | | | | | | Update the number of todo items when importing an iCal file to prevent some items from being inaccessible. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove parentheses from return statementsLukas Fleischer2011-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not cast unused return values to voidLukas Fleischer2011-11-021-268/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid use of printf()/fprintf()Lukas Fleischer2011-11-021-115/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use one of the following functions where appropriate: * puts() (whenever we print hard coded strings to stdout) * fputs() (whenever we print hard coded strings to a stream) * putchar() (whenever we print a single character to stdout) * fputc() (whenever we print a single character to a stream) * strncpy() (whenever we copy hard coded strings to a buffer) This removes the overhead introduced by the format string parser and reduces the number of false positive C-format strings spotted by xgettext(1)'s heuristics. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Pass item durations to recur_item_inday()Lukas Fleischer2011-10-211-2/+2
| | | | | | | | | | | | | | | | Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to run the GC on exitLukas Fleischer2011-10-051-0/+5
| | | | | | | | | | | | | | | | If "auto_gc" is enabled, the garbage collector for note files will be run on every exit. As this is an experimental feature and may cause data loss, this is disabled by default. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not unlink() note files on note removalLukas Fleischer2011-10-051-3/+3
| | | | | | | | | | | | | | | | | | | | Now that we use hash-based note file names, note files should never be unlinked as a note file might be shared. Also, remove the ERASE_FORCE_KEEP_NOTE flag that no longer makes any sense. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use hash-based file names in ical_read_note()Lukas Fleischer2011-10-051-14/+9
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Accept variable length note namesLukas Fleischer2011-10-051-4/+4
| | | | | | | | | | | | | | | | Read up to the first blank in note_read() instead of assuming a fixed-width note file name. Accept everything up to 40 characters (which is the length of a SHA1 hash in hexadecimal representation). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out note deserializationLukas Fleischer2011-10-051-8/+2
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add a copy file routineLukas Fleischer2011-10-051-0/+33
| | | | | | | | | | | | | | | | Add io_file_cp() which can be used to copy an existing source file to another location. We will need this for our new hash-based note file names. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-09-061-112/+69
|\| | | | | | | | | Conflicts: src/io.c
| * src/io.c: iCal content line folding correctnessLukas Fleischer2011-08-261-112/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather invasive change that introduces correct line folding to our iCal parser. From now on, ical_readline() should be used instead of fgets() to read lines from an iCal file as it unfolds lines automatically. We also need to use shared buffers as each ical_readline() invocation eats up the first part of the next line and stores it in the "lstore" buffer. Subsequent ical_readline() invocations copy the contents of this buffer and append continuation lines. We currently use a single buffer pair that is allocated in io_import_data() and pass it to all subroutines. ical_readline_init() needs to be called once for every buffer pair. It reads the first part of the current line and writes to "lstore", clearing the target buffer at the same time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to notify all appointmentsLukas Fleischer2011-07-311-0/+4
| | | | | | | | | | | | | | | | If "notify-all" is enabled, all non-flagged appointments will be notified (instead of flagged ones). This is useful for users that want to be notified of everything. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-07-281-2/+2
|\|
| * io.c: Accept resource parameters in iCal importLukas Fleischer2011-07-281-2/+2
| | | | | | | | | | | | | | | | | | Remove colons from the "SUMMARY:" and "DURATION:" search patterns in ical_read_event() to allow for additional parameters (such as language parameters, cf. RFC 5545). Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use gettext plural featuresLukas Fleischer2011-07-241-6/+8
| | | | | | | | | | | | | | | | Make use of the plural features of gettext to handle plural forms correctly instead of using the plural form even if the singular form should be used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Split stats messages in io_import_data()Lukas Fleischer2011-07-241-10/+12
| | | | | | | | | | | | | | | | Use separate format strings for separate values. This is useful in case we want to output similar stats somewhere else and is a preparation for supporting plural forms. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use single-line configuration settings by defaultLukas Fleischer2011-07-151-22/+23
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Skip indentation and comments in io_extract_data()Lukas Fleischer2011-07-151-1/+2
| | | | | | | | | | | | | | | | We actually only use this function to parse configuration data. Currently, this probably is the best way to do some common preprocessing. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove artificial delay when saving dataLukas Fleischer2011-07-141-3/+0
| | | | | | | | | | | | | | | | This doesn't contribute to functionality or usability in any way. Keep the progress bar option but only show bars as long as the actual save operation is in progress. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-07-101-2/+4
|\|
| * Honor "TMPDIR" environment variableLukas Fleischer2011-07-091-2/+4
| | | | | | | | | | | | | | | | | | Replace all hardcoded paths referring to "/tmp" with a new function that honors the "TMPDIR" environment variable as well as P_tmpdir and uses "/tmp" as a fallback. Thanks-to: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out todo item serializationLukas Fleischer2011-07-021-4/+1
|/ | | | | | | | Add a todo_write() function that allows one to serialize todo items and write serialized data to an output stream in a fashion similar to apoint_write() and event_write(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Return -1 in io_file_is_empty() if file cannot be accessed.Lukas Fleischer2011-04-221-1/+1
| | | | | | | Ensure files don't appear as empty if fopen() fails (e.g. on temporary EACCES failures). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for recurring item exceptions.Lukas Fleischer2011-04-221-53/+50
| | | | | | | | | Rename "days" structure to "excp" which seems to be a better name here. Use generic linked lists of excp structures instead of using the "days" structure which again contains a linked list implementation. Do some cleanups and invocation fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for recurring apointments and events.Lukas Fleischer2011-04-191-58/+67
| | | | | | | | Use them instead of "recur_apoint_list" and "next" pointers in "recur_event" type variables. Includes some code simplifications and cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for todo items.Lukas Fleischer2011-04-191-14/+17
| | | | | | | Use the new generic list implementation instead of "next" pointers in todo items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for events.Lukas Fleischer2011-04-191-10/+16
| | | | | | | Use the new generic list implementation instead of those insane "next" pointers in events. Includes some cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for appointments.Lukas Fleischer2011-04-191-18/+25
| | | | | | | Use the new generic list implementation instead of "apoint_list" everywhere. Simplify stuff and drop unused variables as well. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix io_file_is_empty() behaviour when file starts with a newline.Lukas Fleischer2011-04-121-1/+1
| | | | | | | Read second byte if the first byte is a newline character to ensure the file doesn't contain any further data. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Drop empty notes after editing.Lukas Fleischer2011-04-121-0/+25
| | | | | | | | | Keeping empty notes doesn't make sense here. Also, there doesn't seem to be a simple way to erase notes yet. This will make calcurse delete any notes that are empty (meaning that they are either 0-byte files or contain nothing but a newline character) when returning from the editor. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Compare pointers to "NULL" instead of "0".Lukas Fleischer2011-04-051-25/+25
| | | | | | "bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* ignore the lock file if the pointed process is dead.Erik Saule2011-03-291-8/+24
| | | | | | Lukas: Small formatting and logic changes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-274/+274
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update mail addresses to match the new mailing lists.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Simplify str_toupper() in "utils.c".Lukas Fleischer2011-03-041-22/+21
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove CVS "$Id" headers.Lukas Fleischer2011-03-031-2/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fixed file permissions.Lukas Fleischer2011-03-031-0/+0
|
* Avoid concurrent screen refreshes.Frederic Culot2010-03-211-6/+6
|
* More work on sidebar customization.Frederic Culot2010-03-211-1/+6
|