Age | Commit message (Collapse) | Author |
|
We did not setup a thread cleanup procedure which resulted in calcurse
freezing if a thread tried to draw on the screen after another thread
was canceled while locking the screen.
Note that this kind of cleanup handlers should be added to other mutexes
as well. This patch just removes the most common case of triggering a
deadlock.
Also note that we cannot move pthread_cleanup_push() and
pthread_cleanup_pop() into the locking/unlocking functions since both
pthread_cleanup_push() and pthread_cleanup_pop() may be implemented as
macros that must be used in pairs within the same lexical scope.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Lock the screen if either the calendar panel or the notification bar is
updated to avoid race conditions.
Addresses BUG#6.
Note that we currently always use a screen-level lock, even if only one
window is affected. This is to be changed in the future.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
This is kind of useless since users are not able to react to an
auto-save notification. It also causes all kinds of problems if the
status bar is in a non-standard mode (message, prompt, ...) and is prone
to race conditions if the status bar is updated by another thread at the
same time.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Since the result of localtime() is stored in a statically allocated
structure, data was overwritten when a context switch occurred during
(or shortly after) the execution of localtime(), potentially resulting
in critical data corruption. BUG#7 and BUG#8 are likely related.
This patch converts all usages of localtime() with localtime_r(), which
is thread-safe.
Reported-by: Baptiste Jonglez <baptiste@jonglez.org>
Reported-by: Erik Saule <esaule@bmi.osu.edu>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
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>
|
|
* src/utils.c: Only call setlocale() if NLS is enabled.
* src/calcurse.h: Define a fallback macro ngettext() if NLS is disabled.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
* Point out that bug reports should be sent to the bugs mailing list,
not to misc in help and usage messages.
* Call more_info() when displaying the help message instead of
copy-pasting strings to avoid double translation.
Reported-by: rafael ff1 <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Add a missing gettext wrapper. This string should be translated.
Reported-by: rafael ff1 <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Reported-by: rafael ff1 <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Add vim-style key bindings for generic-prev-day, generic-next-day,
generic-prev-week and generic-next-week in a fashion similar to what we
use for generic-*-month and generic-*-year. The key "t"/"T" for
generic-prev-day/generic-next-day is somewhat less than perfect but this
is okay given that we're running out of keys...
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
In addition to generic key bindings for moving one day (week)
forward/backward, define similar bindings for moving a month or a year.
Of course, count prefixes are allowed here as well.
Also add status bar hints and help texts.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
* Rename "LEFT" to "DAY_PREV", "RIGHT" to "DAY_NEXT", "UP" to
"WEEK_PREV" and "DOWN" to "WEEK_NEXT" to reflect the semantics of
these operations. Remove the unneeded "MOVES" element.
* Reorder code to improve consistency.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Make sure the user doesn't end up in a configuration file being totally
broken if the upgrade script fails unexpectedly. The backup file is
removed if the conversion completed successfully.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Instead of bailing out without any hint, show an error message if the
temporary file we use in calcurse-upgrade already exists.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Instead of creating the temporary file in a central location, place it
in the same directory as the configuration file. Pros:
* No need to rely on the "$TMPDIR" environment variable.
* Multiple users can upgrade their configuration files at the same time,
even if "$!" isn't set properly.
* One user can upgrade several configuration files (in different
directories or with different file names) at once.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Add "-h"/"--help" options to print a usage message and "-v"/"--version"
to print the current version.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Allow for specifying placeholders in shell scripts that are replaced
during build time. Predefine a "@PACKAGE_VERSION@" placeholder that is
replaced with the current version number. Also, rename all shell scripts
to ".sh.in".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Display an error message and bail out if an invalid command line option
is passed.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
* Split sed(1) one-liners into multiple lines. POSIX sed(1) doesn't
allow separating functions by semicolons.
* Escape a newline in the awk(1) script. POSIX awk(1) only allows
non-escaped line breaks in specific contexts.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
SIGWINCH isn't POSIX-compatible and causes a compile error on several
platforms, such as OpenBSD:
sigs.c: In function 'generic_hdlr':
sigs.c:63: error: 'SIGWINCH' undeclared (first use in this function)
sigs.c:63: error: (Each undeclared identifier is reported only once
sigs.c:63: error: for each function it appears in.)
sigs.c: In function 'sigs_init':
sigs.c:97: error: 'SIGWINCH' undeclared (first use in this function)
*** Error code 1
Define "_BSD_SOURCE" explicitly in this compilation unit to enforce
definition of the "SIGWINCH" constant. Also, set "__BSD_VISIBLE" to 1
since FreeBSD doesn't honor "_BSD_SOURCE".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Thanks-to: Rafael Ferreira <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
This one was incorrectly detected as C format string due to the literal
percent sign ("%") contained in the message. Add a comment that
explicitly marks it as non-format string to avoid translation issues.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Update the value of "appearance.calendarview" used in the default
configuration file of our test suite (we now use "monthly"/"weekly"
instead of integer values). Late fix for what we broke in commit
2c5235cca70bf1c5b5e92dd5b6b178ab13b695f2.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
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>
|
|
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
This will allow to fix the current hardcoding of strings describing
date input formats in multiple places.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
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>
|
|
This eases up i18n somewhat, since the various date format available
are used on other places as well, and thus need to be translated only
once.
Note that this commit incidentally fixes a small bug introduced by
38912b36: the user was able to set the date input format to a number
between 1 and 5, while there are only 4 such formats available.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
For some reasons, we were using snprintf() to format a string into a
buffer, and then displaying this buffer to stdout using fputs().
That's exactly what fprintf() is here for, so use it.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
When we only want to display a string at a specific place of the
screen, there's no need to use the more complex mvwprintw(), use
mvwaddstr() instead.
This should be slightly more efficient, and, above all, it prevents
weird things to happen if our string contains a '%', being interpreted
as an unwanted format string.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
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>
|
|
Some strings are initialized without wrapping them in _(); instead,
_() is applied on the variable when it is used.
This is incorrect, since these strings don't get added to the catalog.
Fix that by applying _() only once, when the string is declared.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
We forgot to add these when splitting existing or creating new source
files.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
The configuration options shown in the configuration menu are meant to
reflect the keys used in the configuration file. The descriptions
displayed alongside each option should be sufficient for non-English
speakers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Conflicts:
src/io.c
src/notify.c
src/utils.c
|
|
* Use gettext in "scripts/calcurse-upgrade".
* Add "scripts/calcurse-upgrade" to "po/POTFILES.in".
* Rename "scripts/calcurse-upgrade" to "scripts/calcurse-upgrade.sh" to
make sure xgettext(1) detects the correct input file format.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
This allows for specifying an alternate configuration file which is
useful if you use a non-default data directory.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
From the set(1p) man page:
When this option is on, if a simple command fails for any of the
reasons listed in Consequences of Shell Errors or returns an exit
status value >0, and is not part of the compound list following a
while, until, or if keyword, and is not a part of an AND or OR list,
and is not a pipeline preceded by the ! reserved word, then the shell
shall immediately exit.
This allows us to remove all the "|| exit 1" statements we used to bail
out if one command fails.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Add documentation for extended format specifiers (which were introduced
in 68b26ff85415ee687b082fbd5150de58cdce0935) to the man page and the
manual. Add a note about strftime()-style extended formats for
"%(start)" and "%(end)".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
As of commit 0791eaabca0fb1ef8a8675e47d701bbcde4d4a3f, we use strftime()
instead of apoint_sec2str() to format start and end dates of
appointments. "%H:%M" is the default strftime() format string used to
simulate apoint_sec2str(). However, apoint_sec2str() additionally checks
for intersection with the current day and displays "..:.." instead of
the actual time if the item doesn't start (end) at the current day. Add
an additional check to the new default time format and recreate the old
behavior for items starting before or ending after the current day.
Fixes BUG#3.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
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>
|
|
Use tcsetattr() to disable canonical mode in press_any_key() before
waiting for a key press. This makes sure that input is available
immediately (instead of line by line). Also, disable echoing until a key
is pressed.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
* Do not localize the word "week" in pcal export headers.
* Reset current locale before formatting dates in pcal export data.
Addresses BUG#1.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|