1455 Commits

Author SHA1 Message Date
Lukas Fleischer
1022781821 calcurse-upgrade: Add "-h" and "-v" options
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>
2012-06-01 16:07:48 +02:00
Lukas Fleischer
9be3a9c1f0 scripts/: Add support for placeholders
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>
2012-06-01 16:07:46 +02:00
Lukas Fleischer
2afa0db66f calcurse-upgrade: Error out on unknown option
Display an error message and bail out if an invalid command line option
is passed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 15:51:00 +02:00
Lukas Fleischer
0d50e4539f scripts/calcurse-upgrade.sh: Fix POSIX compatibility
* 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>
2012-06-01 15:50:57 +02:00
Lukas Fleischer
6e490e979c src/sigs.c: Define "_BSD_SOURCE" and "__BSD_VISIBLE"
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>
2012-06-01 11:21:46 +02:00
Lukas Fleischer
8ee853b748 po/: Translation updates from Transifex
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:42:28 +02:00
Lukas Fleischer
0bc63d97ab po/: Add Portuguese (Brazil) translation
Thanks-to: Rafael Ferreira <rafael.f.f1@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:34:00 +02:00
Lukas Fleischer
c9163c92de po/calcurse.pot: Update message catalog
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-01 00:33:49 +02:00
Lukas Fleischer
6139235488 src/custom.c: Mark sidebar help string "no-c-format"
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>
2012-06-01 00:03:58 +02:00
Lukas Fleischer
3e1e82cdeb test/data/conf: Update with recent changes
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>
2012-05-31 22:06:51 +02:00
Baptiste Jonglez
2c5235cca7 Make appearance.calendarview more explicit in config file
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>
2012-05-31 20:45:42 +02:00
Baptiste Jonglez
f7a88a5515 Use our array of available date input formats
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-31 20:42:23 +02:00
Baptiste Jonglez
9adacec623 Provide an array of available date input formats
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>
2012-05-31 20:42:23 +02:00
Baptiste Jonglez
9e1185f526 Give a meaning to DATE_FORMATS
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>
2012-05-31 20:42:15 +02:00
Baptiste Jonglez
7eb3abb08a src/custom.c: Use status_ask_simplechoice()
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>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
72995601e7 Directly use fprintf() where applicable
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>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
4b58b0938f src/day.c: Fix typo
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-31 20:30:46 +02:00
Baptiste Jonglez
4c4d4d3eb3 Use mvwaddstr() instead of mvwprintw()
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>
2012-05-31 20:27:43 +02:00
Lukas Fleischer
bc7c0be84c src/config.c: Bail out on incomplete directive
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>
2012-05-29 21:00:39 +02:00
Baptiste Jonglez
b5a911421f Fix incorrect i18n usage for some strings
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>
2012-05-25 13:28:26 +02:00
Lukas Fleischer
1019be7cce po/POTFILES.in: Add missing source files
We forgot to add these when splitting existing or creating new source
files.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 23:17:03 +02:00
Lukas Fleischer
6898a9dcf1 Do not localize configuration options
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>
2012-05-23 23:09:55 +02:00
Lukas Fleischer
f5efea85a6 Merge branch 'maint'
Conflicts:
	src/io.c
	src/notify.c
	src/utils.c
2012-05-23 22:26:05 +02:00
Lukas Fleischer
7fa1f0e2aa Add localization to calcurse-upgrade
* 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>
2012-05-23 17:25:41 +02:00
Lukas Fleischer
de114ce437 scripts/calcurse-upgrade: Add debug output
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-23 16:41:47 +02:00
Lukas Fleischer
7bec0d47ee scripts/calcurse-upgrade: Add a "--config" option
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>
2012-05-23 16:31:02 +02:00
Lukas Fleischer
61472a32cd scripts/calcurse-upgrade: Set "-e"
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>
2012-05-23 16:12:24 +02:00
Lukas Fleischer
9719de8ea3 Document extended format specifiers
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>
2012-05-23 02:04:59 +02:00
Lukas Fleischer
94a5d4cb1b Fix default time format for multi-day appointments
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>
2012-05-21 12:10:51 +02:00
Lukas Fleischer
cfd8ede2b3 Switch to Linux kernel coding style
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>
2012-05-21 10:13:05 +02:00
Lukas Fleischer
47c52ae7bb src/utils.c: Disable canonical mode in press_any_key()
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>
2012-05-20 17:22:13 +02:00
Lukas Fleischer
b4cefe2db9 Do not localize dates in pcal exports
* 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>
2012-05-19 14:32:43 +02:00
Lukas Fleischer
162b871682 src/notify.c: Fix printf() misuse
Make sure we actually copy the notification warning interval to the
correct buffer instead of printing it to stdout (using an arbitrary
format string). This makes sure the current warning interval is shown
when editing the field and also eliminates a potential format string
vulnerability.

Spotted with "-Wformat-nonliteral".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-19 14:32:43 +02:00
Lukas Fleischer
6c11b8985c Fix data type of "general.firstdayofweek"
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>
2012-05-17 22:08:00 +02:00
Lukas Fleischer
dec97c7c81 doc/manual.txt: Update configuration options
Rename all configuration options in the manual to match the new naming
scheme. Also, update the default values of "general.systemdialogs" and
"general.progressbar".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 22:08:00 +02:00
Lukas Fleischer
7f68083027 Update configuration dialogs
Rename the configuration options shown in the configuration dialogs to
match the new naming scheme used in the configuration file.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 22:07:44 +02:00
Lukas Fleischer
7c7c65d194 Document removal of the "-N" command line option
This option was removed in 6b95f7b67dc8e29072fed4e05efa450422661348.
Update the usage message, the man page and the manual accordingly.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
43282fcbee Document simple format specifiers
Add documentation for "--format"* to the manual and man page. See
commits 7f0c3003ac561a25eeb3c735b32e3ee312ef58c9 etc. for details.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
649231b083 doc/manual.txt: Document motion count prefixes
Displacement commands can be preceded by motion counts since commit
59e006e56d9f893506af56a4ca114fe53b537e49.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
6d88b330f2 doc/manual.txt: Update note file naming scheme
We are now using hash-based note file names instead of mkstemp() (cf.
commit 5c6a00ee93e54cc044aee5146e9fcfbcb732a2ee). Update the
documentation accordingly. Also, add a note on the garbage collector we
added in 8d71923d4f498c8d2fcb22a72346e3e77a7c4a5b.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:04 +02:00
Lukas Fleischer
60ad4adb37 doc/manual.txt: Fix a couple of typos
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-17 17:54:03 +02:00
Lukas Fleischer
49d6e19a6b src/wins.c: Run editor and pager in a shell
This allows for specifying an editor or a pager with additional command
line parameters, such as "vim -e". Instead of interpreting "vim -e" as
an executable file, we leave it to the shell to tokenize and parse the
editor command now.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-16 19:31:48 +02:00
Lukas Fleischer
ce13b70c5a Allow passing additional parameters to shell_exec()
This allows for specifying multiple command line parameters to be passed
on to the command in a way similar to fork_exec(). This is useful if we
want to wrap editor or pager invocations in a shell.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-16 19:31:47 +02:00
Baptiste Jonglez
2951cf8320 Add dummy help for cut and paste
It looks like cutting and pasting are only half-implemented: this only
avoids a segfault when trying to get help on these functions.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:32:18 +02:00
Baptiste Jonglez
d6e551c1a5 Allow resize events while prompting the user
When asking the user to choose between multiple alternatives, properly
handle resize events.

Note that we would also need to do so in getstring()...

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:32:18 +02:00
Baptiste Jonglez
b17475128d Various fixes.
Use snprintf(3) instead of sprintf(3) and fix a missing i18n tag.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:32:18 +02:00
Baptiste Jonglez
13d6f8703b Factorize boolean user prompting.
Introduce a new `status_ask_bool()` function, and use it where
applicable.

This greatly reduces code duplication, and will allow handling special
events (resize, user escape) much more uniformely.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:31:13 +02:00
Baptiste Jonglez
7d4ef08345 Use status_ask_choice() on more difficult cases
These cases are also candidates for the factorisation process, but
they are somewhat more tricky to get right.

Since we use a completely different approach, the result (from a user
perspective) looks different.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:31:13 +02:00
Baptiste Jonglez
1d9c90bb18 Use status_ask_choice() where applicable
These cases make obvious candidates for factorisation.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:31:13 +02:00
Baptiste Jonglez
4087cd4e5e Use status_ask_simplechoice() where applicable
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-14 19:31:13 +02:00