summaryrefslogtreecommitdiff
path: root/src/utils.c
AgeCommit message (Collapse)Author
2011-10-06src/utils.c: Support more powerful duration stringsLukas Fleischer
Add support for "1d23h42m"-like duration strings to parse_duration(). Also, switch to using a deterministic finite automaton to parse duration strings, as things tend to get unclear. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06src/utils.c: Remove check_time()Lukas Fleischer
Now that parse_time() and parse_duration() do all the validation work, this isn't used (nor needed) any longer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-10-06src/utils.c: Introduce parse_{time,duration}()Lukas Fleischer
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-06src/utils.c: Mark input string of parse_date() constLukas Fleischer
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-05Do not unlink() note files on note removalLukas Fleischer
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-07-21Refactor out note functionsLukas Fleischer
* 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-10Merge branch 'maint'Lukas Fleischer
2011-07-09Honor "TMPDIR" environment variableLukas Fleischer
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-05Add press_any_key() functionLukas Fleischer
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-02Add shell_exec() functionLukas Fleischer
Can be used to execute an external program in a shell. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02Add child_wait() functionLukas Fleischer
Can be used to wait for the termination of a child process. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02Add fork_exec() functionLukas Fleischer
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-06-29Split line editing functions into separate fileLukas Fleischer
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-07src/utils.c: Make bell() staticLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer
* 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-17Use mem_free() instead of xfree() in check_time().Lukas Fleischer
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-12Fix null pointer dereference in parse_date().Lukas Fleischer
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-05Compare pointers to "NULL" instead of "0".Lukas Fleischer
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03Avoid assignment of undefined value in parse_date().Lukas Fleischer
Spotted by clang-analyzer ("Assigned value is garbage or undefined"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Try to stick to the GNU coding standards for the sake of consistency.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Use upper case for macro names.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14Overall indentation fixes.Lukas Fleischer
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-05Clean up updatestring() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Simplify date_sec2date_fmt() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Clean up and simplify line editing functions.Lukas Fleischer
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-04Remove unnecessary casting variables from get_item_{hour,min}().Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update website links to match the new URL.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update mail addresses to match the new mailing lists.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify date_sec2date_str() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Remove date_sec2hour_str() from "utils.c".Lukas Fleischer
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-04Simplify date2sec() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify check_time() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify print_in_middle() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Reformat erase_window_part() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify get_item_hour() and get_item_min() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify str_toupper() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify file_close() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify now() and nowstr() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03Remove CVS "$Id" headers.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03Fixed file permissions.Lukas Fleischer
2011-01-11Make parse_date accept several short forms.Lukas Fleischer
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.
2010-11-04Added "backword-kill-word" functionality to getstring().Lukas Fleischer
2010-10-23is_all_digit() rewritten.Frederic Culot
Patch submitted by Lukas Fleischer, thanks.
2010-03-21Avoid concurrent screen refreshes.Frederic Culot
2010-03-20All headers gathered into a single one. Typedefs suppressed.Frederic Culot
2009-08-01Start and log daemon activity only if requested.Frederic Culot
2009-07-27Work on allocating and freeing memory associated with user's data for the ↵Frederic Culot
daemon.
2009-07-26--status flag addedFrederic Culot
2009-07-26More work on implementing calcurse daemon.Frederic Culot
2009-07-23Functions added to implement a logging mechanism for calcurse daemon.Frederic Culot