summaryrefslogtreecommitdiffstats
path: root/src/config.c
Commit message (Collapse)AuthorAgeFilesLines
* Make the day heading position configurableLars Henriksen2017-09-081-0/+27
| | | | | | | | | The date at the top of the appointments list may be positioned either to the left, in the middle or to the right. Default is to the right. Can be configured from the general options menu. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Make heading in appointments panel configurableLars Henriksen2017-08-281-0/+1
| | | | | | | | Add a new configuration variable format.dayheading to set the format of the date displayed at the top of the event and appointment list. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2017-01-121-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2016-01-301-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Support sending notifications for all appointmentsLukas Fleischer2016-01-271-1/+29
| | | | | | | | | | In 45417bc (Add configuration option to notify all appointments, 2011-07-31), we added an option that allows for choosing whether the user receives notifications only for flagged or only for unflagged appointments. Convert this setting into a three-state option and allow the user to additionally enable notifications for *all* appointments. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Save active view on the todo panelLukas Fleischer2016-01-181-0/+25
| | | | | | | | Add a configuration option appearance.todoview and use it to automatically save the currently active todo panel view and restore it when restarting calcurse. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2015-02-071-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Retain comments in descriptions and config valuesLukas Fleischer2014-08-181-1/+3
| | | | | | | | | Comments should only be stripped if they start at the beginning of a line. We do not want to chop off an TODO item description or a configuration value. Reported-by: HÃ¥kan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* config.c: Rework configuration serializationLukas Fleischer2014-07-221-66/+58
| | | | | | | Avoid preallocating buffers on the stack, use dynamic memory allocation instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor new_tempfile()Lukas Fleischer2014-07-221-11/+11
| | | | | | | | Avoid preallocating buffers on the stack, use dynamic memory allocation instead. Also, change the semantics of new_tempfile() so that it returns the full name of the temporary file and fix all call sites. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Replace several uses of snprintf() by asprintf()Lukas Fleischer2014-07-221-2/+1
| | | | | | | | Use asprintf() in some cold code paths. While allocating memory on the heap is a bit slower, using asprintf() is a bit more memory efficient and less prone to buffer overflow errors. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make sure that tmppath is always NULL-terminatedLukas Fleischer2014-07-081-2/+2
| | | | | | | Fixes GitHub issue #5. Reported-by: dcb314 Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a macro to determine the size of arraysLukas Fleischer2013-05-041-4/+4
| | | | | | | | Use following macro instead of "sizeof(x) / sizeof(x[0])" everywhere: #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use tabs instead of spaces for indentationLukas Fleischer2013-04-141-346/+352
| | | | | | | | | | | This completes our switch to the Linux kernel coding style. Note that we still use deeply nested constructs at some places which need to be fixed up later. Converted using the `Lindent` script from the Linux kernel code base, along with some manual fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix braces in if-else statementsLukas Fleischer2013-02-171-17/+20
| | | | | | | | | | From the Linux kernel coding guidelines: Do not unnecessarily use braces where a single statement will do. [...] This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calendar.c: Rename to "ui-calendar.c"Lukas Fleischer2013-02-141-6/+6
| | | | | | | | | This unit belongs to the presentation layer -- rename the file accordingly. Also, rename calendar_*() to ui_calendar_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2013-02-041-1/+1
| | | | | | | Add 2013 to the copyright range for all source and documentation files. Reported-by: Frederic Culot <frederic@culot.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add compact panels supportLukas Fleischer2012-11-251-0/+1
| | | | | | | | | | | | | Add a configuration option that allows for switching to compact panel mode. In this mode, all window labels are hidden, so that there's more space for actual information. This patch doesn't add a configuration menu entry and doesn't add any documentation. Implements FR#7. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to set a default panelLukas Fleischer2012-11-251-0/+30
| | | | | | | | | | | | | This allows for customizing the panel that is selected by default when calcurse is started. Note that this patch doesn't add any documentation. Also, this configuration option currently cannot be configured using the configuration menu. Implements FR#19. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Fix parsing an unset color themeLukas Fleischer2012-06-301-1/+5
| | | | | | | | | If color support is disabled, the color theme configuration value is set to "0" or "none", which is a value we no longer accepted since commit a5486605696f92a749277d49c77bb5b194dc67a5. Re-introduce the branch that checks for an unset color theme before actually parsing it. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make appearance.calendarview more explicit in config fileBaptiste Jonglez2012-05-311-3/+13
| | | | | | | | | | Instead of using 0 or 1 as a value for `appearance.calendarview`, introduce the more explicit "monthly" and "weekly". Also update `scripts/calcurse-upgrade.sh` to reflect the change. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Give a meaning to DATE_FORMATSBaptiste Jonglez2012-05-311-1/+1
| | | | | | | | | | | It's a bit weird to consider DATE_FORMATS as part of the date input format enum, all the more so as it does not even represent the number of available formats (since those are numbered from 1). Turn DATE_FORMATS into the number of available date input formats. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Bail out on incomplete directiveLukas Fleischer2012-05-291-0/+3
| | | | | | | | | | Fixes a segmentation fault that arose if a line in the configuration file didn't contain a value/key separator ("="). Instead of operating on a NULL pointer, throw an error message containing the erroneous directive and bail out. Reported-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-298/+256
| | | | | | | | | | | | | | Convert our code base to adhere to Linux kernel coding style using Lindent, with the following exceptions: * Use spaces, instead of tabs, for indentation. * Use 2-character indentations (instead of 8 characters). Rationale: We currently have too much levels of indentation. Using 8-character tabs would make huge code parts unreadable. These need to be cleaned up before we can switch to 8 characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix data type of "general.firstdayofweek"Lukas Fleischer2012-05-171-10/+12
| | | | | | | | | | | This option wasn't converted to a proper data type when it was renamed from "week_begins_on_monday" to "general.firstdayofweek". Convert the boolean option into an enumeration type that can take the values "monday" and "sunday". Also, update the documentation, add a conversion rule to the upgrade script and convert the configuration file used in the test suite. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Declare several parameters/variables constantLukas Fleischer2012-05-081-3/+3
| | | | | | | | | | | | Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark several functions staticLukas Fleischer2012-04-201-1/+1
| | | | | | | These are not needed outside of the corresponding compilation units. Spotted with "-Wmissing-prototypes". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix semantics of "general."{systemdialogs,progressbar}Lukas Fleischer2012-03-291-2/+2
| | | | | | | | | These were renamed from "skip_"* to *. However, we only changed syntax and didn't invert their semantic meaning. Fix this by negating the semantics of those variables. Also, negate these in the configuration file automatically when running `calcurse-upgrade`. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Detect legacy configuration filesLukas Fleischer2012-03-291-0/+27
| | | | | | | | | Check configuration variable names against a list of pre-3.0.0 configuration keys and display a warning if such a variable is found. This reduces the chance of users going wild due to the non-backwards compatible configuration file changes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Reorder configuration variablesLukas Fleischer2012-03-291-15/+15
| | | | | | | Sort configuration variables lexicographically. This makes changes easier to locate. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Rename configuration variablesLukas Fleischer2012-03-271-22/+22
| | | | | | | | | | Classify configuration options into different sections. Use consistent names and formatting. This was discussed on the mailing lists. A script that updates configuration files will come in following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use strcmp() instead of strncmp()Lukas Fleischer2012-03-121-2/+2
| | | | | | | | | strncmp() isn't intended to be a secure strcmp() replacement, it is designed to be used if you want to compare the first n characters of two strings. Since we always compare character pointers with string literals, switch to using strcmp() everywhere. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a read-only optionLukas Fleischer2012-02-241-9/+4
| | | | | | | We don't save any configuration nor items if this is set. This should be used with care, and hence there's no short option for this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix up strncat() usageLukas Fleischer2012-02-181-2/+2
| | | | | | | | | | | | | | | The last argument to strncat() should not be the total buffer length; it should be the space remaining: The strncat() function shall append not more than n bytes (a null byte and bytes that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial byte of s2 overwrites the null byte at the end of s1. A terminating null byte is always appended to the result. This patch fixes a couple of potential buffer overflow vulnerabilities. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Add missing configuration variablesLukas Fleischer2012-02-171-15/+42
| | | | | | | Append missing configuration variables to the end of our configuration file instead of keeping them undefined. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Revamp configuration file parsingLukas Fleischer2012-02-171-130/+81
| | | | | | | | | | | | | | | | | | | | | Reintroduce a map for configuration variable parsing. We use a different approach this time: Each map entry contains * a key, * a callback that can be used to parse that variable, * a callback that can be used to serialize that variable and * a target buffer that the parsed value is written to/read from. Commits 4f4891bdb88410ae04225f3d6acfa31d73a3901a and 6377582841118688aee13aff98c9216403582e45 show that we are pretty undecided on using a map or not. However, now that we use parser and serialization wrappers for every variable, having a central map makes everything much cleaner. The runtimes of config_load() and config_save() are slightly increased (by a constant factor). This will also allow us for implementing proper detection of missing configuration variables in the configuration file. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Add more parser/serialization wrappersLukas Fleischer2012-02-171-67/+133
| | | | | | | | | | | | Add convenience parser/serialization wrappers for all configuration variables that don't use the default config_parse_*() and config_serialize_*() helpers yet. This is nothing but a dirty hack and should be refactored later (e.g. by separating configuration variable parsing and validation or by adding optional validation functions). It makes it easier to switch to a more generic configuration parser, though. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Introduce config_parse_str()Lukas Fleischer2012-02-171-13/+14
| | | | | | Be consistent with other parser helpers and with config_serialize_str(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Keep formatting and commentsLukas Fleischer2012-02-171-131/+46
| | | | | | | | | | | | | Switch to using the new config_file_walk() helper in config_save() and update existing configuration variables instead of blindly overwriting the existing configuration file. Note: This breaks configuration setting storage if one or more settings are missing in the configuration file. We need to refactor our parser and serialization routines another time before this can be implemented properly, though. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Add serialization helperLukas Fleischer2012-02-171-53/+184
| | | | | | | Add config_serialize_conf() which can be used to serialize the value of a configuration setting (counterpart to config_parse_conf()). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Add junk callback to config_file_walk()Lukas Fleischer2012-02-161-3/+9
| | | | | | | | | | This can be used if we care about junk, such as empty lines and comments. Currently unused since we skip these when parsing configuration settings. This makes sense if we want to make slight modifications to the configuration file without losing formatting and comments, though. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Make config file reading more flexibleLukas Fleischer2012-02-161-11/+27
| | | | | | | | | | | | | | This adds one level of abstraction to config_load() by splitting out the actual reading routine and the variable setter into two separate functions. config_file_walk() can be used to read the configuration file, strip comments and pass every key/value pair to a callback. config_load_cb() is the new callback used in config_load(). Rationale: It makes sense to reuse the key/value parser to allow for a much saner config_save() routine that changes single values only instead of rewriting (and overwriting) the whole configuration file every time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Drop support for legacy color schemesLukas Fleischer2011-12-121-85/+36
| | | | | | | | | We used different naming schemes in versions prior to 1.8. Given that calcurse 1.8 has been released more than 4.5 years ago, remove the legacy code that still handles these. Users upgrading from <1.8 to 3.0.0 might need to convert the appropriate config file variable manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/config.c: Remove map for configuration variablesLukas Fleischer2011-12-091-169/+114
| | | | | | | | | | This patch kind of reverts what we did in commit 6377582841118688aee13aff98c9216403582e45. We were a tad off-base there since using a map doesn't improve maintainability, really. Using strcmp() at a central location seems perfectly fine and doesn't have the overhead of the map scanning algorithm. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Extract config file handlers into a separate fileLukas Fleischer2011-12-091-0/+583
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>