125 Commits

Author SHA1 Message Date
Lukas Fleischer
0acbc06c43 src/utils.c: Introduce parse_{time,duration}()
These helpers can be used in a fashion similar to parse_date(). In
addition to check_time(), parse_time() and parse_duration() support
short forms such as "23:" (instead of "23:00") and ":45" (instead of
"00:45").

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
162c6aebdd src/utils.c: Mark input string of parse_date() const
We don't mess about with the date string here, so it should be declared
const.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
6c7edfbb86 Do not unlink() note files on note removal
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>
2011-10-05 12:25:47 +02:00
Lukas Fleischer
87664095cd Refactor out note functions
* Add new note_edit() and note_view() helper functions. Use these
  instead of copy-pasted code in *_note_edit().

* Move all note-related functions (note_edit(), note_view(),
  note_erase()) to a new source file "note.c".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-21 18:13:40 +02:00
Lukas Fleischer
160f12687e Merge branch 'maint' 2011-07-10 19:04:49 +02:00
Lukas Fleischer
34f094312f Honor "TMPDIR" environment variable
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>
2011-07-09 17:52:25 +02:00
Lukas Fleischer
b0b994896c Add press_any_key() function
Displays "Press any key to continue..." in shell terminal mode and waits
for a key stroke.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-05 16:04:33 +02:00
Lukas Fleischer
7982c98be4 Add shell_exec() function
Can be used to execute an external program in a shell.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02 10:15:36 +02:00
Lukas Fleischer
7e61b3de06 Add child_wait() function
Can be used to wait for the termination of a child process.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02 10:15:36 +02:00
Lukas Fleischer
6e2b00096d Add fork_exec() function
Can be used to execute an external program. Provides the possibility to
optionally create a pipe to the new process.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02 10:15:36 +02:00
Lukas Fleischer
edc20ba443 Split line editing functions into separate file
Move getstring() related stuff into a separate file as a first step on
our way to UTF-8 support for line editing helpers.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-29 15:43:44 +02:00
Lukas Fleischer
4e6e3a9c97 src/utils.c: Make bell() static
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-07 09:33:50 +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
7758a41851 Use mem_free() instead of xfree() in check_time().
xfree() should never be used directly and only be called by one of the
mem_*() wrappers.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-17 20:42:47 +02:00
Lukas Fleischer
3a4431e568 Fix null pointer dereference in parse_date().
Passing a date in format "mm-dd-yy" where short forms are not allowed
would lead to a null pointer dereference here. This one fixes that.
Spotted by clang-analyzer.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:39 +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
1473145d10 Avoid assignment of undefined value in parse_date().
Spotted by clang-analyzer ("Assigned value is garbage or undefined").

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03 21:31:32 +02:00
Lukas Fleischer
84d1daf41d Try to stick to the GNU coding standards for the sake of consistency.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15 10:52:38 +01:00
Lukas Fleischer
d6e5347340 Use upper case for macro names.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15 10:23:41 +01: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
0e5a9f1620 Clean up updatestring() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05 17:49:27 +01:00
Lukas Fleischer
a778706791 Simplify date_sec2date_fmt() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05 17:30:35 +01:00
Lukas Fleischer
6f425dc1fa Clean up and simplify line editing functions.
This greatly simplifies all line editing functions - especially
getstring() and showstring(). showcursor() is removed and integrated
into showstring(). del_char() and add_char() are simplified as well.
add_char() is renamed to ins_char().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05 17:18:21 +01:00
Lukas Fleischer
9dad482ad8 Remove unnecessary casting variables from get_item_{hour,min}().
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 14:36:48 +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
d42d07ef69 Simplify date_sec2date_str() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 10:12:27 +01:00
Lukas Fleischer
fdcfd74823 Remove date_sec2hour_str() from "utils.c".
date_sec2hour_str() is superseded by date_sec2date_str() with "%H:%M" as
date format string, so replace all invocations and remove that function
from "utils.c".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 10:08:02 +01:00
Lukas Fleischer
082e7d4b98 Simplify date2sec() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 10:01:23 +01:00
Lukas Fleischer
8b34a0e0fd Simplify check_time() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 09:51:04 +01:00
Lukas Fleischer
0d12a788ad Simplify print_in_middle() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 09:28:18 +01:00
Lukas Fleischer
4b8558ed47 Reformat erase_window_part() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 09:21:08 +01:00
Lukas Fleischer
65fb1ff8b1 Simplify get_item_hour() and get_item_min() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 09:17:21 +01:00
Lukas Fleischer
061f74108b Simplify str_toupper() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 08:54:01 +01:00
Lukas Fleischer
05900b62e9 Simplify file_close() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 08:46:04 +01:00
Lukas Fleischer
1fc9c69e43 Simplify now() and nowstr() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 08:43:37 +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
Lukas Fleischer
b8779e714a Added "backword-kill-word" functionality to getstring(). 2010-11-04 10:55:07 +00:00
Frederic Culot
1a6cdeab55 is_all_digit() rewritten.
Patch submitted by Lukas Fleischer, thanks.
2010-10-23 10:25:53 +00:00
Frederic Culot
6892b59622 Avoid concurrent screen refreshes. 2010-03-21 10:17:03 +00:00
Frederic Culot
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00
Frederic Culot
55d6703fad Start and log daemon activity only if requested. 2009-08-01 17:53:11 +00:00
Frederic Culot
b45a8bfbb4 Work on allocating and freeing memory associated with user's data for the daemon. 2009-07-27 19:35:09 +00:00
Frederic Culot
bccd37ef96 --status flag added 2009-07-26 20:26:14 +00:00
Frederic Culot
3d23af73c0 More work on implementing calcurse daemon. 2009-07-26 12:47:15 +00:00
Frederic Culot
ade0470197 Functions added to implement a logging mechanism for calcurse daemon. 2009-07-23 18:33:20 +00:00
Frederic Culot
b55cad85da Beginning of work on implementing calcurse daemon. 2009-07-20 19:45:26 +00:00
Frederic Culot
834a7e9aaf New wrappers around memory functions. 2009-07-12 17:48:12 +00:00