193 Commits

Author SHA1 Message Date
Lukas Fleischer
ce3f0ce76f Make use of the NULL macro
Use this constant everywhere when referring to a null pointer instead of
casting 0 to various types of pointers. Created using following semantic
patch:

    @@
    type type;
    @@

    - (type *)0
    + NULL

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-11-02 19:33:23 +01:00
Lukas Fleischer
7cc6305588 Do not cast unused return values to void
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>
2011-11-02 18:32:17 +01:00
Lukas Fleischer
44bc9605d6 Avoid use of printf()/fprintf()
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>
2011-11-02 18:31:10 +01:00
Lukas Fleischer
2bf0249338 Avoid unnecessary start time calculations
Rename recur_*_inday() to recur_*_find_occurrence() and use the new
functions whenever we actually care about the start time of an
occurrence.

Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and
pass NULL as start time buffer (which means "skip start time
calculation"). Keep using these when we only want to know if a recurrent
item belongs to a specific day but do not care about the actual start
time.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-21 08:58:54 +02:00
Lukas Fleischer
146877a7da Use LLIST_{,TS}_FIND_FOREACH_CONT where appropriate
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:34:59 +02:00
Lukas Fleischer
718a6cfee4 Add command line argument to run the GC manually
Adds a "-g" option that allows for running the garbage collector for
note files manually. This is useful for users that do not use note files
at all or rarely edit/remove them.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-05 12:25:48 +02:00
Lukas Fleischer
78b663d073 Merge branch 'maint'
Conflicts:
	src/io.c
2011-09-06 14:56:17 +02:00
Lukas Fleischer
b59070a49e Rework indentation code in print_notefile()
Do not use snprintf() here as printf() behaviour is undefined if the
destination pointer is used as a parameter.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-08-26 12:14:03 +02:00
Lukas Fleischer
0884d62b22 Merge branch 'maint' 2011-07-30 22:56:22 +02:00
Lukas Fleischer
13a41f8e0a Fix sort order in app_arg()
We used to iterate over the list of regular appointments and the list of
recurrent appointments in separate loops, thus leading to recurrent
appointments being printed first and regular appointments being printed
afterwards, regardless of their start and end times. Merge these loops
to coerce precedence of the start time.

There's still a fair bit of hackery in here - we will fix that later.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-30 21:10:53 +02:00
Lukas Fleischer
f2ddce23d4 src/args.c: Mark various constant strings const
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:42:44 +02:00
Lukas Fleischer
7b0d017b5d Remove superfluous buffer variable from version_arg()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:42:44 +02:00
Lukas Fleischer
5637e973bf Remove superfluous buffer variable from help_arg()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:42:44 +02:00
Lukas Fleischer
54813eef19 Merge branch 'maint' 2011-07-28 13:38:12 +02:00
Lukas Fleischer
0c4e9d3f00 Invoke vars_init() before importing data with "-i"
We forgot to call vars_init() when importing an item using the "-i"
command line argument, which led to the pager configuration variable
being unset and hence the pager invocation (triggered to show the log in
case there are any errors during import) failing.

Fix this by calling vars_init() before io_import_data().

Reported-by: Andraž 'ruskie' Levstik <ruskie@codemages.net>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-28 13:36:30 +02:00
Lukas Fleischer
1355bad264 Declare foreground and background variables global
Removes the need to pass the terminal's default background color round.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-21 17:56:39 +02:00
Lukas Fleischer
38865b8e48 Update copyright notices in source files, documentation and "COPYING".
* 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>
2011-04-22 07:26:05 +02:00
Lukas Fleischer
cbd66b13b1 Use "event" structure when iterating over events in app_arg().
Regression introduced in commit
5b174ba5d46c256f41c1cfb952d46f49a088db8a.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:37 +02:00
Lukas Fleischer
9fab24818a Use generic lists for recurring apointments and events.
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>
2011-04-19 11:42:35 +02:00
Lukas Fleischer
bf431d6cd9 Use generic lists for todo items.
Use the new generic list implementation instead of "next" pointers in
todo items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
6f883c0f3f Use generic lists for events.
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>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
77ef3fe76e Use generic lists for appointments.
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>
2011-04-19 11:42:33 +02:00
Lukas Fleischer
6fb0f6f4c6 Compare pointers to "NULL" instead of "0".
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-05 09:27:04 +02:00
Lukas Fleischer
5b12c236cf Remove dead assignments spotted by clang-analyzer.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03 22:09:00 +02:00
Lukas Fleischer
9c9fd5da15 Overall indentation fixes.
Use spaces instead of tabs for source code indentation only, strip
trailing whitespaces from lines.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14 19:03:53 +01:00
Lukas Fleischer
c22dcaf6be Update website links to match the new URL.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:49 +01:00
Lukas Fleischer
73e9649387 Update mail addresses to match the new mailing lists.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:40 +01:00
Lukas Fleischer
91c9cac898 Remove CVS "$Id" headers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03 16:19:45 +01:00
Lukas Fleischer
56b9cbcb84 Fixed file permissions. 2011-03-03 12:21:16 +01:00
Lukas Fleischer
c8af480f52 Make parse_date accept several short forms.
Short forms are only accepted in interactive mode (e.g. when using the
"Go to" function, editing a recurrent item's end date, and so on).

Samples: "1/1/30" for "01/01/2030", "26" for the 26th of the currently
selected month/year or "3/1" for Mar 01 (or Jan 03, depending on the
date format) of the currently selected year.
2011-01-11 22:10:48 +00:00
Frederic Culot
142b1cfbc1 Copyright updated. 2010-05-26 18:18:28 +00:00
Frederic Culot
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00
Frederic Culot
df75c2754a Also check for notes directory. 2009-11-01 11:19:14 +00:00
Frederic Culot
9ac8389823 Check for data directory availability added (thanks Brandon for reporting this bug). 2009-11-01 11:06:37 +00:00
Frederic Culot
246d73ef15 Help on --status flag added 2009-08-02 07:22:50 +00:00
Frederic Culot
bccd37ef96 --status flag added 2009-07-26 20:26:14 +00:00
Frederic Culot
aef6f012fe Check for file presence added (thanks again Chris for reporting it). 2009-07-26 12:30:23 +00:00
Frederic Culot
a93d88c370 Dates are now written properly again when using the '-r' flag (thanks Chris again for your report). 2009-07-15 19:16:21 +00:00
Frederic Culot
d374a2ec2e bugfix: import and export todo items again! 2009-07-12 18:16:11 +00:00
Frederic Culot
5694955002 stdbool header removed, unsigned type used instead 2009-07-12 16:21:57 +00:00
Frederic Culot
27b25548a4 Switch to BSD license. 2009-07-05 20:33:13 +00:00
Frederic Culot
9dce4c534e Support added for regex-based searches. Many thanks Erik for providing the patch. 2009-07-05 17:23:06 +00:00
Frederic Culot
6d67689b4f Simplified the way data are loaded and saved. 2009-06-28 09:53:16 +00:00
Frederic Culot
68381c95df Help updated for the -t command line flag. 2009-06-28 07:30:11 +00:00
Frederic Culot
ea107cfd81 Ability to flag todo items as completed. 2009-06-26 21:44:11 +00:00
Frederic Culot
1775eb3245 Do not print todo items twice if the -d and -t flags are given (thanks Timo for reporting this bug). 2009-06-26 19:56:31 +00:00
Frederic Culot
dfa4c580aa Make the argument given to -r or -s flags optional. 2009-06-23 09:05:15 +00:00
Frederic Culot
3ece481999 Copyright date updated 2009-06-20 17:59:04 +00:00
Frederic Culot
87f010ff06 bugfix: load keys even in non-interactive mode to avoid the loss of user-configured key bindings 2009-01-24 18:45:35 +00:00
Frederic Culot
936b6fe373 more code cleanup 2009-01-03 21:32:10 +00:00