summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Makefile.am40
-rwxr-xr-xsrc/apoint.c79
-rwxr-xr-xsrc/apoint.h101
-rwxr-xr-xsrc/args.c57
-rwxr-xr-xsrc/args.h45
-rwxr-xr-xsrc/calcurse.c25
-rw-r--r--src/calcurse.h919
-rwxr-xr-xsrc/calendar.c58
-rwxr-xr-xsrc/calendar.h137
-rwxr-xr-xsrc/custom.c130
-rwxr-xr-xsrc/custom.h104
-rwxr-xr-xsrc/day.c130
-rwxr-xr-xsrc/day.h97
-rw-r--r--src/dmon.c16
-rw-r--r--src/dmon.h45
-rwxr-xr-xsrc/event.c39
-rwxr-xr-xsrc/event.h67
-rwxr-xr-xsrc/help.c32
-rwxr-xr-xsrc/help.h54
-rwxr-xr-xsrc/i18n.h67
-rwxr-xr-xsrc/io.c171
-rwxr-xr-xsrc/io.h95
-rwxr-xr-xsrc/keys.c58
-rwxr-xr-xsrc/keys.h140
-rw-r--r--src/mem.c30
-rw-r--r--src/mem.h81
-rwxr-xr-xsrc/notify.c41
-rwxr-xr-xsrc/notify.h88
-rwxr-xr-xsrc/recur.c140
-rwxr-xr-xsrc/recur.h135
-rwxr-xr-xsrc/sigs.c9
-rwxr-xr-xsrc/sigs.h47
-rwxr-xr-xsrc/todo.c51
-rwxr-xr-xsrc/todo.h74
-rwxr-xr-xsrc/utils.c32
-rwxr-xr-xsrc/utils.h163
-rwxr-xr-xsrc/vars.c22
-rwxr-xr-xsrc/vars.h177
-rwxr-xr-xsrc/wins.c109
-rwxr-xr-xsrc/wins.h100
40 files changed, 1512 insertions, 2493 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 950b3b5..d00d84c 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,29 +1,29 @@
-# $calcurse: Makefile.am,v 1.10 2009/07/20 19:44:05 culot Exp $
+# $calcurse: Makefile.am,v 1.11 2010/03/20 10:54:41 culot Exp $
AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= calcurse
calcurse_SOURCES= \
- calcurse.c i18n.h htable.h \
- apoint.c apoint.h \
- args.c args.h \
- calendar.c calendar.h \
- custom.c custom.h \
- day.c day.h \
- event.c event.h \
- help.c help.h \
- io.c io.h \
- keys.c keys.h \
- notify.c notify.h \
- recur.c recur.h \
- sigs.c sigs.h \
- todo.c todo.h \
- utils.c utils.h \
- vars.c vars.h \
- wins.c wins.h \
- mem.c mem.h \
- dmon.c dmon.h
+ calcurse.c calcurse.h htable.h \
+ apoint.c \
+ args.c \
+ calendar.c \
+ custom.c \
+ day.c \
+ event.c \
+ help.c \
+ io.c \
+ keys.c \
+ notify.c \
+ recur.c \
+ sigs.c \
+ todo.c \
+ utils.c \
+ vars.c \
+ wins.c \
+ mem.c \
+ dmon.c
LDADD= @LTLIBINTL@
diff --git a/src/apoint.c b/src/apoint.c
index 91c7885..9f24542 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,9 +1,9 @@
-/* $calcurse: apoint.c,v 1.37 2009/07/19 08:20:00 culot Exp $ */
+/* $calcurse: apoint.c,v 1.38 2010/03/20 10:54:41 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,24 +41,14 @@
#include <sys/types.h>
#include <time.h>
-#include "i18n.h"
-#include "vars.h"
-#include "event.h"
-#include "day.h"
-#include "custom.h"
-#include "notify.h"
-#include "recur.h"
-#include "keys.h"
-#include "calendar.h"
-#include "mem.h"
-#include "apoint.h"
-
-apoint_llist_t *alist_p;
-static apoint_llist_node_t bkp_cut_apoint;
-static int hilt;
+#include "calcurse.h"
+
+struct apoint_list *alist_p;
+static struct apoint bkp_cut_apoint;
+static int hilt;
void
-apoint_free_bkp (erase_flag_e flag)
+apoint_free_bkp (enum eraseflg flag)
{
if (bkp_cut_apoint.mesg)
{
@@ -69,7 +59,7 @@ apoint_free_bkp (erase_flag_e flag)
}
static void
-apoint_dup (apoint_llist_node_t *in, apoint_llist_node_t *bkp)
+apoint_dup (struct apoint *in, struct apoint *bkp)
{
EXIT_IF (!in || !bkp, _("null pointer"));
@@ -84,7 +74,7 @@ apoint_dup (apoint_llist_node_t *in, apoint_llist_node_t *bkp)
void
apoint_llist_init (void)
{
- alist_p = (apoint_llist_t *) mem_malloc (sizeof (apoint_llist_t));
+ alist_p = mem_malloc (sizeof (struct apoint_list));
alist_p->root = NULL;
pthread_mutex_init (&(alist_p->mutex), NULL);
}
@@ -97,7 +87,7 @@ apoint_llist_init (void)
void
apoint_llist_free (void)
{
- apoint_llist_node_t *o, **i;
+ struct apoint *o, **i;
i = &alist_p->root;
while (*i)
@@ -137,12 +127,12 @@ apoint_hilt (void)
return (hilt);
}
-apoint_llist_node_t *
+struct apoint *
apoint_new (char *mesg, char *note, long start, long dur, char state)
{
- apoint_llist_node_t *o, **i;
+ struct apoint *o, **i;
- o = (apoint_llist_node_t *) mem_malloc (sizeof (apoint_llist_node_t));
+ o = mem_malloc (sizeof (struct apoint));
o->mesg = mem_strdup (mesg);
o->note = (note != NULL) ? mem_strdup (note) : NULL;
o->state = state;
@@ -280,7 +270,7 @@ apoint_add (void)
/* Delete an item from the appointment list. */
void
-apoint_delete (conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
+apoint_delete (struct conf *conf, unsigned *nb_events, unsigned *nb_apoints)
{
char *choices = "[y/n] ";
char *del_app_str = _("Do you really want to delete this item ?");
@@ -398,7 +388,7 @@ apoint_paste (unsigned *nb_events, unsigned *nb_apoints, int cut_item_type)
}
unsigned
-apoint_inday (apoint_llist_node_t *i, long start)
+apoint_inday (struct apoint *i, long start)
{
if (i->start <= start + DAYINSEC && i->start + i->dur > start)
{
@@ -408,8 +398,7 @@ apoint_inday (apoint_llist_node_t *i, long start)
}
void
-apoint_sec2str (apoint_llist_node_t *o, int type, long day, char *start,
- char *end)
+apoint_sec2str (struct apoint *o, int type, long day, char *start, char *end)
{
struct tm *lt;
time_t t;
@@ -433,7 +422,7 @@ apoint_sec2str (apoint_llist_node_t *o, int type, long day, char *start,
}
void
-apoint_write (apoint_llist_node_t *o, FILE *f)
+apoint_write (struct apoint *o, FILE *f)
{
struct tm *lt;
time_t t;
@@ -461,7 +450,7 @@ apoint_write (apoint_llist_node_t *o, FILE *f)
(void)fprintf (f, "%s\n", o->mesg);
}
-apoint_llist_node_t *
+struct apoint *
apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note)
{
char buf[BUFSIZ], *newline;
@@ -491,10 +480,10 @@ apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note)
}
/* Retrieve an appointment from the list, given the day and item position. */
-apoint_llist_node_t *
+struct apoint *
apoint_get (long day, int pos)
{
- apoint_llist_node_t *o;
+ struct apoint *o;
int n;
n = 0;
@@ -513,11 +502,11 @@ apoint_get (long day, int pos)
}
void
-apoint_delete_bynum (long start, unsigned num, erase_flag_e flag)
+apoint_delete_bynum (long start, unsigned num, enum eraseflg flag)
{
unsigned n;
int need_check_notify = 0;
- apoint_llist_node_t *i, **iptr;
+ struct apoint *i, **iptr;
n = 0;
pthread_mutex_lock (&(alist_p->mutex));
@@ -623,10 +612,10 @@ apoint_scroll_pad_up (int nb_events_inday)
* Look in the appointment list if we have an item which starts before the item
* stored in the notify_app structure (which is the next item to be notified).
*/
-struct notify_app_s *
-apoint_check_next (struct notify_app_s *app, long start)
+struct notify_app *
+apoint_check_next (struct notify_app *app, long start)
{
- apoint_llist_node_t *i;
+ struct apoint *i;
pthread_mutex_lock (&(alist_p->mutex));
for (i = alist_p->root; i != 0; i = i->next)
@@ -653,15 +642,15 @@ apoint_check_next (struct notify_app_s *app, long start)
}
/*
- * Returns a structure of type apoint_llist_t given a structure of type
+ * Returns a structure of type struct apoint_list given a structure of type
* recur_apoint_s
*/
-apoint_llist_node_t *
-apoint_recur_s2apoint_s (recur_apoint_llist_node_t *p)
+struct apoint *
+apoint_recur_s2apoint_s (struct recur_apoint *p)
{
- apoint_llist_node_t *a;
+ struct apoint *a;
- a = (apoint_llist_node_t *) mem_malloc (sizeof (apoint_llist_node_t));
+ a = mem_malloc (sizeof (struct apoint));
a->mesg = mem_strdup (p->mesg);
a->start = p->start;
a->dur = p->dur;
@@ -674,8 +663,8 @@ apoint_recur_s2apoint_s (recur_apoint_llist_node_t *p)
void
apoint_switch_notify (void)
{
- apoint_llist_node_t *apoint;
- struct day_item_s *p;
+ struct apoint *apoint;
+ struct day_item *p;
long date;
int apoint_nb = 0, n, need_chk_notify;
@@ -733,7 +722,7 @@ apoint_update_panel (int which_pan)
int app_width = win[APP].w - bordr;
int app_length = win[APP].h - bordr - title_lines;
long date;
- date_t slctd_date;
+ struct date slctd_date;
/* variable inits */
slctd_date = *calendar_get_slctd_day ();
diff --git a/src/apoint.h b/src/apoint.h
deleted file mode 100755
index 7e92e99..0000000
--- a/src/apoint.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $calcurse: apoint.h,v 1.20 2009/08/01 20:28:55 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_APOINT_H
-#define CALCURSE_APOINT_H
-
-#include "utils.h"
-#include "notify.h"
-#include "recur.h"
-#include "vars.h"
-
-#define HRMIN_SIZE 6
-
-typedef struct apoint_llist_node
-{
- struct apoint_llist_node *next;
- long start; /* seconds since 1 jan 1970 */
- long dur; /* duration of the appointment in seconds */
-
-#define APOINT_NULL 0x0
-#define APOINT_NOTIFY 0x1 /* Item needs to be notified */
-#define APOINT_NOTIFIED 0x2 /* Item was already notified */
- char state; /* 8 bits to store item state */
-
- char *mesg;
- char *note;
-}
-apoint_llist_node_t;
-
-typedef struct apoint_llist
-{
- apoint_llist_node_t *root;
- pthread_mutex_t mutex;
-}
-apoint_llist_t;
-
-extern apoint_llist_t *alist_p;
-
-void apoint_free_bkp (erase_flag_e);
-void apoint_llist_init (void);
-void apoint_llist_free (void);
-void apoint_hilt_set (int);
-void apoint_hilt_decrease (void);
-void apoint_hilt_increase (void);
-int apoint_hilt (void);
-apoint_llist_node_t *apoint_new (char *, char *, long, long, char);
-void apoint_add (void);
-void apoint_delete (conf_t *, unsigned *, unsigned *);
-int apoint_cut (unsigned *, unsigned *);
-void apoint_paste (unsigned *, unsigned *, int);
-unsigned apoint_inday (apoint_llist_node_t *, long);
-void apoint_sec2str (apoint_llist_node_t *, int, long, char *,
- char *);
-void apoint_write (apoint_llist_node_t *, FILE *);
-apoint_llist_node_t *apoint_scan (FILE *, struct tm, struct tm, char, char *);
-apoint_llist_node_t *apoint_get (long, int);
-void apoint_delete_bynum (long, unsigned, erase_flag_e);
-void apoint_scroll_pad_down (int, int);
-void apoint_scroll_pad_up (int);
-struct notify_app_s *apoint_check_next (struct notify_app_s *, long);
-apoint_llist_node_t *apoint_recur_s2apoint_s (recur_apoint_llist_node_t *);
-void apoint_switch_notify (void);
-void apoint_update_panel (int);
-void apoint_paste_item (void);
-
-#endif /* CALCURSE_APOINT_H */
diff --git a/src/args.c b/src/args.c
index e974b66..a8c7fd9 100755
--- a/src/args.c
+++ b/src/args.c
@@ -1,9 +1,9 @@
-/* $calcurse: args.c,v 1.61 2009/11/01 11:19:14 culot Exp $ */
+/* $calcurse: args.c,v 1.62 2010/03/20 10:54:42 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,20 +45,7 @@
#include <time.h>
#include <regex.h>
-#include "i18n.h"
-#include "custom.h"
-#include "utils.h"
-#include "args.h"
-#include "event.h"
-#include "apoint.h"
-#include "day.h"
-#include "todo.h"
-#include "mem.h"
-#include "io.h"
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "calcurse.h"
/*
* Print Calcurse usage and exit.
@@ -257,7 +244,7 @@ print_notefile (FILE *out, char *filename, int nbtab)
static void
todo_arg (int priority, int print_note, regex_t *regex)
{
- struct todo_s *i;
+ struct todo *i;
int title = 1;
char *titlestr, priority_str[BUFSIZ] = "";
char *all_todos_title = _("to do:\n");
@@ -313,7 +300,7 @@ todo_arg (int priority, int print_note, regex_t *regex)
static void
next_arg (void)
{
- struct notify_app_s next_app;
+ struct notify_app next_app;
const long current_time = now ();
int time_left, hours_left, min_left;
char mesg[BUFSIZ];
@@ -342,7 +329,7 @@ next_arg (void)
* Print the date on stdout.
*/
static void
-arg_print_date (long date, conf_t *conf)
+arg_print_date (long date, struct conf *conf)
{
char date_str[BUFSIZ];
time_t t;
@@ -362,18 +349,18 @@ arg_print_date (long date, conf_t *conf)
* If regex is not null, only the matching appointments or events are printed.
*/
static int
-app_arg (int add_line, date_t *day, long date, int print_note, conf_t *conf,
- regex_t *regex)
+app_arg (int add_line, struct date *day, long date, int print_note,
+ struct conf *conf, regex_t *regex)
{
- struct recur_event_s *re;
- struct event_s *j;
- recur_apoint_llist_node_t *ra;
- apoint_llist_node_t *i;
+ struct recur_event *re;
+ struct event *j;
+ struct recur_apoint *ra;
+ struct apoint *i;
long today;
unsigned print_date = 1;
int app_found = 0;
- char apoint_start_time[100];
- char apoint_end_time[100];
+ char apoint_start_time[HRMIN_SIZE];
+ char apoint_end_time[HRMIN_SIZE];
if (date == 0)
today = get_sec_date (*day);
@@ -445,7 +432,7 @@ app_arg (int add_line, date_t *day, long date, int print_note, conf_t *conf,
if (recur_item_inday (ra->start, ra->exc, ra->rpt->type, ra->rpt->freq,
ra->rpt->until, today))
{
- apoint_llist_node_t *apt;
+ struct apoint *apt;
if (regex && regexec (regex, ra->mesg, 0, 0, 0) != 0)
continue;
@@ -531,10 +518,10 @@ more_info (void)
*/
static void
display_app (struct tm *t, int numdays, int add_line, int print_note,
- conf_t *conf, regex_t *regex)
+ struct conf *conf, regex_t *regex)
{
int i, app_found;
- date_t day;
+ struct date day;
for (i = 0; i < numdays; i++)
{
@@ -554,11 +541,11 @@ display_app (struct tm *t, int numdays, int add_line, int print_note,
* days.
*/
static void
-date_arg (char *ddate, int add_line, int print_note, conf_t *conf,
+date_arg (char *ddate, int add_line, int print_note, struct conf *conf,
regex_t *regex)
{
int i;
- date_t day;
+ struct date day;
int numdays = 0, num_digit = 0;
int arg_len = 0, app_found = 0;
static struct tm t;
@@ -618,7 +605,7 @@ date_arg (char *ddate, int add_line, int print_note, conf_t *conf,
*/
static void
date_arg_extended (char *startday, char *range, int add_line, int print_note,
- conf_t *conf, regex_t *regex)
+ struct conf *conf, regex_t *regex)
{
int i, numdays = 1, error = 0, arg_len = 0;
static struct tm t;
@@ -677,7 +664,7 @@ date_arg_extended (char *startday, char *range, int add_line, int print_note,
* routines to handle those arguments. Also initialize the data paths.
*/
int
-parse_args (int argc, char **argv, conf_t *conf)
+parse_args (int argc, char **argv, struct conf *conf)
{
int ch, add_line = 0;
int unknown_flag = 0, app_found = 0;
@@ -954,7 +941,7 @@ parse_args (int argc, char **argv, conf_t *conf)
}
else if (aflag)
{
- date_t day;
+ struct date day;
io_check_file (path_apts, (int *)0);
io_check_file (path_conf, (int *)0);
diff --git a/src/args.h b/src/args.h
deleted file mode 100755
index 9c77835..0000000
--- a/src/args.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $calcurse: args.h,v 1.10 2009/07/05 20:33:15 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2007 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-
-#ifndef CALCURSE_ARGS_H
-#define CALCURSE_ARGS_H
-
-int parse_args (int, char **, conf_t *);
-
-#endif /* CALCURSE_ARGS_H */
diff --git a/src/calcurse.c b/src/calcurse.c
index ee9ac7d..ab3febf 100755
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -1,9 +1,9 @@
-/* $calcurse: calcurse.c,v 1.86 2009/08/24 18:59:17 culot Exp $ */
+/* $calcurse: calcurse.c,v 1.87 2010/03/20 10:54:42 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,22 +38,7 @@
#include <stdlib.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include "i18n.h"
-#include "io.h"
-#include "help.h"
-#include "custom.h"
-#include "utils.h"
-#include "sigs.h"
-#include "day.h"
-#include "todo.h"
-#include "args.h"
-#include "notify.h"
-#include "keys.h"
-#include "dmon.h"
+#include "calcurse.h"
/*
* Calcurse is a text-based personal organizer which helps keeping track
@@ -65,8 +50,8 @@
int
main (int argc, char **argv)
{
- conf_t conf;
- day_items_nb_t inday;
+ struct conf conf;
+ struct day_items_nb inday;
int background, foreground;
int non_interactive;
int no_data_file = 1;
diff --git a/src/calcurse.h b/src/calcurse.h
new file mode 100644
index 0000000..8af1166
--- /dev/null
+++ b/src/calcurse.h
@@ -0,0 +1,919 @@
+/* $Id: calcurse.h,v 1.1 2010/03/20 10:54:42 culot Exp $ */
+
+/*
+ * Calcurse - text-based organizer
+ *
+ * Copyright (c) 2010 Frederic Culot <frederic@culot.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Send your feedback or comments to : calcurse@culot.org
+ * Calcurse home page : http://culot.org/calcurse
+ *
+ */
+
+#ifndef CALCURSE_H
+#define CALCURSE_H
+
+#include "config.h"
+
+#ifdef HAVE_NCURSES_H
+# include <ncurses.h>
+#elif defined HAVE_NCURSES_NCURSES_H
+# include <ncurses/ncurses.h>
+#elif defined HAVE_NCURSESW_NCURSES_H
+# include <ncursesw/ncurses.h>
+#else
+# error "Missing ncurses header. Aborting..."
+#endif
+
+#include <pthread.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "htable.h"
+
+/* Internationalization. */
+#if ENABLE_NLS
+# include <locale.h>
+# include <libintl.h>
+# undef _
+# define _(String) gettext(String)
+# ifdef gettext_noop
+# define N_(String) gettext_noop(String)
+# else
+# define N_(String) (String)
+# endif
+#else /* NLS disabled */
+# define _(String) (String)
+# define N_(String) (String)
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(String) (String)
+# define dcgettext(String) (String)
+# define bindtextdomain(String) (String)
+# define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+#endif /* ENABLE_NLS */
+
+/* Memory debugging functions. */
+#ifdef CALCURSE_MEMORY_DEBUG
+# define mem_malloc(s) dbg_malloc ((s), __FILE_POS__)
+# define mem_calloc(n, s) dbg_calloc ((n), (s), __FILE_POS__)
+# define mem_realloc(p, n, s) dbg_realloc ((p), (n), (s), __FILE_POS__)
+# define mem_strdup(s) dbg_strdup ((s), __FILE_POS__)
+# define mem_free(p) dbg_free ((p), __FILE_POS__)
+#else /* MEMORY DEBUG disabled */
+# define mem_malloc(s) xmalloc ((s))
+# define mem_calloc(n, s) xcalloc ((n), (s))
+# define mem_realloc(p, n, s) xrealloc ((p), (n), (s))
+# define mem_strdup(s) xstrdup ((s))
+# define mem_free(p) xfree ((p))
+# define mem_stats()
+#endif /* CALCURSE_MEMORY_DEBUG */
+
+/* Paths configuration. */
+#define DIR_NAME ".calcurse/"
+#define TODO_PATH_NAME "todo"
+#define APTS_PATH_NAME "apts"
+#define CONF_PATH_NAME "conf"
+#define KEYS_PATH_NAME "keys"
+#define CPID_PATH_NAME ".calcurse.pid"
+#define DPID_PATH_NAME ".daemon.pid"
+#define DLOG_PATH_NAME "daemon.log"
+#define NOTES_DIR_NAME "notes/"
+
+#define TODO_PATH DIR_NAME TODO_PATH_NAME
+#define APTS_PATH DIR_NAME APTS_PATH_NAME
+#define CONF_PATH DIR_NAME CONF_PATH_NAME
+#define KEYS_PATH DIR_NAME KEYS_PATH_NAME
+#define CPID_PATH DIR_NAME CPID_PATH_NAME
+#define DLOG_PATH DIR_NAME DLOG_PATH_NAME
+#define DPID_PATH DIR_NAME DPID_PATH_NAME
+#define NOTES_DIR DIR_NAME NOTES_DIR_NAME
+
+#define ATTR_FALSE 0
+#define ATTR_TRUE 1
+#define ATTR_LOWEST 2
+#define ATTR_LOW 3
+#define ATTR_MIDDLE 4
+#define ATTR_HIGH 5
+#define ATTR_HIGHEST 6
+
+#define STATUSHEIGHT 2
+#define NOTESIZ 6
+
+/* Format for appointment hours is: HH:MM */
+#define HRMIN_SIZE 6
+
+/* Maximum number of colors available. */
+#define NBUSERCOLORS 6
+
+/* Related to date manipulation. */
+#define DAYINSEC 86400
+#define HOURINSEC 3600
+#define MININSEC 60
+#define YEARINDAYS 365
+#define YEARINMONTHS 12
+#define WEEKINDAYS 7
+#define TM_YEAR_BASE 1900
+
+/* Calendar window. */
+#define CALHEIGHT 12
+#define CALWIDTH 30
+
+/* Key definitions. */
+#define CTRLVAL 0x1F
+#define CTRL(x) ((x) & CTRLVAL)
+#define ESCAPE 27
+#define TAB 9
+#define SPACE 32
+
+#define KEYS_KEYLEN 3 /* length of each keybinding */
+#define KEYS_LABELEN 8 /* length of command description */
+#define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */
+
+#define ERROR_MSG(...) do { \
+ char msg[BUFSIZ]; \
+ int len; \
+ \
+ len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
+ (void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ fatalbox (msg); \
+ else \
+ (void)fprintf (stderr, "%s\n", msg); \
+} while (0)
+
+#define WARN_MSG(...) do { \
+ char msg[BUFSIZ]; \
+ \
+ (void)snprintf (msg, BUFSIZ, __VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ warnbox (msg); \
+ else \
+ (void)fprintf (stderr, "%s\n", msg); \
+} while (0)
+
+#define EXIT(...) do { \
+ ERROR_MSG(__VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ exit_calcurse (EXIT_FAILURE); \
+ else \
+ exit (EXIT_FAILURE); \
+} while (0)
+
+#define EXIT_IF(cond, ...) do { \
+ if ((cond)) \
+ EXIT(__VA_ARGS__); \
+} while (0)
+
+#define RETURN_IF(cond, ...) do { \
+ if ((cond)) \
+ { \
+ ERROR_MSG(__VA_ARGS__); \
+ return; \
+ } \
+} while (0)
+
+#define RETVAL_IF(cond, val, ...) do { \
+ if ((cond)) \
+ { \
+ ERROR_MSG(__VA_ARGS__); \
+ return (val); \
+ } \
+} while (0)
+
+#define STRING_BUILD(str) {str, sizeof (str) - 1}
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define __FILE_POS__ __FILE__ ":" TOSTRING(__LINE__)
+
+#define MAX(x,y) ((x)>(y)?(x):(y))
+#define MIN(x,y) ((x)<(y)?(x):(y))
+
+/* General configuration variables. */
+struct conf {
+ unsigned auto_save;
+ unsigned periodic_save;
+ unsigned confirm_quit;
+ unsigned confirm_delete;
+ unsigned skip_system_dialogs;
+ unsigned skip_progress_bar;
+ char *editor;
+ char *pager;
+ char output_datefmt[BUFSIZ]; /* format for displaying date */
+ int input_datefmt; /* format for reading date */
+};
+
+/* Daemon-related configuration. */
+struct dmon_conf {
+ unsigned enable; /* launch daemon automatically when exiting */
+ unsigned log; /* log daemon activity */
+};
+
+struct string {
+ const char *str;
+ const int len;
+};
+
+enum datefmt {
+ DATEFMT_MMDDYYYY = 1,
+ DATEFMT_DDMMYYYY,
+ DATEFMT_YYYYMMDD,
+ DATEFMT_ISO,
+ DATE_FORMATS
+};
+
+#define DATEFMT(datefmt) (datefmt == DATEFMT_MMDDYYYY ? "%m/%d/%Y" : \
+ (datefmt == DATEFMT_DDMMYYYY ? "%d/%m/%Y" : \
+ (datefmt == DATEFMT_YYYYMMDD ? "%Y/%m/%d" : "%Y-%m-%d")))
+
+#define DATEFMT_DESC(datefmt) (datefmt == DATEFMT_MMDDYYYY ? \
+ _("mm/dd/yyyy") : \
+ (datefmt == DATEFMT_DDMMYYYY ? \
+ _("dd/mm/yyyy") : \
+ (datefmt == DATEFMT_YYYYMMDD ? \
+ _("yyyy/mm/dd") : _("yyyy-mm-dd"))))
+
+struct date {
+ unsigned dd;
+ unsigned mm;
+ unsigned yyyy;
+};
+
+/* Appointment definition. */
+struct apoint
+{
+ struct apoint *next; /* appointments are stored in a linked-list */
+ long start; /* seconds since 1 jan 1970 */
+ long dur; /* duration of the appointment in seconds */
+
+#define APOINT_NULL 0x0
+#define APOINT_NOTIFY 0x1 /* Item needs to be notified */
+#define APOINT_NOTIFIED 0x2 /* Item was already notified */
+ int state;
+
+ char *mesg;
+ char *note;
+};
+
+/* Appointments are stored in a linked-list. */
+struct apoint_list
+{
+ struct apoint *root;
+ pthread_mutex_t mutex;
+};
+
+/* Event definition. */
+struct event {
+ struct event *next;
+ int id; /* event identifier */
+ long day; /* seconds since 1 jan 1970 */
+ char *mesg;
+ char *note;
+};
+
+/* Todo item definition. */
+struct todo {
+ struct todo *next;
+ char *mesg;
+ int id;
+ char *note;
+};
+
+/* Number of items in current day. */
+struct day_items_nb {
+ unsigned nb_events;
+ unsigned nb_apoints;
+};
+
+/* Generic item description (to hold appointments, events...). */
+struct day_item {
+ struct day_item *next;
+ long start; /* seconds since 1 jan 1970 */
+ long appt_dur; /* appointment duration in seconds */
+ int type; /* (recursive or normal) event or appointment */
+ int evnt_id; /* event identifier */
+ int appt_pos; /* real position in recurrent list */
+ char state; /* appointment state */
+ char *mesg; /* item description */
+ char *note; /* note attached to item */
+};
+
+struct days {
+ struct days *next;
+ long st; /* beggining of the considered day, in seconds */
+};
+
+enum recur_type {
+ RECUR_NO,
+ RECUR_DAILY,
+ RECUR_WEEKLY,
+ RECUR_MONTHLY,
+ RECUR_YEARLY,
+ RECUR_TYPES
+};
+
+/* To describe an item's repetition. */
+struct rpt {
+ enum recur_type type; /* repetition type */
+ int freq; /* repetition frequence */
+ long until; /* ending date for repeated event */
+};
+
+/* Recurrent appointment definition. */
+struct recur_apoint {
+ struct recur_apoint *next;
+ struct rpt *rpt; /* information about repetition */
+ struct days *exc; /* days when the item should not be repeated */
+ long start; /* beggining of the appointment */
+ long dur; /* duration of the appointment */
+ char state; /* 8 bits to store item state */
+ char *mesg; /* appointment description */
+ char *note; /* note attached to appointment */
+};
+
+/* Recurrent appointments are stored in a linked-list. */
+struct recur_apoint_list {
+ struct recur_apoint *root;
+ pthread_mutex_t mutex;
+};
+
+/* Reccurent event definition. */
+struct recur_event {
+ struct recur_event *next;
+ struct rpt *rpt; /* information about repetition */
+ struct days *exc; /* days when the item should not be repeated */
+ int id; /* event type */
+ long day; /* day at which event occurs */
+ char *mesg; /* event description */
+ char *note; /* note attached to event */
+};
+
+struct notify_app {
+ long time;
+ int got_app;
+ char *txt;
+ char state;
+ pthread_mutex_t mutex;
+};
+
+struct io_file {
+ FILE *fd;
+ char name[BUFSIZ];
+};
+
+/* Available keys. */
+enum key {
+ KEY_GENERIC_CANCEL,
+ KEY_GENERIC_SELECT,
+ KEY_GENERIC_CREDITS,
+ KEY_GENERIC_HELP,
+ KEY_GENERIC_QUIT,
+ KEY_GENERIC_SAVE,
+ KEY_GENERIC_CUT,
+ KEY_GENERIC_PASTE,
+ KEY_GENERIC_CHANGE_VIEW,
+ KEY_GENERIC_IMPORT,
+ KEY_GENERIC_EXPORT,
+ KEY_GENERIC_GOTO,
+ KEY_GENERIC_OTHER_CMD,
+ KEY_GENERIC_CONFIG_MENU,
+ KEY_GENERIC_REDRAW,
+ KEY_GENERIC_ADD_APPT,
+ KEY_GENERIC_ADD_TODO,
+ KEY_GENERIC_NEXT_DAY,
+ KEY_GENERIC_PREV_DAY,
+ KEY_GENERIC_NEXT_WEEK,
+ KEY_GENERIC_PREV_WEEK,
+ KEY_GENERIC_SCROLL_DOWN,
+ KEY_GENERIC_SCROLL_UP,
+ KEY_GENERIC_GOTO_TODAY,
+
+ KEY_MOVE_RIGHT,
+ KEY_MOVE_LEFT,
+ KEY_MOVE_DOWN,
+ KEY_MOVE_UP,
+ KEY_START_OF_WEEK,
+ KEY_END_OF_WEEK,
+ KEY_ADD_ITEM,
+ KEY_DEL_ITEM,
+ KEY_EDIT_ITEM,
+ KEY_VIEW_ITEM,
+ KEY_FLAG_ITEM,
+ KEY_REPEAT_ITEM,
+ KEY_EDIT_NOTE,
+ KEY_VIEW_NOTE,
+ KEY_RAISE_PRIORITY,
+ KEY_LOWER_PRIORITY,
+
+ NBKEYS,
+ KEY_UNDEF
+};
+
+/* To describe a key binding. */
+struct binding {
+ char *label;
+ enum key action;
+};
+
+enum win {
+ CAL,
+ APP,
+ TOD,
+ NOT,
+ STA,
+ NBWINS
+};
+
+enum ui_mode {
+ UI_CURSES,
+ UI_CMDLINE,
+ UI_MODES
+};
+
+/* Generic window structure. */
+struct window {
+ WINDOW *p; /* pointer to window */
+ unsigned w; /* width */
+ unsigned h; /* height */
+ int x; /* x position */
+ int y; /* y position */
+};
+
+/* Generic scrolling window structure. */
+struct scrollwin {
+ struct window win;
+ struct window pad;
+ unsigned first_visible_line;
+ unsigned total_lines;
+ char label[BUFSIZ];
+};
+
+/* Pad structure to handle scrolling. */
+struct pad {
+ int width;
+ int length;
+ int first_onscreen; /* first line to be displayed inside window */
+ WINDOW *ptrwin; /* pointer to the pad window */
+};
+
+/* Notification bar definition. */
+struct nbar {
+ int show; /* display or hide the notify-bar */
+ int cntdwn; /* warn when time left before next app
+ becomes lesser than cntdwn */
+ char datefmt[BUFSIZ]; /* format for displaying date */
+ char timefmt[BUFSIZ]; /* format for displaying time */
+ char cmd[BUFSIZ]; /* notification command */
+ char *shell; /* user shell to launch notif. cmd */
+ pthread_mutex_t mutex;
+};
+
+/* Available types of items. */
+enum item_type {
+ RECUR_EVNT = 1,
+ EVNT,
+ RECUR_APPT,
+ APPT,
+ MAX_TYPES = APPT
+};
+
+/* Flags used to adapt processing when erasing an item. */
+enum eraseflg {
+ ERASE_DONT_FORCE,
+ ERASE_FORCE,
+ ERASE_FORCE_KEEP_NOTE,
+ ERASE_FORCE_ONLY_NOTE,
+ ERASE_CUT
+};
+
+/* Return codes for the getstring() function. */
+enum getstr {
+ GETSTRING_VALID,
+ GETSTRING_ESC, /* user pressed escape to cancel editing. */
+ GETSTRING_RET /* return was pressed without entering any text. */
+};
+
+/* Week days. */
+enum wday {
+ SUNDAY,
+ MONDAY,
+ TUESDAY,
+ WEDNESDAY,
+ THURSDAY,
+ FRIDAY,
+ SATURDAY,
+ WDAYS
+};
+
+/* Possible movements inside calendar. */
+enum move {
+ UP,
+ DOWN,
+ LEFT,
+ RIGHT,
+ WEEK_START,
+ WEEK_END,
+ MOVES
+};
+
+/* Available color pairs. */
+enum {
+ COLR_RED = 1,
+ COLR_GREEN,
+ COLR_YELLOW,
+ COLR_BLUE,
+ COLR_MAGENTA,
+ COLR_CYAN,
+ COLR_DEFAULT,
+ COLR_HIGH,
+ COLR_CUSTOM
+};
+
+/* Available import types. */
+enum import_type {
+ IO_IMPORT_ICAL,
+ IO_IMPORT_NBTYPES
+};
+
+/* Available export types. */
+enum export_type {
+ IO_EXPORT_ICAL,
+ IO_EXPORT_PCAL,
+ IO_EXPORT_NBTYPES
+};
+
+/* To customize the display when saving data. */
+enum save_display {
+ IO_SAVE_DISPLAY_BAR,
+ IO_SAVE_DISPLAY_MARK,
+ IO_SAVE_DISPLAY_NONE
+};
+
+/* apoint.c */
+extern struct apoint_list *alist_p;
+void apoint_free_bkp (enum eraseflg);
+void apoint_llist_init (void);
+void apoint_llist_free (void);
+void apoint_hilt_set (int);
+void apoint_hilt_decrease (void);
+void apoint_hilt_increase (void);
+int apoint_hilt (void);
+struct apoint *apoint_new (char *, char *, long, long, char);
+void apoint_add (void);
+void apoint_delete (struct conf *, unsigned *, unsigned *);
+int apoint_cut (unsigned *, unsigned *);
+void apoint_paste (unsigned *, unsigned *, int);
+unsigned apoint_inday (struct apoint *, long);
+void apoint_sec2str (struct apoint *, int, long, char *, char *);
+void apoint_write (struct apoint *, FILE *);
+struct apoint *apoint_scan (FILE *, struct tm, struct tm, char, char *);
+struct apoint *apoint_get (long, int);
+void apoint_delete_bynum (long, unsigned, enum eraseflg);
+void apoint_scroll_pad_down (int, int);
+void apoint_scroll_pad_up (int);
+struct notify_app *apoint_check_next (struct notify_app *, long);
+struct apoint *apoint_recur_s2apoint_s (struct recur_apoint *);
+void apoint_switch_notify (void);
+void apoint_update_panel (int);
+void apoint_paste_item (void);
+
+/* args.c */
+int parse_args (int, char **, struct conf *);
+
+/* calendar.c */
+void calendar_view_next (void);
+void calendar_view_prev (void);
+void calendar_set_view (int);
+int calendar_get_view (void);
+void calendar_start_date_thread (void);
+void calendar_stop_date_thread (void);
+void calendar_set_current_date (void);
+void calendar_set_first_day_of_week (enum wday);
+void calendar_change_first_day_of_week (void);
+unsigned calendar_week_begins_on_monday (void);
+void calendar_store_current_date (struct date *);
+void calendar_init_slctd_day (void);
+struct date *calendar_get_slctd_day (void);
+long calendar_get_slctd_day_sec (void);
+void calendar_update_panel (struct window *);
+void calendar_goto_today (void);
+void calendar_change_day (int);
+void calendar_move (enum move);
+long calendar_start_of_year (void);
+long calendar_end_of_year (void);
+char *calendar_get_pom (time_t);
+
+/* custom.c */
+void custom_init_attr (void);
+void custom_apply_attr (WINDOW *, int);
+void custom_remove_attr (WINDOW *, int);
+void custom_load_conf (struct conf *, int);
+void custom_config_bar (void);
+void custom_layout_config (void);
+void custom_color_config (void);
+void custom_color_theme_name (char *);
+void custom_confwin_init (struct window *, char *);
+void custom_set_swsiz (struct scrollwin *);
+void custom_general_config (struct conf *);
+void custom_keys_config (void);
+
+/* day.c */
+void day_free_list (void);
+struct day_items_nb *day_process_storage (struct date *, unsigned,
+ struct day_items_nb *);
+void day_write_pad (long, int, int, int);
+void day_popup_item (void);
+int day_check_if_item (struct date);
+unsigned day_chk_busy_slices (struct date, int, int *);
+void day_edit_item (struct conf *);
+int day_erase_item (long, int, enum eraseflg);
+int day_cut_item (long, int);
+int day_paste_item (long, int);
+struct day_item *day_get_item (int);
+int day_item_nb (long, int, int);
+void day_edit_note (char *);
+void day_view_note (char *);
+
+/* dmon.c */
+void dmon_start (int);
+void dmon_stop (void);
+
+/* event.c */
+extern struct event *eventlist;
+void event_free_bkp (enum eraseflg);
+void event_llist_free (void);
+struct event *event_new (char *, char *, long, int);
+unsigned event_inday (struct event *, long);
+void event_write (struct event *, FILE *);
+struct event *event_scan (FILE *, struct tm, int, char *);
+struct event *event_get (long, int);
+void event_delete_bynum (long, unsigned, enum eraseflg);
+void event_paste_item (void);
+
+/* help.c */
+void help_wins_init (struct scrollwin *, int, int, int, int);
+void help_screen (void);
+
+/* io.c */
+unsigned io_fprintln (const char *, const char *, ...);
+void io_init (char *, char *);
+void io_extract_data (char *, const char *, int);
+unsigned io_save_conf (struct conf *);
+unsigned io_save_apts (void);
+unsigned io_save_todo (void);
+unsigned io_save_keys (void);
+void io_save_cal (struct conf *, enum save_display);
+void io_load_app (void);
+void io_load_todo (void);
+void io_load_keys (char *);
+void io_check_dir (char *, int *);
+unsigned io_file_exist (char *);
+void io_check_file (char *, int *);
+int io_check_data_files (void);
+void io_startup_screen (unsigned, int);
+void io_export_data (enum export_type, struct conf *);
+void io_export_bar (void);
+void io_import_data (enum import_type, struct conf *, char *);
+struct io_file *io_log_init (void);
+void io_log_print (struct io_file *, int, char *);
+void io_log_display (struct io_file *, char *, char *);
+void io_log_free (struct io_file *);
+void io_start_psave_thread (struct conf *);
+void io_stop_psave_thread (void);
+void io_set_lock (void);
+unsigned io_dump_pid (char *);
+unsigned io_get_pid (char *);
+
+/* keys.c */
+void keys_init (void);
+void keys_free (void);
+void keys_dump_defaults (char *);
+char *keys_get_label (enum key);
+enum key keys_get_action (int);
+enum key keys_getch (WINDOW *win);
+int keys_assign_binding (int, enum key);
+void keys_remove_binding (int, enum key);
+int keys_str2int (char *);
+char *keys_int2str (int);
+int keys_action_count_keys (enum key);
+char *keys_action_firstkey (enum key);
+char *keys_action_nkey (enum key, int);
+char *keys_action_allkeys (enum key);
+void keys_display_bindings_bar (WINDOW *, struct binding **, int, int);
+void keys_popup_info (enum key);
+void keys_save_bindings (FILE *);
+int keys_check_missing_bindings (void);
+void keys_fill_missing (void);
+
+/* mem.c */
+void *xmalloc (size_t);
+void *xcalloc (size_t, size_t);
+void *xrealloc (void *, size_t, size_t);
+char *xstrdup (const char *);
+void xfree (void *);
+void *dbg_malloc (size_t, const char *);
+void *dbg_calloc (size_t, size_t, const char *);
+void *dbg_realloc (void *, size_t, size_t, const char *);
+char *dbg_strdup (const char *, const char *);
+void dbg_free (void *, const char *);
+void mem_stats (void);
+
+/* notify.c */
+int notify_time_left (void);
+unsigned notify_needs_reminder (void);
+void notify_update_app (long, char, char *);
+int notify_bar (void);
+void notify_init_vars (void);
+void notify_init_bar (void);
+void notify_free_app (void);
+void notify_start_main_thread (void);
+void notify_stop_main_thread (void);
+void notify_reinit_bar (void);
+unsigned notify_launch_cmd (void);
+void notify_update_bar (void);
+unsigned notify_get_next (struct notify_app *);
+unsigned notify_get_next_bkgd (void);
+char *notify_app_txt (void);
+void notify_check_next_app (void);
+void notify_check_added (char *, long, char);
+void notify_check_repeated (struct recur_apoint *);
+int notify_same_item (long);
+int notify_same_recur_item (struct recur_apoint *);
+void notify_config_bar (void);
+
+/* recur.c */
+extern struct recur_apoint_list *recur_alist_p;
+extern struct recur_event *recur_elist;
+void recur_event_free_bkp (enum eraseflg);
+void recur_apoint_free_bkp (enum eraseflg);
+void recur_apoint_llist_init (void);
+void recur_apoint_llist_free (void);
+void recur_event_llist_free (void);
+struct recur_apoint *recur_apoint_new (char *, char *, long, long, char,
+ int, int, long, struct days **);
+struct recur_event *recur_event_new (char *, char *, long, int, int, int,
+ long, struct days **);
+char recur_def2char (enum recur_type);
+int recur_char2def (char);
+struct recur_apoint *recur_apoint_scan (FILE *, struct tm, struct tm,
+ char, int, struct tm, char *,
+ struct days **, char);
+struct recur_event *recur_event_scan (FILE *, struct tm, int, char,
+ int, struct tm, char *,
+ struct days **);
+void recur_save_data (FILE *);
+unsigned recur_item_inday (long, struct days *, int, int,
+ long, long);
+void recur_event_erase (long, unsigned, unsigned,
+ enum eraseflg);
+void recur_apoint_erase (long, unsigned, unsigned,
+ enum eraseflg);
+void recur_repeat_item (struct conf *);
+struct days *recur_exc_scan (FILE *);
+struct notify_app *recur_apoint_check_next (struct notify_app *, long, long);
+struct recur_apoint *recur_get_apoint (long, int);
+struct recur_event *recur_get_event (long, int);
+void recur_apoint_switch_notify (long, int);
+void recur_event_paste_item (void);
+void recur_apoint_paste_item (void);
+
+/* sigs.c */
+void sigs_init (void);
+unsigned sigs_set_hdlr (int, void (*)(int));
+
+/* todo.c */
+extern struct todo *todolist;
+void todo_hilt_set (int);
+void todo_hilt_decrease (void);
+void todo_hilt_increase (void);
+int todo_hilt (void);
+int todo_nb (void);
+void todo_set_nb (int);
+void todo_set_first (int);
+void todo_first_increase (void);
+void todo_first_decrease (void);
+int todo_hilt_pos (void);
+char *todo_saved_mesg (void);
+void todo_new_item (void);
+struct todo *todo_add (char *, int, char *);
+void todo_flag (void);
+void todo_delete (struct conf *);
+void todo_chg_priority (int);
+void todo_edit_item (void);
+void todo_update_panel (int);
+void todo_edit_note (char *);
+void todo_view_note (char *);
+void todo_free_list (void);
+
+/* utils.c */
+void exit_calcurse (int);
+void free_user_data (void);
+void fatalbox (const char *);
+void warnbox (const char *);
+void status_mesg (char *, char *);
+void erase_window_part (WINDOW *, int, int, int, int);
+WINDOW *popup (int, int, int, int, char *, char *, int);
+void print_in_middle (WINDOW *, int, int, int, char *);
+enum getstr getstring (WINDOW *, char *, int, int, int);
+int updatestring (WINDOW *, char **, int, int);
+int is_all_digit (char *);
+long get_item_time (long);
+int get_item_hour (long);
+int get_item_min (long);
+long date2sec (struct date, unsigned, unsigned);
+char *date_sec2hour_str (long);
+char *date_sec2date_str (long, char *);
+void date_sec2date_fmt (long, const char *, char *);
+long date_sec_change (long, int, int);
+long update_time_in_date (long, unsigned, unsigned);
+long get_sec_date (struct date);
+long min2sec (unsigned);
+int check_time (char *);
+void draw_scrollbar (WINDOW *, int, int, int, int, int, unsigned);
+void item_in_popup (char *, char *, char *, char *);
+long get_today (void);
+long now (void);
+char *nowstr (void);
+long mystrtol (const char *);
+void print_bool_option_incolor (WINDOW *, unsigned, int, int);
+char *new_tempfile (const char *, int);
+void erase_note (char **, enum eraseflg);
+int parse_date (char *, enum datefmt, int *, int *, int *);
+char *str_toupper (char *);
+void file_close (FILE *, const char *);
+void psleep (unsigned);
+
+/* vars.c */
+extern int col, row;
+extern unsigned colorize;
+extern enum ui_mode ui_mode;
+extern int days[12];
+extern char *monthnames[12];
+extern char *daynames[8];
+extern char path_dir[BUFSIZ];
+extern char path_todo[BUFSIZ];
+extern char path_apts[BUFSIZ];
+extern char path_conf[BUFSIZ];
+extern char path_keys[BUFSIZ];
+extern char path_notes[BUFSIZ];
+extern char path_cpid[BUFSIZ];
+extern char path_dpid[BUFSIZ];
+extern char path_dmon_log[BUFSIZ];
+extern struct pad apad;
+extern struct nbar nbar;
+extern struct dmon_conf dmon;
+void vars_init (struct conf *);
+
+/* wins.c */
+extern struct window win[NBWINS];
+int wins_layout (void);
+void wins_set_layout (int);
+void wins_slctd_init (void);
+enum win wins_slctd (void);
+void wins_slctd_set (enum win);
+void wins_slctd_next (void);
+void wins_init (void);
+void wins_scrollwin_init (struct scrollwin *);
+void wins_scrollwin_delete (struct scrollwin *);
+void wins_scrollwin_display (struct scrollwin *);
+void wins_scrollwin_up (struct scrollwin *, int);
+void wins_scrollwin_down (struct scrollwin *, int);
+void wins_reinit (void);
+void wins_show (WINDOW *, char *);
+void wins_get_config (void);
+void wins_update (void);
+void wins_reset (void);
+void wins_launch_external (const char *, const char *);
+void wins_status_bar (void);
+void wins_erase_status_bar (void);
+void wins_other_status_page (int);
+void wins_reset_status_page (void);
+
+#endif /* CALCURSE_H */
diff --git a/src/calendar.c b/src/calendar.c
index 2be7c62..bd318e3 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.c,v 1.32 2010/03/08 08:44:44 culot Exp $ */
+/* $calcurse: calendar.c,v 1.33 2010/03/20 10:54:43 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -43,15 +43,7 @@
#include <time.h>
#include <math.h>
-#include "i18n.h"
-#include "day.h"
-#include "apoint.h"
-#include "event.h"
-#include "custom.h"
-#include "vars.h"
-#include "keys.h"
-#include "utils.h"
-#include "calendar.h"
+#include "calcurse.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -73,14 +65,24 @@ enum {
CAL_VIEWS
};
-static date_t today, slctd_day;
+enum pom {
+ NO_POM,
+ FIRST_QUARTER,
+ FULL_MOON,
+ LAST_QUARTER,
+ NEW_MOON,
+ MOON_PHASES
+};
+
+static struct date today, slctd_day;
static unsigned calendar_view, week_begins_on_monday;
static pthread_mutex_t date_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_t calendar_t_date;
-static void draw_monthly_view (window_t *, date_t *, unsigned);
-static void draw_weekly_view (window_t *, date_t *, unsigned);
-static void (*draw_calendar[CAL_VIEWS]) (window_t *, date_t *, unsigned) =
+static void draw_monthly_view (struct window *, struct date *, unsigned);
+static void draw_weekly_view (struct window *, struct date *, unsigned);
+static void (*draw_calendar[CAL_VIEWS]) (struct window *, struct date *,
+ unsigned) =
{draw_monthly_view, draw_weekly_view};
/* Switch between calendar views (monthly view is selected by default). */
@@ -167,7 +169,7 @@ calendar_set_current_date (void)
/* Needed to display sunday or monday as the first day of week in calendar. */
void
-calendar_set_first_day_of_week (wday_e first_day)
+calendar_set_first_day_of_week (enum wday first_day)
{
switch (first_day)
{
@@ -200,7 +202,7 @@ calendar_week_begins_on_monday (void)
/* Fill in the given variable with the current date. */
void
-calendar_store_current_date (date_t *date)
+calendar_store_current_date (struct date *date)
{
pthread_mutex_lock (&date_thread_mutex);
*date = today;
@@ -215,7 +217,7 @@ calendar_init_slctd_day (void)
}
/* Return the selected day in calendar */
-date_t *
+struct date *
calendar_get_slctd_day (void)
{
return (&slctd_day);
@@ -229,7 +231,7 @@ calendar_get_slctd_day_sec (void)
}
static int
-calendar_get_wday (date_t *date)
+calendar_get_wday (struct date *date)
{
struct tm t;
@@ -300,9 +302,9 @@ date_change (struct tm *date, int delta_month, int delta_day)
/* Draw the monthly view inside calendar panel. */
static void
-draw_monthly_view (window_t *cwin, date_t *current_day, unsigned sunday_first)
+draw_monthly_view (struct window *cwin, struct date *current_day, unsigned sunday_first)
{
- date_t check_day;
+ struct date check_day;
int c_day, c_day_1, day_1_sav, numdays, j;
unsigned yr, mo;
int ofs_x, ofs_y;
@@ -472,7 +474,7 @@ ISO8601weeknum (const struct tm *t)
/* Draw the weekly view inside calendar panel. */
static void
-draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first)
+draw_weekly_view (struct window *cwin, struct date *current_day, unsigned sunday_first)
{
int j, c_wday, days_to_remove, weeknum;
struct tm t;
@@ -502,7 +504,7 @@ draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first)
/* Now draw calendar view. */
for (j = 0; j < WEEKINDAYS; j++)
{
- date_t date;
+ struct date date;
unsigned attr, item_this_day;
int i, slices[DAYSLICESNO];
@@ -577,9 +579,9 @@ draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first)
/* Function used to display the calendar panel. */
void
-calendar_update_panel (window_t *cwin)
+calendar_update_panel (struct window *cwin)
{
- date_t current_day;
+ struct date current_day;
unsigned sunday_first;
calendar_store_current_date (&current_day);
@@ -596,7 +598,7 @@ calendar_update_panel (window_t *cwin)
void
calendar_goto_today (void)
{
- date_t today;
+ struct date today;
calendar_store_current_date (&today);
slctd_day.dd = today.dd;
@@ -661,7 +663,7 @@ calendar_change_day (int datefmt)
}
void
-calendar_move (move_t move)
+calendar_move (enum move move)
{
int ret, days_to_remove, days_to_add;
struct tm t;
@@ -882,7 +884,7 @@ pom (time_t tmpt)
struct tm *GMT;
double days;
int cnt;
- pom_e pom;
+ enum pom pom;
pom = NO_POM;
GMT = gmtime (&tmpt);
@@ -906,7 +908,7 @@ char *
calendar_get_pom (time_t date)
{
char *pom_pict[MOON_PHASES] = { " ", "|) ", "(|)", "(| ", " | " };
- pom_e phase = NO_POM;
+ enum pom phase = NO_POM;
double pom_today, relative_pom, pom_yesterday, pom_tomorrow;
const double half = 50.0;
diff --git a/src/calendar.h b/src/calendar.h
deleted file mode 100755
index e900bcd..0000000
--- a/src/calendar.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $calcurse: calendar.h,v 1.19 2010/03/08 08:44:44 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_CALENDAR_H
-#define CALCURSE_CALENDAR_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#elif defined HAVE_NCURSES_NCURSES_H
-#include <ncurses/ncurses.h>
-#elif defined HAVE_NCURSESW_NCURSES_H
-#include <ncursesw/ncurses.h>
-#else
-#error "Missing ncurses header. Aborting..."
-#endif
-
-#include <time.h>
-
-#include "wins.h"
-
-#define CALHEIGHT 12
-#define CALWIDTH 30
-
-#define DAYINSEC 86400
-#define HOURINSEC 3600
-#define MININSEC 60
-#define YEARINDAYS 365
-#define YEARINMONTHS 12
-#define WEEKINDAYS 7
-#define TM_YEAR_BASE 1900
-
-typedef enum
-{ /* days of week */
- SUNDAY,
- MONDAY,
- TUESDAY,
- WEDNESDAY,
- THURSDAY,
- FRIDAY,
- SATURDAY,
- WDAYS
-}
-wday_e;
-
-typedef struct
-{
- unsigned dd;
- unsigned mm;
- unsigned yyyy;
-}
-date_t;
-
-typedef enum
-{
- NO_POM,
- FIRST_QUARTER,
- FULL_MOON,
- LAST_QUARTER,
- NEW_MOON,
- MOON_PHASES
-}
-pom_e;
-
-typedef enum
-{
- UP,
- DOWN,
- LEFT,
- RIGHT,
- WEEK_START,
- WEEK_END,
- MOVES
-}
-move_t;
-
-void calendar_view_next (void);
-void calendar_view_prev (void);
-void calendar_set_view (int);
-int calendar_get_view (void);
-void calendar_start_date_thread (void);
-void calendar_stop_date_thread (void);
-void calendar_set_current_date (void);
-void calendar_set_first_day_of_week (wday_e);
-void calendar_change_first_day_of_week (void);
-unsigned calendar_week_begins_on_monday (void);
-void calendar_store_current_date (date_t *);
-void calendar_init_slctd_day (void);
-date_t *calendar_get_slctd_day (void);
-long calendar_get_slctd_day_sec (void);
-void calendar_update_panel (window_t *);
-void calendar_goto_today (void);
-void calendar_change_day (int);
-void calendar_move (move_t);
-long calendar_start_of_year (void);
-long calendar_end_of_year (void);
-char *calendar_get_pom (time_t);
-
-#endif /* CALCURSE_CALENDAR_H */
diff --git a/src/custom.c b/src/custom.c
index 34470c9..82a4057 100755
--- a/src/custom.c
+++ b/src/custom.c
@@ -1,9 +1,9 @@
-/* $calcurse: custom.c,v 1.45 2009/10/28 15:15:44 culot Exp $ */
+/* $calcurse: custom.c,v 1.46 2010/03/20 10:54:43 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,20 +40,39 @@
#include <stdlib.h>
#include <math.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include "i18n.h"
-#include "io.h"
-#include "utils.h"
-#include "keys.h"
-#include "apoint.h"
-#include "help.h"
-#include "mem.h"
-#include "custom.h"
-
-static struct attribute_s attr;
+#include "calcurse.h"
+
+/* Available configuration variables. */
+enum {
+ CUSTOM_CONF_NOVARIABLE,
+ CUSTOM_CONF_AUTOSAVE,
+ CUSTOM_CONF_PERIODICSAVE,
+ CUSTOM_CONF_CONFIRMQUIT,
+ CUSTOM_CONF_CONFIRMDELETE,
+ CUSTOM_CONF_SKIPSYSTEMDIALOGS,
+ CUSTOM_CONF_SKIPPROGRESSBAR,
+ CUSTOM_CONF_CALENDAR_DEFAULTVIEW,
+ CUSTOM_CONF_WEEKBEGINSONMONDAY,
+ CUSTOM_CONF_COLORTHEME,
+ CUSTOM_CONF_LAYOUT,
+ CUSTOM_CONF_NOTIFYBARSHOW,
+ CUSTOM_CONF_NOTIFYBARDATE,
+ CUSTOM_CONF_NOTIFYBARCLOCK,
+ CUSTOM_CONF_NOTIFYBARWARNING,
+ CUSTOM_CONF_NOTIFYBARCOMMAND,
+ CUSTOM_CONF_OUTPUTDATEFMT,
+ CUSTOM_CONF_INPUTDATEFMT,
+ CUSTOM_CONF_DMON_ENABLE,
+ CUSTOM_CONF_DMON_LOG,
+ CUSTOM_CONF_VARIABLES
+};
+
+struct attribute {
+ int color[7];
+ int nocolor[7];
+};
+
+static struct attribute attr;
static unsigned
fill_config_var (char *string)
@@ -217,7 +236,7 @@ custom_remove_attr (WINDOW *win, int attr_num)
/* Load the user configuration. */
void
-custom_load_conf (conf_t *conf, int background)
+custom_load_conf (struct conf *conf, int background)
{
FILE *data_file;
char *mesg_line1 = _("Failed to open config file");
@@ -412,15 +431,15 @@ custom_config_bar (void)
static void
layout_selection_bar (void)
{
- binding_t quit = {_("Exit"), KEY_GENERIC_QUIT};
- binding_t select = {_("Select"), KEY_GENERIC_SELECT};
- binding_t up = {_("Up"), KEY_MOVE_UP};
- binding_t down = {_("Down"), KEY_MOVE_DOWN};
- binding_t left = {_("Left"), KEY_MOVE_LEFT};
- binding_t right = {_("Right"), KEY_MOVE_RIGHT};
- binding_t help = {_("Help"), KEY_GENERIC_HELP};
+ struct binding quit = {_("Exit"), KEY_GENERIC_QUIT};
+ struct binding select = {_("Select"), KEY_GENERIC_SELECT};
+ struct binding up = {_("Up"), KEY_MOVE_UP};
+ struct binding down = {_("Down"), KEY_MOVE_DOWN};
+ struct binding left = {_("Left"), KEY_MOVE_LEFT};
+ struct binding right = {_("Right"), KEY_MOVE_RIGHT};
+ struct binding help = {_("Help"), KEY_GENERIC_HELP};
- binding_t *binding[] = {&quit, &select, &up, &down, &left, &right, &help};
+ struct binding *binding[] = {&quit, &select, &up, &down, &left, &right, &help};
int binding_size = sizeof (binding) / sizeof (binding[0]);
keys_display_bindings_bar (win[STA].p, binding, 0, binding_size);
@@ -431,7 +450,8 @@ layout_selection_bar (void)
/* Used to display available layouts in layout configuration menu. */
static void
-display_layout_config (window_t *lwin, int mark, int cursor, int need_reset)
+display_layout_config (struct window *lwin, int mark, int cursor,
+ int need_reset)
{
#define CURSOR (32 | A_REVERSE)
#define MARK 88
@@ -500,8 +520,8 @@ display_layout_config (window_t *lwin, int mark, int cursor, int need_reset)
void
custom_layout_config (void)
{
- scrollwin_t hwin;
- window_t conf_win;
+ struct scrollwin hwin;
+ struct window conf_win;
int ch, mark, cursor, need_reset;
char *help_text =
_("With this configuration menu, one can choose where panels will be\n"
@@ -572,7 +592,7 @@ custom_layout_config (void)
#undef LAYOUTSPERCOL
static void
-set_confwin_attr (window_t *cwin)
+set_confwin_attr (struct window *cwin)
{
cwin->h = (notify_bar ())? row - 3 : row - 2;
cwin->w = col;
@@ -584,7 +604,7 @@ set_confwin_attr (window_t *cwin)
* (useful in case of window resize).
*/
void
-custom_confwin_init (window_t *confwin, char *label)
+custom_confwin_init (struct window *confwin, char *label)
{
if (confwin->p)
{
@@ -611,16 +631,16 @@ custom_confwin_init (window_t *confwin, char *label)
static void
color_selection_bar (void)
{
- binding_t quit = {_("Exit"), KEY_GENERIC_QUIT};
- binding_t select = {_("Select"), KEY_GENERIC_SELECT};
- binding_t nocolor = {_("No color"), KEY_GENERIC_CANCEL};
- binding_t up = {_("Up"), KEY_MOVE_UP};
- binding_t down = {_("Down"), KEY_MOVE_DOWN};
- binding_t left = {_("Left"), KEY_MOVE_LEFT};
- binding_t right = {_("Right"), KEY_MOVE_RIGHT};
+ struct binding quit = {_("Exit"), KEY_GENERIC_QUIT};
+ struct binding select = {_("Select"), KEY_GENERIC_SELECT};
+ struct binding nocolor = {_("No color"), KEY_GENERIC_CANCEL};
+ struct binding up = {_("Up"), KEY_MOVE_UP};
+ struct binding down = {_("Down"), KEY_MOVE_DOWN};
+ struct binding left = {_("Left"), KEY_MOVE_LEFT};
+ struct binding right = {_("Right"), KEY_MOVE_RIGHT};
- binding_t *binding[] = {
+ struct binding *binding[] = {
&quit, &nocolor, &up, &down, &left, &right, &select
};
int binding_size = sizeof (binding) / sizeof (binding[0]);
@@ -633,7 +653,7 @@ color_selection_bar (void)
* This is useful for window resizing.
*/
static void
-display_color_config (window_t *cwin, int *mark_fore, int *mark_back,
+display_color_config (struct window *cwin, int *mark_fore, int *mark_back,
int cursor, int need_reset, int theme_changed)
{
#define SIZE (2 * (NBUSERCOLORS + 1))
@@ -761,7 +781,7 @@ display_color_config (window_t *cwin, int *mark_fore, int *mark_back,
void
custom_color_config (void)
{
- window_t conf_win;
+ struct window conf_win;
int ch, cursor, need_reset, theme_changed;
int mark_fore, mark_back;
@@ -886,7 +906,7 @@ custom_color_theme_name (char *theme_name)
/* Prints the general options. */
static int
-print_general_options (WINDOW *win, conf_t *conf)
+print_general_options (WINDOW *win, struct conf *conf)
{
enum {
AUTO_SAVE,
@@ -986,7 +1006,7 @@ print_general_options (WINDOW *win, conf_t *conf)
}
void
-custom_set_swsiz (scrollwin_t *sw)
+custom_set_swsiz (struct scrollwin *sw)
{
sw->win.x = 0;
sw->win.y = 0;
@@ -1001,9 +1021,9 @@ custom_set_swsiz (scrollwin_t *sw)
/* General configuration. */
void
-custom_general_config (conf_t *conf)
+custom_general_config (struct conf *conf)
{
- scrollwin_t cwin;
+ struct scrollwin cwin;
char *number_str =
_("Enter an option number to change its value");
char *keys =
@@ -1188,16 +1208,16 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff)
static void
custom_keys_config_bar (void)
{
- binding_t quit = {_("Exit"), KEY_GENERIC_QUIT};
- binding_t info = {_("Key info"), KEY_GENERIC_HELP};
- binding_t add = {_("Add key"), KEY_ADD_ITEM};
- binding_t del = {_("Del key"), KEY_DEL_ITEM};
- binding_t up = {_("Up"), KEY_MOVE_UP};
- binding_t down = {_("Down"), KEY_MOVE_DOWN};
- binding_t left = {_("Prev Key"), KEY_MOVE_LEFT};
- binding_t right = {_("Next Key"), KEY_MOVE_RIGHT};
+ struct binding quit = {_("Exit"), KEY_GENERIC_QUIT};
+ struct binding info = {_("Key info"), KEY_GENERIC_HELP};
+ struct binding add = {_("Add key"), KEY_ADD_ITEM};
+ struct binding del = {_("Del key"), KEY_DEL_ITEM};
+ struct binding up = {_("Up"), KEY_MOVE_UP};
+ struct binding down = {_("Down"), KEY_MOVE_DOWN};
+ struct binding left = {_("Prev Key"), KEY_MOVE_LEFT};
+ struct binding right = {_("Next Key"), KEY_MOVE_RIGHT};
- binding_t *binding[] = {
+ struct binding *binding[] = {
&quit, &info, &add, &del, &up, &down, &left, &right
};
int binding_size = sizeof (binding) / sizeof (binding[0]);
@@ -1208,7 +1228,7 @@ custom_keys_config_bar (void)
void
custom_keys_config (void)
{
- scrollwin_t kwin;
+ struct scrollwin kwin;
int selrow, selelm, firstrow, lastrow, nbrowelm, nbdisplayed;
int keyval, used, not_recognized;
char *keystr;
@@ -1303,7 +1323,7 @@ custom_keys_config (void)
used = keys_assign_binding (keyval, selrow);
if (used)
{
- keys_e action;
+ enum key action;
action = keys_get_action (keyval);
WARN_MSG (_("This key is already in use for %s, "
diff --git a/src/custom.h b/src/custom.h
deleted file mode 100755
index bedcdc9..0000000
--- a/src/custom.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $calcurse: custom.h,v 1.19 2009/10/28 15:15:44 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_CUSTOM_H
-#define CALCURSE_CUSTOM_H
-
-#include "vars.h"
-#include "wins.h"
-
-#define NBUSERCOLORS 6
-
-enum
-{ /* Color pairs */
- COLR_RED = 1,
- COLR_GREEN,
- COLR_YELLOW,
- COLR_BLUE,
- COLR_MAGENTA,
- COLR_CYAN,
- COLR_DEFAULT,
- COLR_HIGH,
- COLR_CUSTOM
-};
-
-enum
-{ /* Configuration variables */
- CUSTOM_CONF_NOVARIABLE,
- CUSTOM_CONF_AUTOSAVE,
- CUSTOM_CONF_PERIODICSAVE,
- CUSTOM_CONF_CONFIRMQUIT,
- CUSTOM_CONF_CONFIRMDELETE,
- CUSTOM_CONF_SKIPSYSTEMDIALOGS,
- CUSTOM_CONF_SKIPPROGRESSBAR,
- CUSTOM_CONF_CALENDAR_DEFAULTVIEW,
- CUSTOM_CONF_WEEKBEGINSONMONDAY,
- CUSTOM_CONF_COLORTHEME,
- CUSTOM_CONF_LAYOUT,
- CUSTOM_CONF_NOTIFYBARSHOW,
- CUSTOM_CONF_NOTIFYBARDATE,
- CUSTOM_CONF_NOTIFYBARCLOCK,
- CUSTOM_CONF_NOTIFYBARWARNING,
- CUSTOM_CONF_NOTIFYBARCOMMAND,
- CUSTOM_CONF_OUTPUTDATEFMT,
- CUSTOM_CONF_INPUTDATEFMT,
- CUSTOM_CONF_DMON_ENABLE,
- CUSTOM_CONF_DMON_LOG,
- CUSTOM_CONF_VARIABLES
-};
-
-struct attribute_s
-{
- int color[7];
- int nocolor[7];
-};
-
-void custom_init_attr (void);
-void custom_apply_attr (WINDOW *, int);
-void custom_remove_attr (WINDOW *, int);
-void custom_load_conf (conf_t *, int);
-void custom_config_bar (void);
-void custom_layout_config (void);
-void custom_color_config (void);
-void custom_color_theme_name (char *);
-void custom_confwin_init (window_t *, char *);
-void custom_set_swsiz (scrollwin_t *);
-void custom_general_config (conf_t *);
-void custom_keys_config (void);
-
-#endif /* CALCURSE_CUSTOM_H */
diff --git a/src/day.c b/src/day.c
index 0cd1d76..4bcb5ec 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,9 +1,9 @@
-/* $calcurse: day.c,v 1.52 2009/10/16 15:51:33 culot Exp $ */
+/* $calcurse: day.c,v 1.53 2010/03/20 10:54:44 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,16 +42,18 @@
#include <ctype.h>
#include <time.h>
-#include "i18n.h"
-#include "apoint.h"
-#include "event.h"
-#include "custom.h"
-#include "keys.h"
-#include "mem.h"
-#include "day.h"
+#include "calcurse.h"
-static struct day_item_s *day_items_ptr;
-static struct day_saved_item_s day_saved_item;
+struct day_saved_item {
+ char start[BUFSIZ];
+ char end[BUFSIZ];
+ char state;
+ char type;
+ char *mesg;
+};
+
+static struct day_item *day_items_ptr;
+static struct day_saved_item day_saved_item;
/*
* Free the current day linked list containing the events and appointments.
@@ -61,7 +63,7 @@ static struct day_saved_item_s day_saved_item;
void
day_free_list (void)
{
- struct day_item_s *o, **i;
+ struct day_item *o, **i;
i = &day_items_ptr;
while (*i)
@@ -74,12 +76,12 @@ day_free_list (void)
}
/* Add an event in the current day list */
-static struct day_item_s *
+static struct day_item *
day_add_event (int type, char *mesg, char *note, long day, int id)
{
- struct day_item_s *o, **i;
+ struct day_item *o, **i;
- o = mem_malloc (sizeof (struct day_item_s));
+ o = mem_malloc (sizeof (struct day_item));
o->mesg = mesg;
o->note = note;
o->type = type;
@@ -102,14 +104,14 @@ day_add_event (int type, char *mesg, char *note, long day, int id)
}
/* Add an appointment in the current day list. */
-static struct day_item_s *
+static struct day_item *
day_add_apoint (int type, char *mesg, char *note, long start, long dur,
char state, int real_pos)
{
- struct day_item_s *o, **i;
+ struct day_item *o, **i;
int insert_item = 0;
- o = mem_malloc (sizeof (struct day_item_s));
+ o = mem_malloc (sizeof (struct day_item));
o->mesg = mesg;
o->note = note;
o->start = start;
@@ -150,8 +152,8 @@ day_add_apoint (int type, char *mesg, char *note, long start, long dur,
static int
day_store_events (long date)
{
- struct event_s *j;
- struct day_item_s *ptr;
+ struct event *j;
+ struct day_item *ptr;
int e_nb = 0;
for (j = eventlist; j != 0; j = j->next)
@@ -176,8 +178,8 @@ day_store_events (long date)
static int
day_store_recur_events (long date)
{
- struct recur_event_s *j;
- struct day_item_s *ptr;
+ struct recur_event *j;
+ struct day_item *ptr;
int e_nb = 0;
for (j = recur_elist; j != 0; j = j->next)
@@ -203,8 +205,8 @@ day_store_recur_events (long date)
static int
day_store_apoints (long date)
{
- apoint_llist_node_t *j;
- struct day_item_s *ptr;
+ struct apoint *j;
+ struct day_item *ptr;
int a_nb = 0;
pthread_mutex_lock (&(alist_p->mutex));
@@ -232,8 +234,8 @@ day_store_apoints (long date)
static int
day_store_recur_apoints (long date)
{
- recur_apoint_llist_node_t *j;
- struct day_item_s *ptr;
+ struct recur_apoint *j;
+ struct day_item *ptr;
long real_start;
int a_nb = 0, n = 0;
@@ -294,12 +296,12 @@ day_store_items (long date, unsigned *pnb_events, unsigned *pnb_apoints)
* those items in a pad. If selected day is null, then store items for current
* day. This is useful to speed up the appointment panel update.
*/
-day_items_nb_t *
-day_process_storage (date_t *slctd_date, unsigned day_changed,
- day_items_nb_t *inday)
+struct day_items_nb *
+day_process_storage (struct date *slctd_date, unsigned day_changed,
+ struct day_items_nb *inday)
{
long date;
- date_t day;
+ struct date day;
if (slctd_date)
day = *slctd_date;
@@ -328,7 +330,7 @@ day_process_storage (date_t *slctd_date, unsigned day_changed,
* day_item_s
*/
static void
-day_item_s2apoint_s (apoint_llist_node_t *a, struct day_item_s *p)
+day_item_s2apoint_s (struct apoint *a, struct day_item *p)
{
a->state = p->state;
a->start = p->start;
@@ -340,7 +342,7 @@ day_item_s2apoint_s (apoint_llist_node_t *a, struct day_item_s *p)
* Print an item date in the appointment panel.
*/
static void
-display_item_date (int incolor, apoint_llist_node_t *i, int type, long date,
+display_item_date (int incolor, struct apoint *i, int type, long date,
int y, int x)
{
WINDOW *win;
@@ -404,8 +406,8 @@ display_item (int incolor, char *msg, int recur, int note, int len, int y,
void
day_write_pad (long date, int width, int length, int incolor)
{
- struct day_item_s *p;
- apoint_llist_node_t a;
+ struct day_item *p;
+ struct apoint a;
int line, item_number, max_pos, recur;
const int x_pos = 0;
unsigned draw_line = 0;
@@ -481,12 +483,12 @@ day_popup_item (void)
* calendar. This is used to put the correct colors inside calendar panel.
*/
int
-day_check_if_item (date_t day)
+day_check_if_item (struct date day)
{
- struct recur_event_s *re;
- recur_apoint_llist_node_t *ra;
- struct event_s *e;
- apoint_llist_node_t *a;
+ struct recur_event *re;
+ struct recur_apoint *ra;
+ struct event *e;
+ struct apoint *a;
const long date = date2sec (day, 0, 0);
for (re = recur_elist; re != 0; re = re->next)
@@ -543,10 +545,10 @@ fill_slices (int *slices, int slicesno, int first, int last)
* A 24 hours day is divided into 'slicesno' number of time slices.
*/
unsigned
-day_chk_busy_slices (date_t day, int slicesno, int *slices)
+day_chk_busy_slices (struct date day, int slicesno, int *slices)
{
- recur_apoint_llist_node_t *ra;
- apoint_llist_node_t *a;
+ struct recur_apoint *ra;
+ struct apoint *a;
int slicelen;
const long date = date2sec (day, 0, 0);
@@ -669,7 +671,7 @@ update_desc (char **desc)
}
static void
-update_rept (struct rpt_s **rpt, const long start, conf_t *conf)
+update_rept (struct rpt **rpt, const long start, struct conf *conf)
{
const int SINGLECHAR = 2;
int ch, cancel, newfreq, date_entered;
@@ -689,7 +691,7 @@ update_rept (struct rpt_s **rpt, const long start, conf_t *conf)
do
{
status_mesg (msg_rpt_type, msg_rpt_ans);
- typstr = (char *) mem_calloc (SINGLECHAR, sizeof (char));
+ typstr = mem_calloc (SINGLECHAR, sizeof (char));
(void)snprintf (typstr, SINGLECHAR, "%c", recur_def2char ((*rpt)->type));
cancel = updatestring (win[STA].p, &typstr, 0, 1);
if (cancel)
@@ -708,7 +710,7 @@ update_rept (struct rpt_s **rpt, const long start, conf_t *conf)
do
{
status_mesg (_("Enter the new repetition frequence:"), "");
- freqstr = (char *) mem_malloc (BUFSIZ);
+ freqstr = mem_malloc (BUFSIZ);
(void)snprintf (freqstr, BUFSIZ, "%d", (*rpt)->freq);
cancel = updatestring (win[STA].p, &freqstr, 0, 1);
if (cancel)
@@ -751,7 +753,7 @@ update_rept (struct rpt_s **rpt, const long start, conf_t *conf)
{
struct tm *lt;
time_t t;
- date_t new_date;
+ struct date new_date;
int newmonth, newday, newyear;
if (parse_date (timstr, conf->input_datefmt,
@@ -792,18 +794,18 @@ update_rept (struct rpt_s **rpt, const long start, conf_t *conf)
/* Edit an already existing item. */
void
-day_edit_item (conf_t *conf)
+day_edit_item (struct conf *conf)
{
#define STRT '1'
#define END '2'
#define DESC '3'
#define REPT '4'
- struct day_item_s *p;
- struct recur_event_s *re;
- struct event_s *e;
- recur_apoint_llist_node_t *ra;
- apoint_llist_node_t *a;
+ struct day_item *p;
+ struct recur_event *re;
+ struct event *e;
+ struct recur_apoint *ra;
+ struct apoint *a;
long date;
int item_num, ch;
@@ -891,9 +893,9 @@ day_edit_item (conf_t *conf)
* type of the item to be deleted.
*/
int
-day_erase_item (long date, int item_number, erase_flag_e flag)
+day_erase_item (long date, int item_number, enum eraseflg flag)
{
- struct day_item_s *p;
+ struct day_item *p;
char *erase_warning =
_("This item is recurrent. "
"Delete (a)ll occurences or just this (o)ne ?");
@@ -972,7 +974,7 @@ int
day_cut_item (long date, int item_number)
{
const int DELETE_WHOLE = 1;
- struct day_item_s *p;
+ struct day_item *p;
p = day_get_item (item_number);
switch (p->type)
@@ -1032,10 +1034,10 @@ day_paste_item (long date, int cut_item_type)
}
/* Returns a structure containing the selected item. */
-struct day_item_s *
+struct day_item *
day_get_item (int item_number)
{
- struct day_item_s *o;
+ struct day_item *o;
int i;
o = day_items_ptr;
@@ -1051,7 +1053,7 @@ int
day_item_nb (long date, int day_num, int type)
{
int i, nb_item[MAX_TYPES];
- struct day_item_s *p;
+ struct day_item *p;
for (i = 0; i < MAX_TYPES; i++)
nb_item[i] = 0;
@@ -1071,11 +1073,11 @@ day_item_nb (long date, int day_num, int type)
void
day_edit_note (char *editor)
{
- struct day_item_s *p;
- recur_apoint_llist_node_t *ra;
- apoint_llist_node_t *a;
- struct recur_event_s *re;
- struct event_s *e;
+ struct day_item *p;
+ struct recur_apoint *ra;
+ struct apoint *a;
+ struct recur_event *re;
+ struct event *e;
char fullname[BUFSIZ];
char *filename;
long date;
@@ -1119,7 +1121,7 @@ day_edit_note (char *editor)
void
day_view_note (char *pager)
{
- struct day_item_s *p;
+ struct day_item *p;
char fullname[BUFSIZ];
p = day_get_item (apoint_hilt ());
diff --git a/src/day.h b/src/day.h
deleted file mode 100755
index a1b69d3..0000000
--- a/src/day.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $calcurse: day.h,v 1.25 2009/10/08 16:28:06 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_DAY_H
-#define CALCURSE_DAY_H
-
-#include "vars.h"
-#include "utils.h"
-#include "calendar.h"
-
-#define MAX_TYPES 4
-
-#define RECUR_EVNT 1
-#define EVNT 2
-#define RECUR_APPT 3
-#define APPT 4
-
-typedef struct
-{
- unsigned nb_events;
- unsigned nb_apoints;
-}
-day_items_nb_t;
-
-struct day_item_s
-{
- struct day_item_s *next;
- long start; /* seconds since 1 jan 1970 */
- long appt_dur; /* appointment duration in seconds */
- int type; /* (recursive or normal) event or appointment */
- int evnt_id; /* event identifier */
- int appt_pos; /* real position in recurrent list */
- char state; /* appointment state */
- char *mesg; /* item description */
- char *note; /* note attached to item */
-};
-
-struct day_saved_item_s
-{
- char start[BUFSIZ];
- char end[BUFSIZ];
- char state;
- char type;
- char *mesg;
-};
-
-void day_free_list (void);
-day_items_nb_t *day_process_storage (date_t *, unsigned, day_items_nb_t *);
-void day_write_pad (long, int, int, int);
-void day_popup_item (void);
-int day_check_if_item (date_t);
-unsigned day_chk_busy_slices (date_t, int, int *);
-void day_edit_item (conf_t *);
-int day_erase_item (long, int, erase_flag_e);
-int day_cut_item (long, int);
-int day_paste_item (long, int);
-struct day_item_s *day_get_item (int);
-int day_item_nb (long, int, int);
-void day_edit_note (char *);
-void day_view_note (char *);
-
-#endif /* CALCURSE_DAY_H */
diff --git a/src/dmon.c b/src/dmon.c
index 9913361..46f4c22 100644
--- a/src/dmon.c
+++ b/src/dmon.c
@@ -1,9 +1,9 @@
-/* $calcurse: dmon.c,v 1.11 2009/08/01 20:29:49 culot Exp $ */
+/* $calcurse: dmon.c,v 1.12 2010/03/20 10:54:44 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2009-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,15 +43,9 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include <signal.h>
-#include "utils.h"
-#include "i18n.h"
-#include "sigs.h"
-#include "mem.h"
-#include "io.h"
-#include "custom.h"
-#include "notify.h"
-#include "dmon.h"
+#include "calcurse.h"
#define DMON_SLEEP_TIME 60
@@ -162,7 +156,7 @@ daemonize (int status)
void
dmon_start (int parent_exit_status)
{
- conf_t conf;
+ struct conf conf;
if (!daemonize (parent_exit_status))
DMON_ABRT (_("Cannot daemonize, aborting\n"));
diff --git a/src/dmon.h b/src/dmon.h
deleted file mode 100644
index 7236360..0000000
--- a/src/dmon.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $calcurse: dmon.h,v 1.2 2009/07/26 20:38:36 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_DMON_H
-#define CALCURSE_DMON_H
-
-void dmon_start (int);
-void dmon_stop (void);
-
-#endif /* CALCURSE_DMON_H */
diff --git a/src/event.c b/src/event.c
index 9b1cd63..3c827c4 100755
--- a/src/event.c
+++ b/src/event.c
@@ -1,9 +1,9 @@
-/* $calcurse: event.c,v 1.15 2009/07/19 08:20:00 culot Exp $ */
+/* $calcurse: event.c,v 1.16 2010/03/20 10:54:44 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,16 +41,13 @@
#include <sys/types.h>
#include <time.h>
-#include "vars.h"
-#include "i18n.h"
-#include "mem.h"
-#include "event.h"
+#include "calcurse.h"
-struct event_s *eventlist;
-static struct event_s bkp_cut_event;
+struct event *eventlist;
+static struct event bkp_cut_event;
void
-event_free_bkp (erase_flag_e flag)
+event_free_bkp (enum eraseflg flag)
{
if (bkp_cut_event.mesg)
{
@@ -61,7 +58,7 @@ event_free_bkp (erase_flag_e flag)
}
static void
-event_dup (struct event_s *in, struct event_s *bkp)
+event_dup (struct event *in, struct event *bkp)
{
EXIT_IF (!in || !bkp, _("null pointer"));
@@ -75,7 +72,7 @@ event_dup (struct event_s *in, struct event_s *bkp)
void
event_llist_free (void)
{
- struct event_s *o, **i;
+ struct event *o, **i;
i = &eventlist;
while (*i)
@@ -89,11 +86,11 @@ event_llist_free (void)
}
/* Create a new event */
-struct event_s *
+struct event *
event_new (char *mesg, char *note, long day, int id)
{
- struct event_s *o, **i;
- o = (struct event_s *) mem_malloc (sizeof (struct event_s));
+ struct event *o, **i;
+ o = mem_malloc (sizeof (struct event));
o->mesg = mem_strdup (mesg);
o->day = day;
o->id = id;
@@ -114,7 +111,7 @@ event_new (char *mesg, char *note, long day, int id)
/* Check if the event belongs to the selected day */
unsigned
-event_inday (struct event_s *i, long start)
+event_inday (struct event *i, long start)
{
if (i->day <= start + DAYINSEC && i->day > start)
{
@@ -125,7 +122,7 @@ event_inday (struct event_s *i, long start)
/* Write to file the event in user-friendly format */
void
-event_write (struct event_s *o, FILE *f)
+event_write (struct event *o, FILE *f)
{
struct tm *lt;
time_t t;
@@ -140,7 +137,7 @@ event_write (struct event_s *o, FILE *f)
}
/* Load the events from file */
-struct event_s *
+struct event *
event_scan (FILE *f, struct tm start, int id, char *note)
{
char buf[BUFSIZ], *nl;
@@ -170,10 +167,10 @@ event_scan (FILE *f, struct tm start, int id, char *note)
}
/* Retrieve an event from the list, given the day and item position. */
-struct event_s *
+struct event *
event_get (long day, int pos)
{
- struct event_s *o;
+ struct event *o;
int n;
n = 0;
@@ -193,10 +190,10 @@ event_get (long day, int pos)
/* Delete an event from the list. */
void
-event_delete_bynum (long start, unsigned num, erase_flag_e flag)
+event_delete_bynum (long start, unsigned num, enum eraseflg flag)
{
unsigned n;
- struct event_s *i, **iptr;
+ struct event *i, **iptr;
n = 0;
iptr = &eventlist;
diff --git a/src/event.h b/src/event.h
deleted file mode 100755
index 2c8173f..0000000
--- a/src/event.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $calcurse: event.h,v 1.10 2009/07/05 20:33:19 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_EVENT_H
-#define CALCURSE_EVENT_H
-
-#include "utils.h"
-
-#define HRMIN_SIZE 6
-
-struct event_s
-{
- struct event_s *next;
- int id; /* event identifier */
- long day; /* seconds since 1 jan 1970 */
- char *mesg;
- char *note;
-};
-
-extern struct event_s *eventlist;
-
-void event_free_bkp (erase_flag_e);
-void event_llist_free (void);
-struct event_s *event_new (char *, char *, long, int);
-unsigned event_inday (struct event_s *, long);
-void event_write (struct event_s *, FILE *);
-struct event_s *event_scan (FILE *, struct tm, int, char *);
-struct event_s *event_get (long, int);
-void event_delete_bynum (long, unsigned, erase_flag_e);
-void event_paste_item (void);
-
-#endif /* CALCURSE_EVENT_H */
diff --git a/src/help.c b/src/help.c
index eb94354..e4f7d48 100755
--- a/src/help.c
+++ b/src/help.c
@@ -1,9 +1,9 @@
-/* $calcurse: help.c,v 1.42 2009/10/28 13:44:41 culot Exp $ */
+/* $calcurse: help.c,v 1.43 2010/03/20 10:54:45 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,16 +41,14 @@
#include <ctype.h>
#include <sys/types.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "calcurse.h"
-#include "i18n.h"
-#include "custom.h"
-#include "utils.h"
-#include "keys.h"
-#include "notify.h"
-#include "help.h"
+#define HELPTEXTSIZ 4096
+
+typedef struct {
+ char *title;
+ char text[HELPTEXTSIZ];
+} help_page_t;
typedef enum
{
@@ -100,7 +98,7 @@ get_help_lines (char *text)
* of lines that were written.
*/
static int
-help_write_pad (window_t *win, char *title, char *text, keys_e action)
+help_write_pad (struct window *win, char *title, char *text, enum key action)
{
int colnum, rownum;
char *bindings_title = "key bindings: %s";
@@ -150,7 +148,7 @@ help_write_pad (window_t *win, char *title, char *text, keys_e action)
* faster.
*/
void
-help_wins_init (scrollwin_t *hwin, int x, int y, int h, int w)
+help_wins_init (struct scrollwin *hwin, int x, int y, int h, int w)
{
const int PADOFFSET = 4;
const int TITLELINES = 3;
@@ -175,7 +173,7 @@ help_wins_init (scrollwin_t *hwin, int x, int y, int h, int w)
* size and placement.
*/
static void
-help_wins_reinit (scrollwin_t *hwin)
+help_wins_reinit (struct scrollwin *hwin)
{
wins_scrollwin_delete (hwin);
wins_get_config ();
@@ -184,7 +182,7 @@ help_wins_reinit (scrollwin_t *hwin)
/* Reset the screen, needed when resizing terminal for example. */
static void
-help_wins_reset (scrollwin_t *hwin)
+help_wins_reset (struct scrollwin *hwin)
{
endwin ();
refresh ();
@@ -326,9 +324,9 @@ help_screen (void)
MOVE_RIGHT,
DIRECTIONS
};
- scrollwin_t hwin;
+ struct scrollwin hwin;
int need_resize;
- keys_e ch = KEY_GENERIC_HELP;
+ enum key ch = KEY_GENERIC_HELP;
int page, oldpage;
help_page_t hscr[HELPSCREENS];
char keystr[DIRECTIONS][BUFSIZ];
diff --git a/src/help.h b/src/help.h
deleted file mode 100755
index b5ac6be..0000000
--- a/src/help.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $calcurse: help.h,v 1.10 2009/07/05 20:33:20 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2008 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_HELP_H
-#define CALCURSE_HELP_H
-
-#include "wins.h"
-
-#define HELPTEXTSIZ 4096
-
-typedef struct {
- char *title;
- char text[HELPTEXTSIZ];
-} help_page_t;
-
-void help_wins_init (scrollwin_t *, int, int, int, int);
-void help_screen (void);
-
-#endif /* CALCURSE_HELP_H */
diff --git a/src/i18n.h b/src/i18n.h
deleted file mode 100755
index 3526ee7..0000000
--- a/src/i18n.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $calcurse: i18n.h,v 1.4 2009/07/05 20:33:20 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2006 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_I18N_H
-#define CALCURSE_I18N_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#if ENABLE_NLS
-#include <locale.h>
-#include <libintl.h>
-#undef _
-#define _(String) gettext(String)
-#ifdef gettext_noop
-#define N_(String) gettext_noop(String)
-#else
-#define N_(String) (String)
-#endif
-#else /* NLS disabled */
-#define _(String) (String)
-#define N_(String) (String)
-#define textdomain(String) (String)
-#define gettext(String) (String)
-#define dgettext(String) (String)
-#define dcgettext(String) (String)
-#define bindtextdomain(String) (String)
-#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
-#endif /* ENABLE_NLS */
-
-#endif /* CALCURSE_I18N_H */
diff --git a/src/io.c b/src/io.c
index 1ef3c6f..28b6bdb 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,9 +1,9 @@
-/* $calcurse: io.c,v 1.80 2009/11/01 11:06:37 culot Exp $ */
+/* $calcurse: io.c,v 1.81 2010/03/20 10:54:46 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,21 +45,7 @@
#include <unistd.h>
#include <errno.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include "i18n.h"
-#include "utils.h"
-#include "custom.h"
-#include "todo.h"
-#include "event.h"
-#include "apoint.h"
-#include "recur.h"
-#include "keys.h"
-#include "htable.h"
-#include "mem.h"
-#include "io.h"
+#include "calcurse.h"
#define ICALDATEFMT "%Y%m%d"
#define ICALDATETIMEFMT "%Y%m%dT%H%M%S"
@@ -96,15 +82,15 @@ typedef enum {
} ical_vevent_e;
typedef struct {
- recur_types_t type;
- int freq;
- long until;
- unsigned count;
+ enum recur_type type;
+ int freq;
+ long until;
+ unsigned count;
} ical_rpt_t;
struct ht_keybindings_s {
- char *label;
- keys_e key;
+ char *label;
+ enum key key;
HTABLE_ENTRY (ht_keybindings_s);
};
@@ -218,7 +204,7 @@ progress_bar (progress_bar_t type, int progress)
/* Ask user for a file name to export data to. */
static FILE *
-get_export_stream (export_type_t type)
+get_export_stream (enum export_type type)
{
FILE *stream;
int cancel;
@@ -263,7 +249,7 @@ get_export_stream (export_type_t type)
* (mainly used to export data).
*/
static void
-foreach_date_dump (const long date_end, struct rpt_s *rpt, struct days_s *exc,
+foreach_date_dump (const long date_end, struct rpt *rpt, struct days *exc,
long item_first_date, long item_dur, char *item_mesg,
cb_dump_t cb_dump, FILE *stream)
{
@@ -357,8 +343,8 @@ pcal_export_footer (FILE *stream)
static void
ical_export_recur_events (FILE *stream)
{
- struct recur_event_s *i;
- struct days_s *day;
+ struct recur_event *i;
+ struct days *day;
char ical_date[BUFSIZ];
for (i = recur_elist; i != 0; i = i->next)
@@ -422,7 +408,7 @@ pcal_dump_apoint (FILE *stream, long apoint_date, long apoint_dur,
static void
pcal_export_recur_events (FILE *stream)
{
- struct recur_event_s *i;
+ struct recur_event *i;
char pcal_date[BUFSIZ];
(void)fprintf (stream, "\n# =============");
@@ -476,7 +462,7 @@ pcal_export_recur_events (FILE *stream)
static void
ical_export_events (FILE *stream)
{
- struct event_s *i;
+ struct event *i;
char ical_date[BUFSIZ];
for (i = eventlist; i != 0; i = i->next)
@@ -492,7 +478,7 @@ ical_export_events (FILE *stream)
static void
pcal_export_events (FILE *stream)
{
- struct event_s *i;
+ struct event *i;
(void)fprintf (stream, "\n# ======\n# Events\n# ======\n");
for (i = eventlist; i != 0; i = i->next)
@@ -504,8 +490,8 @@ pcal_export_events (FILE *stream)
static void
ical_export_recur_apoints (FILE *stream)
{
- recur_apoint_llist_node_t *i;
- struct days_s *day;
+ struct recur_apoint *i;
+ struct days *day;
char ical_datetime[BUFSIZ];
char ical_date[BUFSIZ];
@@ -550,7 +536,7 @@ ical_export_recur_apoints (FILE *stream)
static void
pcal_export_recur_apoints (FILE *stream)
{
- recur_apoint_llist_node_t *i;
+ struct recur_apoint *i;
char pcal_date[BUFSIZ], pcal_beg[BUFSIZ], pcal_end[BUFSIZ];
(void)fprintf (stream, "\n# ==============");
@@ -609,7 +595,7 @@ pcal_export_recur_apoints (FILE *stream)
static void
ical_export_apoints (FILE *stream)
{
- apoint_llist_node_t *i;
+ struct apoint *i;
char ical_datetime[BUFSIZ];
pthread_mutex_lock (&(alist_p->mutex));
@@ -630,7 +616,7 @@ ical_export_apoints (FILE *stream)
static void
pcal_export_apoints (FILE *stream)
{
- apoint_llist_node_t *i;
+ struct apoint *i;
(void)fprintf (stream, "\n# ============\n# Appointments\n# ============\n");
pthread_mutex_lock (&(alist_p->mutex));
@@ -644,7 +630,7 @@ pcal_export_apoints (FILE *stream)
static void
ical_export_todo (FILE *stream)
{
- struct todo_s *i;
+ struct todo *i;
for (i = todolist; i != 0; i = i->next)
{
@@ -661,7 +647,7 @@ ical_export_todo (FILE *stream)
static void
pcal_export_todo (FILE *stream)
{
- struct todo_s *i;
+ struct todo *i;
(void)fprintf (stream, "#\n# Todos\n#\n");
for (i = todolist; i != 0; i = i->next)
@@ -831,7 +817,7 @@ static pthread_mutex_t io_save_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Save the user configuration. */
unsigned
-io_save_conf (conf_t *conf)
+io_save_conf (struct conf *conf)
{
char *config_txt =
"#\n"
@@ -969,8 +955,8 @@ io_save_conf (conf_t *conf)
unsigned
io_save_apts (void)
{
- apoint_llist_node_t *a;
- struct event_s *e;
+ struct apoint *a;
+ struct event *e;
FILE *fp;
if ((fp = fopen (path_apts, "w")) == 0)
@@ -996,7 +982,7 @@ io_save_apts (void)
unsigned
io_save_todo (void)
{
- struct todo_s *t;
+ struct todo *t;
FILE *fp;
if ((fp = fopen (path_todo, "w")) == 0)
@@ -1031,7 +1017,7 @@ io_save_keys (void)
/* Save the calendar data */
void
-io_save_cal (conf_t *conf, io_save_display_t display)
+io_save_cal (struct conf *conf, enum save_display display)
{
char *access_pb = _("Problems accessing data file ...");
char *save_success = _("The data files were successfully saved");
@@ -1089,7 +1075,7 @@ io_load_app (void)
FILE *data_file;
int c, is_appointment, is_event, is_recursive;
struct tm start, end, until, *lt;
- struct days_s *exc;
+ struct days *exc;
time_t t;
int id = 0;
int freq;
@@ -1367,7 +1353,7 @@ io_load_keys (char *pager)
struct ht_keybindings_s keys[NBKEYS];
FILE *keyfp;
char buf[BUFSIZ];
- io_file_t *log;
+ struct io_file *log;
int i, skipped, loaded, line;
const int MAX_ERRORS = 5;
@@ -1382,8 +1368,8 @@ io_load_keys (char *pager)
for (i = 0; i < NBKEYS; i++)
{
- keys[i].key = (keys_e)i;
- keys[i].label = keys_get_label ((keys_e)i);
+ keys[i].key = (enum key)i;
+ keys[i].label = keys_get_label ((enum key)i);
HTABLE_INSERT (ht_keybindings, &ht_keys, &keys[i]);
}
@@ -1611,7 +1597,7 @@ io_startup_screen (unsigned skip_dialogs, int no_data_file)
/* Export calcurse data. */
void
-io_export_data (export_type_t type, conf_t *conf)
+io_export_data (enum export_type type, struct conf *conf)
{
FILE *stream;
char *success = _("The data were successfully exported");
@@ -1739,7 +1725,7 @@ ical_store_todo (int priority, char *mesg, char *note)
static void
ical_store_event (char *mesg, char *note, long day, long end, ical_rpt_t *rpt,
- days_t *exc)
+ struct days *exc)
{
const int EVENTID = 1;
@@ -1771,7 +1757,7 @@ ical_store_event (char *mesg, char *note, long day, long end, ical_rpt_t *rpt,
static void
ical_store_apoint (char *mesg, char *note, long start, long dur,
- ical_rpt_t *rpt, days_t *exc, int has_alarm)
+ ical_rpt_t *rpt, struct days *exc, int has_alarm)
{
char state = 0L;
@@ -1922,7 +1908,7 @@ static float
ical_chk_header (FILE *fd, unsigned *lineno)
{
const int HEADER_MALFORMED = -1;
- const string_t icalheader = STRING_BUILD ("BEGIN:VCALENDAR");
+ const struct string icalheader = STRING_BUILD ("BEGIN:VCALENDAR");
char buf[BUFSIZ];
(void)fgets (buf, BUFSIZ, fd);
@@ -1971,7 +1957,7 @@ static long
ical_datetime2long (char *datestr, ical_vevent_e *type)
{
const int NOTFOUND = 0, FORMAT_DATE = 3, FORMAT_DATETIME = 5;
- date_t date;
+ struct date date;
unsigned hour, min;
long datelong;
int format;
@@ -2174,12 +2160,12 @@ static ical_rpt_t *
ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
const int itemline)
{
- const string_t daily = STRING_BUILD ("DAILY");
- const string_t weekly = STRING_BUILD ("WEEKLY");
- const string_t monthly = STRING_BUILD ("MONTHLY");
- const string_t yearly = STRING_BUILD ("YEARLY");
- const string_t count = STRING_BUILD ("COUNT=");
- const string_t interv = STRING_BUILD ("INTERVAL=");
+ const struct string daily = STRING_BUILD ("DAILY");
+ const struct string weekly = STRING_BUILD ("WEEKLY");
+ const struct string monthly = STRING_BUILD ("MONTHLY");
+ const struct string yearly = STRING_BUILD ("YEARLY");
+ const struct string count = STRING_BUILD ("COUNT=");
+ const struct string interv = STRING_BUILD ("INTERVAL=");
unsigned interval;
ical_rpt_t *rpt;
char *p;
@@ -2285,15 +2271,15 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
}
static void
-ical_add_exc (days_t **exc_head, long date)
+ical_add_exc (struct days **exc_head, long date)
{
if (date == 0)
return;
else
{
- struct days_s *exc;
+ struct days *exc;
- exc = mem_malloc (sizeof (struct days_s));
+ exc = mem_malloc (sizeof (struct days));
exc->st = date;
exc->next = *exc_head;
*exc_head = exc;
@@ -2304,11 +2290,11 @@ ical_add_exc (days_t **exc_head, long date)
* This property defines the list of date/time exceptions for a
* recurring calendar component.
*/
-static days_t *
+static struct days *
ical_read_exdate (FILE *log, char *exstr, unsigned *noskipped,
const int itemline)
{
- days_t *exc;
+ struct days *exc;
char *p, *q;
long date;
@@ -2394,7 +2380,6 @@ ical_read_note (char *first_line, FILE *fdi, unsigned *noskipped,
/* Returns an allocated string containing the ical item summary. */
static char *
-
ical_read_summary (char *first_line, FILE *fdi, unsigned *lineno)
{
char *p, *summary;
@@ -2414,20 +2399,20 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
unsigned *noskipped, unsigned *lineno)
{
const int ITEMLINE = *lineno;
- const string_t endevent = STRING_BUILD ("END:VEVENT");
- const string_t summary = STRING_BUILD ("SUMMARY:");
- const string_t dtstart = STRING_BUILD ("DTSTART");
- const string_t dtend = STRING_BUILD ("DTEND");
- const string_t duration = STRING_BUILD ("DURATION:");
- const string_t rrule = STRING_BUILD ("RRULE");
- const string_t exdate = STRING_BUILD ("EXDATE");
- const string_t alarm = STRING_BUILD ("BEGIN:VALARM");
- const string_t endalarm = STRING_BUILD ("END:VALARM");
- const string_t desc = STRING_BUILD ("DESCRIPTION");
+ const struct string endevent = STRING_BUILD ("END:VEVENT");
+ const struct string summary = STRING_BUILD ("SUMMARY:");
+ const struct string dtstart = STRING_BUILD ("DTSTART");
+ const struct string dtend = STRING_BUILD ("DTEND");
+ const struct string duration = STRING_BUILD ("DURATION:");
+ const struct string rrule = STRING_BUILD ("RRULE");
+ const struct string exdate = STRING_BUILD ("EXDATE");
+ const struct string alarm = STRING_BUILD ("BEGIN:VALARM");
+ const struct string endalarm = STRING_BUILD ("END:VALARM");
+ const struct string desc = STRING_BUILD ("DESCRIPTION");
ical_vevent_e vevent_type;
char *p, buf[BUFSIZ], buf_upper[BUFSIZ];
struct {
- days_t *exc;
+ struct days *exc;
ical_rpt_t *rpt;
char *mesg, *note;
long start, end, dur;
@@ -2607,11 +2592,11 @@ static void
ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
unsigned *lineno)
{
- const string_t endtodo = STRING_BUILD ("END:VTODO");
- const string_t summary = STRING_BUILD ("SUMMARY");
- const string_t alarm = STRING_BUILD ("BEGIN:VALARM");
- const string_t endalarm = STRING_BUILD ("END:VALARM");
- const string_t desc = STRING_BUILD ("DESCRIPTION");
+ const struct string endtodo = STRING_BUILD ("END:VTODO");
+ const struct string summary = STRING_BUILD ("SUMMARY");
+ const struct string alarm = STRING_BUILD ("BEGIN:VALARM");
+ const struct string endalarm = STRING_BUILD ("END:VALARM");
+ const struct string desc = STRING_BUILD ("DESCRIPTION");
const int LOWEST = 9;
const int ITEMLINE = *lineno;
char buf[BUFSIZ], buf_upper[BUFSIZ];
@@ -2701,7 +2686,7 @@ cleanup:
}
static FILE *
-get_import_stream (export_type_t type)
+get_import_stream (enum export_type type)
{
FILE *stream;
char *stream_name;
@@ -2742,10 +2727,10 @@ get_import_stream (export_type_t type)
* and is cleared at the end.
*/
void
-io_import_data (import_type_t type, conf_t *conf, char *stream_name)
+io_import_data (enum import_type type, struct conf *conf, char *stream_name)
{
- const string_t vevent = STRING_BUILD ("BEGIN:VEVENT");
- const string_t vtodo = STRING_BUILD ("BEGIN:VTODO");
+ const struct string vevent = STRING_BUILD ("BEGIN:VEVENT");
+ const struct string vtodo = STRING_BUILD ("BEGIN:VTODO");
char *proc_report = _("Import process report: %04d lines read ");
char *lines_stats =
_("%d apps / %d events / %d todos / %d skipped ");
@@ -2753,7 +2738,7 @@ io_import_data (import_type_t type, conf_t *conf, char *stream_name)
_("%d apps / %d events / %d todos / %d skipped ([ENTER] to continue)");
char buf[BUFSIZ];
FILE *stream = NULL;
- io_file_t *log;
+ struct io_file *log;
float ical_version;
struct {
unsigned events, apoints, todos, lines, skipped;
@@ -2844,17 +2829,17 @@ io_import_data (import_type_t type, conf_t *conf, char *stream_name)
io_log_free (log);
}
-io_file_t *
+struct io_file *
io_log_init (void)
{
const char *logprefix = "/tmp/calcurse_log.";
char *logname;
- io_file_t *log;
+ struct io_file *log;
logname = new_tempfile (logprefix, NOTESIZ);
RETVAL_IF (logname == 0, 0,
_("Warning: could not create temporary log file, Aborting..."));
- log = mem_malloc (sizeof (io_file_t));
+ log = mem_malloc (sizeof (struct io_file));
RETVAL_IF (log == 0, 0,
_("Warning: could not open temporary log file, Aborting..."));
(void)snprintf (log->name, sizeof (log->name), "%s%s", logprefix, logname);
@@ -2871,14 +2856,14 @@ io_log_init (void)
}
void
-io_log_print (io_file_t *log, int line, char *msg)
+io_log_print (struct io_file *log, int line, char *msg)
{
if (log && log->fd)
(void)fprintf (log->fd, "line %d: %s\n", line, msg);
}
void
-io_log_display (io_file_t *log, char *msg, char *pager)
+io_log_display (struct io_file *log, char *msg, char *pager)
{
char *choices = "[y/n] ";
int ans;
@@ -2913,7 +2898,7 @@ io_log_display (io_file_t *log, char *msg, char *pager)
}
void
-io_log_free (io_file_t *log)
+io_log_free (struct io_file *log)
{
if (!log)
return;
@@ -2929,10 +2914,10 @@ static pthread_t io_t_psave;
static void *
io_psave_thread (void *arg)
{
- conf_t *config;
+ struct conf *config;
int delay;
- config = (conf_t *)arg;
+ config = (struct conf *)arg;
delay = config->periodic_save;
EXIT_IF (delay < 0, _("Invalid delay"));
@@ -2945,7 +2930,7 @@ io_psave_thread (void *arg)
/* Launch the thread which handles periodic saves. */
void
-io_start_psave_thread (conf_t *conf)
+io_start_psave_thread (struct conf *conf)
{
pthread_create (&io_t_psave, NULL, io_psave_thread, (void *)conf);
}
diff --git a/src/io.h b/src/io.h
deleted file mode 100755
index 82b6f69..0000000
--- a/src/io.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $calcurse: io.h,v 1.27 2009/11/01 11:06:37 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_IO_H
-#define CALCURSE_IO_H
-
-#include "vars.h"
-
-typedef enum {
- IO_IMPORT_ICAL,
- IO_IMPORT_NBTYPES
-} import_type_t;
-
-typedef enum {
- IO_EXPORT_ICAL,
- IO_EXPORT_PCAL,
- IO_EXPORT_NBTYPES
-} export_type_t;
-
-typedef enum {
- IO_SAVE_DISPLAY_BAR,
- IO_SAVE_DISPLAY_MARK,
- IO_SAVE_DISPLAY_NONE
-} io_save_display_t;
-
-typedef struct {
- FILE *fd;
- char name[BUFSIZ];
-} io_file_t;
-
-unsigned io_fprintln (const char *, const char *, ...);
-void io_init (char *, char *);
-void io_extract_data (char *, const char *, int);
-unsigned io_save_conf (conf_t *);
-unsigned io_save_apts (void);
-unsigned io_save_todo (void);
-unsigned io_save_keys (void);
-void io_save_cal (conf_t *, io_save_display_t);
-void io_load_app (void);
-void io_load_todo (void);
-void io_load_keys (char *);
-void io_check_dir (char *, int *);
-unsigned io_file_exist (char *);
-void io_check_file (char *, int *);
-int io_check_data_files (void);
-void io_startup_screen (unsigned, int);
-void io_export_data (export_type_t, conf_t *);
-void io_export_bar (void);
-void io_import_data (import_type_t, conf_t *, char *);
-io_file_t *io_log_init (void);
-void io_log_print (io_file_t *, int, char *);
-void io_log_display (io_file_t *, char *, char *);
-void io_log_free (io_file_t *);
-void io_start_psave_thread (conf_t *);
-void io_stop_psave_thread (void);
-void io_set_lock (void);
-unsigned io_dump_pid (char *);
-unsigned io_get_pid (char *);
-
-#endif /* !CALCURSE_IO_H */
diff --git a/src/keys.c b/src/keys.c
index ef94efc..16a81d8 100755
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,9 +1,9 @@
-/* $calcurse: keys.c,v 1.17 2009/07/05 20:33:21 culot Exp $ */
+/* $calcurse: keys.c,v 1.18 2010/03/20 10:54:46 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2008-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2008-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,11 +39,7 @@
#include <string.h>
#include <math.h>
-#include "i18n.h"
-#include "utils.h"
-#include "custom.h"
-#include "mem.h"
-#include "keys.h"
+#include "calcurse.h"
#define MAXKEYVAL KEY_MAX /* ncurses defines KEY_MAX as maximum key value */
@@ -59,7 +55,7 @@ struct key_str_s {
static struct key_str_s *keys[NBKEYS];
-static keys_e actions[MAXKEYVAL];
+static enum key actions[MAXKEYVAL];
static struct keydef_s keydef[NBKEYS] = {
{"generic-cancel", "ESC"},
@@ -181,7 +177,7 @@ keys_dump_defaults (char *file)
}
char *
-keys_get_label (keys_e key)
+keys_get_label (enum key key)
{
EXIT_IF (key < 0 || key > NBKEYS,
_("FATAL ERROR: key value out of bounds"));
@@ -189,7 +185,7 @@ keys_get_label (keys_e key)
return keydef[key].label;
}
-keys_e
+enum key
keys_get_action (int pressed)
{
if (pressed < 0 || pressed > MAXKEYVAL)
@@ -198,7 +194,7 @@ keys_get_action (int pressed)
return actions[pressed];
}
-keys_e
+enum key
keys_getch (WINDOW *win)
{
int ch;
@@ -214,7 +210,7 @@ keys_getch (WINDOW *win)
}
static void
-add_key_str (keys_e action, int key)
+add_key_str (enum key action, int key)
{
struct key_str_s *new, **i;
@@ -242,7 +238,7 @@ add_key_str (keys_e action, int key)
}
int
-keys_assign_binding (int key, keys_e action)
+keys_assign_binding (int key, enum key action)
{
if (key < 0 || key > MAXKEYVAL || actions[key] != KEY_UNDEF)
return 1;
@@ -256,7 +252,7 @@ keys_assign_binding (int key, keys_e action)
}
static void
-del_key_str (keys_e action, int key)
+del_key_str (enum key action, int key)
{
struct key_str_s *old, **i;
char oldstr[BUFSIZ];
@@ -279,7 +275,7 @@ del_key_str (keys_e action, int key)
}
void
-keys_remove_binding (int key, keys_e action)
+keys_remove_binding (int key, enum key action)
{
if (key < 0 || key > MAXKEYVAL)
return;
@@ -293,16 +289,16 @@ keys_remove_binding (int key, keys_e action)
int
keys_str2int (char *key)
{
- const string_t CONTROL_KEY = STRING_BUILD ("C-");
- const string_t TAB_KEY = STRING_BUILD ("TAB");
- const string_t SPACE_KEY = STRING_BUILD ("SPC");
- const string_t ESCAPE_KEY = STRING_BUILD ("ESC");
- const string_t CURSES_KEY_UP = STRING_BUILD ("UP");
- const string_t CURSES_KEY_DOWN = STRING_BUILD ("DWN");
- const string_t CURSES_KEY_LEFT = STRING_BUILD ("LFT");
- const string_t CURSES_KEY_RIGHT = STRING_BUILD ("RGT");
- const string_t CURSES_KEY_HOME = STRING_BUILD ("KEY_HOME");
- const string_t CURSES_KEY_END = STRING_BUILD ("KEY_END");
+ const struct string CONTROL_KEY = STRING_BUILD ("C-");
+ const struct string TAB_KEY = STRING_BUILD ("TAB");
+ const struct string SPACE_KEY = STRING_BUILD ("SPC");
+ const struct string ESCAPE_KEY = STRING_BUILD ("ESC");
+ const struct string CURSES_KEY_UP = STRING_BUILD ("UP");
+ const struct string CURSES_KEY_DOWN = STRING_BUILD ("DWN");
+ const struct string CURSES_KEY_LEFT = STRING_BUILD ("LFT");
+ const struct string CURSES_KEY_RIGHT = STRING_BUILD ("RGT");
+ const struct string CURSES_KEY_HOME = STRING_BUILD ("KEY_HOME");
+ const struct string CURSES_KEY_END = STRING_BUILD ("KEY_END");
if (!key)
return -1;
@@ -366,7 +362,7 @@ keys_int2str (int key)
}
int
-keys_action_count_keys (keys_e action)
+keys_action_count_keys (enum key action)
{
struct key_str_s *key;
int i;
@@ -379,13 +375,13 @@ keys_action_count_keys (keys_e action)
}
char *
-keys_action_firstkey (keys_e action)
+keys_action_firstkey (enum key action)
{
return (keys[action] != NULL) ? keys[action]->str : "XXX";
}
char *
-keys_action_nkey (keys_e action, int keynum)
+keys_action_nkey (enum key action, int keynum)
{
struct key_str_s *key;
int i;
@@ -401,7 +397,7 @@ keys_action_nkey (keys_e action, int keynum)
}
char *
-keys_action_allkeys (keys_e action)
+keys_action_allkeys (enum key action)
{
static char keystr[BUFSIZ];
struct key_str_s *i;
@@ -451,7 +447,7 @@ keys_format_label (char *key, int keylen)
}
void
-keys_display_bindings_bar (WINDOW *win, binding_t **binding, int first_key,
+keys_display_bindings_bar (WINDOW *win, struct binding **binding, int first_key,
int last_key)
{
int i, j, cmdlen, space_between_cmds;
@@ -495,7 +491,7 @@ keys_display_bindings_bar (WINDOW *win, binding_t **binding, int first_key,
* (could not add the keys descriptions to keydef variable, because of i18n).
*/
void
-keys_popup_info (keys_e key)
+keys_popup_info (enum key key)
{
char *info[NBKEYS];
WINDOW *infowin;
diff --git a/src/keys.h b/src/keys.h
deleted file mode 100755
index fd3a7cd..0000000
--- a/src/keys.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $calcurse: keys.h,v 1.11 2009/07/05 20:33:21 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2008-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_KEYS_H
-#define CALCURSE_KEYS_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#elif defined HAVE_NCURSES_NCURSES_H
-#include <ncurses/ncurses.h>
-#elif defined HAVE_NCURSESW_NCURSES_H
-#include <ncursesw/ncurses.h>
-#else
-#error "Missing ncurses header. Aborting..."
-#endif
-
-#define CTRLVAL 0x1F
-#define CTRL(x) ((x) & CTRLVAL)
-#define ESCAPE 27
-#define TAB 9
-#define SPACE 32
-
-#define KEYS_KEYLEN 3 /* length of each keybinding */
-#define KEYS_LABELEN 8 /* length of command description */
-#define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */
-
-typedef enum
- {
- KEY_GENERIC_CANCEL,
- KEY_GENERIC_SELECT,
- KEY_GENERIC_CREDITS,
- KEY_GENERIC_HELP,
- KEY_GENERIC_QUIT,
- KEY_GENERIC_SAVE,
- KEY_GENERIC_CUT,
- KEY_GENERIC_PASTE,
- KEY_GENERIC_CHANGE_VIEW,
- KEY_GENERIC_IMPORT,
- KEY_GENERIC_EXPORT,
- KEY_GENERIC_GOTO,
- KEY_GENERIC_OTHER_CMD,
- KEY_GENERIC_CONFIG_MENU,
- KEY_GENERIC_REDRAW,
- KEY_GENERIC_ADD_APPT,
- KEY_GENERIC_ADD_TODO,
- KEY_GENERIC_NEXT_DAY,
- KEY_GENERIC_PREV_DAY,
- KEY_GENERIC_NEXT_WEEK,
- KEY_GENERIC_PREV_WEEK,
- KEY_GENERIC_SCROLL_DOWN,
- KEY_GENERIC_SCROLL_UP,
- KEY_GENERIC_GOTO_TODAY,
-
- KEY_MOVE_RIGHT,
- KEY_MOVE_LEFT,
- KEY_MOVE_DOWN,
- KEY_MOVE_UP,
- KEY_START_OF_WEEK,
- KEY_END_OF_WEEK,
- KEY_ADD_ITEM,
- KEY_DEL_ITEM,
- KEY_EDIT_ITEM,
- KEY_VIEW_ITEM,
- KEY_FLAG_ITEM,
- KEY_REPEAT_ITEM,
- KEY_EDIT_NOTE,
- KEY_VIEW_NOTE,
- KEY_RAISE_PRIORITY,
- KEY_LOWER_PRIORITY,
-
- NBKEYS,
- KEY_UNDEF
- }
-keys_e;
-
-typedef struct {
- char *label;
- keys_e action;
-} binding_t;
-
-void keys_init (void);
-void keys_free (void);
-void keys_dump_defaults (char *);
-char *keys_get_label (keys_e);
-keys_e keys_get_action (int);
-keys_e keys_getch (WINDOW *win);
-int keys_assign_binding (int, keys_e);
-void keys_remove_binding (int, keys_e);
-int keys_str2int (char *);
-char *keys_int2str (int);
-int keys_action_count_keys (keys_e);
-char *keys_action_firstkey (keys_e);
-char *keys_action_nkey (keys_e, int);
-char *keys_action_allkeys (keys_e);
-void keys_display_bindings_bar (WINDOW *, binding_t **, int, int);
-void keys_popup_info (keys_e);
-void keys_save_bindings (FILE *);
-int keys_check_missing_bindings (void);
-void keys_fill_missing (void);
-
-#endif /* CALCURSE_KEYS_H */
diff --git a/src/mem.c b/src/mem.c
index 7939e2b..482c7e0 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,9 +1,9 @@
-/* $calcurse: mem.c,v 1.6 2009/07/19 07:44:59 culot Exp $ */
+/* $calcurse: mem.c,v 1.7 2010/03/20 10:54:46 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2008-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2008-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,7 @@
#include <stdint.h>
#include <stdlib.h>
-#include "i18n.h"
-#include "utils.h"
-#include "mem.h"
+#include "calcurse.h"
enum {
BLK_STATE,
@@ -58,26 +56,26 @@ enum {
#define MAGIC_ALLOC 0xda
#define MAGIC_FREE 0xdf
-struct mem_blk_s {
+struct mem_blk {
unsigned id, size;
const char *pos;
- struct mem_blk_s *next;
+ struct mem_blk *next;
};
-typedef struct {
+struct mem_stats {
unsigned ncall, nalloc, nfree;
- struct mem_blk_s *blk;
-} mem_stats_t;
+ struct mem_blk *blk;
+};
-static mem_stats_t mstats;
+static struct mem_stats mstats;
static unsigned
stats_add_blk (size_t size, const char *pos)
{
- struct mem_blk_s *o, **i;
+ struct mem_blk *o, **i;
- o = malloc (sizeof (struct mem_blk_s));
+ o = malloc (sizeof (*o));
EXIT_IF (o == 0, _("could not allocate memory to store block info"));
mstats.ncall++;
@@ -98,7 +96,7 @@ stats_add_blk (size_t size, const char *pos)
static void
stats_del_blk (unsigned id)
{
- struct mem_blk_s *o, **i;
+ struct mem_blk *o, **i;
EXIT_IF (id < 0, _("Incorrect block id"));
@@ -289,7 +287,7 @@ dbg_free (void *ptr, const char *pos)
#ifdef CALCURSE_MEMORY_DEBUG
static void
-dump_block_info (struct mem_blk_s *blk)
+dump_block_info (struct mem_blk *blk)
{
if (blk == 0)
return;
@@ -315,7 +313,7 @@ mem_stats (void)
if (mstats.nfree < mstats.nalloc)
{
- struct mem_blk_s *blk;
+ struct mem_blk *blk;
for (blk = mstats.blk; blk; blk = blk->next)
dump_block_info (blk);
diff --git a/src/mem.h b/src/mem.h
deleted file mode 100644
index 62f8220..0000000
--- a/src/mem.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $calcurse: mem.h,v 1.3 2009/07/12 17:48:13 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2008-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_MEM_H
-#define CALCURSE_MEM_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include "utils.h"
-
-
-void *xmalloc (size_t);
-void *xcalloc (size_t, size_t);
-void *xrealloc (void *, size_t, size_t);
-char *xstrdup (const char *);
-void xfree (void *);
-
-#ifdef CALCURSE_MEMORY_DEBUG
-
-#define mem_malloc(s) dbg_malloc ((s), __FILE_POS__)
-#define mem_calloc(n, s) dbg_calloc ((n), (s), __FILE_POS__)
-#define mem_realloc(p, n, s) dbg_realloc ((p), (n), (s), __FILE_POS__)
-#define mem_strdup(s) dbg_strdup ((s), __FILE_POS__)
-#define mem_free(p) dbg_free ((p), __FILE_POS__)
-
-void *dbg_malloc (size_t, const char *);
-void *dbg_calloc (size_t, size_t, const char *);
-void *dbg_realloc (void *, size_t, size_t, const char *);
-char *dbg_strdup (const char *, const char *);
-void dbg_free (void *, const char *);
-void mem_stats (void);
-
-#else /* !CALCURSE_MEMORY_DEBUG */
-
-#define mem_malloc(s) xmalloc ((s))
-#define mem_calloc(n, s) xcalloc ((n), (s))
-#define mem_realloc(p, n, s) xrealloc ((p), (n), (s))
-#define mem_strdup(s) xstrdup ((s))
-#define mem_free(p) xfree ((p))
-#define mem_stats()
-
-#endif /* CALCURSE_MEMORY_DEBUG */
-
-#endif /* CALCURSE_MEM_H */
diff --git a/src/notify.c b/src/notify.c
index 364b4d2..1695faf 100755
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,9 +1,9 @@
-/* $calcurse: notify.c,v 1.48 2010/02/14 17:29:16 culot Exp $ */
+/* $calcurse: notify.c,v 1.49 2010/03/20 10:54:47 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,19 +41,20 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
+#include "calcurse.h"
-#include "i18n.h"
-#include "utils.h"
-#include "custom.h"
-#include "keys.h"
-#include "mem.h"
-#include "notify.h"
+#define NOTIFY_FIELD_LENGTH 25
-static struct notify_vars_s notify;
-static struct notify_app_s notify_app;
+struct notify_vars {
+ WINDOW *win;
+ char *apts_file;
+ char time[NOTIFY_FIELD_LENGTH];
+ char date[NOTIFY_FIELD_LENGTH];
+ pthread_mutex_t mutex;
+};
+
+static struct notify_vars notify;
+static struct notify_app notify_app;
static pthread_attr_t detached_thread_attr;
static pthread_t notify_t_main;
@@ -364,7 +365,7 @@ notify_main_thread (void *arg)
/* Fill the given structure with information about next appointment. */
unsigned
-notify_get_next (struct notify_app_s *a)
+notify_get_next (struct notify_app *a)
{
time_t current_time;
@@ -390,7 +391,7 @@ notify_get_next (struct notify_app_s *a)
unsigned
notify_get_next_bkgd (void)
{
- struct notify_app_s a;
+ struct notify_app a;
a.txt = (char *)0;
if (!notify_get_next (&a))
@@ -429,7 +430,7 @@ notify_app_txt (void)
static void *
notify_thread_app (void *arg)
{
- struct notify_app_s tmp_app;
+ struct notify_app tmp_app;
if (!notify_get_next (&tmp_app))
pthread_exit ((void *)0);
@@ -501,7 +502,7 @@ notify_check_added (char *mesg, long start, char state)
/* Check if the newly repeated appointment is to be notified. */
void
-notify_check_repeated (recur_apoint_llist_node_t *i)
+notify_check_repeated (struct recur_apoint *i)
{
long real_app_time;
int update_notify = 0;
@@ -549,7 +550,7 @@ notify_same_item (long time)
}
int
-notify_same_recur_item (recur_apoint_llist_node_t *i)
+notify_same_recur_item (struct recur_apoint *i)
{
int same = 0;
long item_start = 0;
@@ -684,7 +685,7 @@ print_config_options (WINDOW *optwin)
}
static void
-reinit_conf_win (scrollwin_t *win)
+reinit_conf_win (struct scrollwin *win)
{
unsigned first_line;
@@ -700,7 +701,7 @@ reinit_conf_win (scrollwin_t *win)
void
notify_config_bar (void)
{
- scrollwin_t cwin;
+ struct scrollwin cwin;
char *buf;
char *number_str =
_("Enter an option number to change its value");
diff --git a/src/notify.h b/src/notify.h
deleted file mode 100755
index 0e21198..0000000
--- a/src/notify.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $calcurse: notify.h,v 1.21 2009/08/01 20:29:50 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_NOTIFY_H
-#define CALCURSE_NOTIFY_H
-
-#include "wins.h"
-#include "apoint.h"
-#include "recur.h"
-
-#define NOTIFY_FIELD_LENGTH 25
-
-struct notify_vars_s
-{
- WINDOW *win;
- char *apts_file;
- char time[NOTIFY_FIELD_LENGTH];
- char date[NOTIFY_FIELD_LENGTH];
- pthread_mutex_t mutex;
-};
-
-struct notify_app_s
-{
- long time;
- int got_app;
- char *txt;
- char state;
- pthread_mutex_t mutex;
-};
-
-int notify_time_left (void);
-unsigned notify_needs_reminder (void);
-void notify_update_app (long, char, char *);
-int notify_bar (void);
-void notify_init_vars (void);
-void notify_init_bar (void);
-void notify_free_app (void);
-void notify_start_main_thread (void);
-void notify_stop_main_thread (void);
-void notify_reinit_bar (void);
-unsigned notify_launch_cmd (void);
-void notify_update_bar (void);
-unsigned notify_get_next (struct notify_app_s *);
-unsigned notify_get_next_bkgd (void);
-char *notify_app_txt (void);
-void notify_check_next_app (void);
-void notify_check_added (char *, long, char);
-void notify_check_repeated (recur_apoint_llist_node_t *);
-int notify_same_item (long);
-int notify_same_recur_item (recur_apoint_llist_node_t *);
-void notify_config_bar (void);
-
-#endif /* CALCURSE_NOTIFY_H */
diff --git a/src/recur.c b/src/recur.c
index 5d06726..34910a4 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.53 2010/03/08 08:44:44 culot Exp $ */
+/* $calcurse: recur.c,v 1.54 2010/03/20 10:54:47 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -42,24 +42,18 @@
#include <sys/types.h>
#include <time.h>
-#include "i18n.h"
-#include "utils.h"
-#include "notify.h"
-#include "day.h"
-#include "keys.h"
-#include "mem.h"
-#include "recur.h"
+#include "calcurse.h"
-recur_apoint_llist_t *recur_alist_p;
-struct recur_event_s *recur_elist;
-static struct recur_event_s bkp_cut_recur_event;
-static recur_apoint_llist_node_t bkp_cut_recur_apoint;
+struct recur_apoint_list *recur_alist_p;
+struct recur_event *recur_elist;
+static struct recur_event bkp_cut_recur_event;
+static struct recur_apoint bkp_cut_recur_apoint;
static void
-free_exc (struct days_s *exc)
+free_exc (struct days *exc)
{
- struct days_s *o, **i;
+ struct days *o, **i;
i = &exc;
while (*i)
@@ -71,11 +65,11 @@ free_exc (struct days_s *exc)
}
static void
-recur_add_exc (struct days_s **exc, long day)
+recur_add_exc (struct days **exc, long day)
{
- struct days_s **i, *o;
+ struct days **i, *o;
- o = mem_malloc (sizeof (struct days_s));
+ o = mem_malloc (sizeof (struct days));
o->st = day;
i = exc;
for (;;)
@@ -91,16 +85,16 @@ recur_add_exc (struct days_s **exc, long day)
}
static void
-exc_dup (struct days_s **in, struct days_s *exc)
+exc_dup (struct days **in, struct days *exc)
{
- struct days_s *p;
+ struct days *p;
for (p = exc; p; p = p->next)
recur_add_exc (in, p->st);
}
void
-recur_event_free_bkp (erase_flag_e flag)
+recur_event_free_bkp (enum eraseflg flag)
{
if (bkp_cut_recur_event.mesg)
{
@@ -121,7 +115,7 @@ recur_event_free_bkp (erase_flag_e flag)
}
void
-recur_apoint_free_bkp (erase_flag_e flag)
+recur_apoint_free_bkp (enum eraseflg flag)
{
if (bkp_cut_recur_apoint.mesg)
{
@@ -142,7 +136,7 @@ recur_apoint_free_bkp (erase_flag_e flag)
}
static void
-recur_event_dup (struct recur_event_s *in, struct recur_event_s *bkp)
+recur_event_dup (struct recur_event *in, struct recur_event *bkp)
{
EXIT_IF (!in || !bkp, _("null pointer"));
@@ -150,7 +144,7 @@ recur_event_dup (struct recur_event_s *in, struct recur_event_s *bkp)
bkp->day = in->day;
bkp->mesg = mem_strdup (in->mesg);
- bkp->rpt = mem_malloc (sizeof (struct rpt_s));
+ bkp->rpt = mem_malloc (sizeof (struct rpt));
bkp->rpt->type = in->rpt->type;
bkp->rpt->freq = in->rpt->freq;
bkp->rpt->until = in->rpt->until;
@@ -163,7 +157,7 @@ recur_event_dup (struct recur_event_s *in, struct recur_event_s *bkp)
}
static void
-recur_apoint_dup (recur_apoint_llist_node_t *in, recur_apoint_llist_node_t *bkp)
+recur_apoint_dup (struct recur_apoint *in, struct recur_apoint *bkp)
{
EXIT_IF (!in || !bkp, _("null pointer"));
@@ -172,7 +166,7 @@ recur_apoint_dup (recur_apoint_llist_node_t *in, recur_apoint_llist_node_t *bkp)
bkp->state = in->state;
bkp->mesg = mem_strdup (in->mesg);
- bkp->rpt = mem_malloc (sizeof (struct rpt_s));
+ bkp->rpt = mem_malloc (sizeof (struct rpt));
bkp->rpt->type = in->rpt->type;
bkp->rpt->freq = in->rpt->freq;
bkp->rpt->until = in->rpt->until;
@@ -187,7 +181,7 @@ recur_apoint_dup (recur_apoint_llist_node_t *in, recur_apoint_llist_node_t *bkp)
void
recur_apoint_llist_init (void)
{
- recur_alist_p = mem_malloc (sizeof (recur_apoint_llist_t));
+ recur_alist_p = mem_malloc (sizeof (struct recur_apoint_list));
recur_alist_p->root = NULL;
pthread_mutex_init (&(recur_alist_p->mutex), NULL);
}
@@ -195,7 +189,7 @@ recur_apoint_llist_init (void)
void
recur_apoint_llist_free (void)
{
- recur_apoint_llist_node_t *o, **i;
+ struct recur_apoint *o, **i;
i = &recur_alist_p->root;
while (*i)
@@ -220,7 +214,7 @@ recur_apoint_llist_free (void)
void
recur_event_llist_free (void)
{
- struct recur_event_s *o, **i;
+ struct recur_event *o, **i;
i = &recur_elist;
while (*i)
@@ -242,14 +236,14 @@ recur_event_llist_free (void)
}
/* Insert a new recursive appointment in the general linked list */
-recur_apoint_llist_node_t *
+struct recur_apoint *
recur_apoint_new (char *mesg, char *note, long start, long dur, char state,
- int type, int freq, long until, struct days_s **except)
+ int type, int freq, long until, struct days **except)
{
- recur_apoint_llist_node_t *o, **i;
+ struct recur_apoint *o, **i;
- o = mem_malloc (sizeof (recur_apoint_llist_node_t));
- o->rpt = mem_malloc (sizeof (struct rpt_s));
+ o = mem_malloc (sizeof (struct recur_apoint));
+ o->rpt = mem_malloc (sizeof (struct rpt));
o->mesg = mem_strdup (mesg);
o->note = (note != 0) ? mem_strdup (note) : 0;
o->start = start;
@@ -284,14 +278,14 @@ recur_apoint_new (char *mesg, char *note, long start, long dur, char state,
}
/* Insert a new recursive event in the general linked list */
-struct recur_event_s *
+struct recur_event *
recur_event_new (char *mesg, char *note, long day, int id, int type, int freq,
- long until, struct days_s **except)
+ long until, struct days **except)
{
- struct recur_event_s *o, **i;
+ struct recur_event *o, **i;
- o = mem_malloc (sizeof (struct recur_event_s));
- o->rpt = mem_malloc (sizeof (struct rpt_s));
+ o = mem_malloc (sizeof (struct recur_event));
+ o->rpt = mem_malloc (sizeof (struct rpt));
o->mesg = mem_strdup (mesg);
o->note = (note != 0) ? mem_strdup (note) : 0;
o->day = day;
@@ -326,7 +320,7 @@ recur_event_new (char *mesg, char *note, long day, int id, int type, int freq,
* and the letter to be written in file.
*/
char
-recur_def2char (recur_types_t define)
+recur_def2char (enum recur_type define)
{
char recur_char;
@@ -384,7 +378,7 @@ recur_char2def (char type)
/* Write days for which recurrent items should not be repeated. */
static void
-recur_write_exc (struct days_s *exc, FILE *f)
+recur_write_exc (struct days *exc, FILE *f)
{
struct tm *lt;
time_t t;
@@ -403,9 +397,9 @@ recur_write_exc (struct days_s *exc, FILE *f)
}
/* Load the recursive appointment description */
-recur_apoint_llist_node_t *
+struct recur_apoint *
recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
- int freq, struct tm until, char *note, struct days_s **exc,
+ int freq, struct tm until, char *note, struct days **exc,
char state)
{
struct tm *lt;
@@ -453,9 +447,9 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
}
/* Load the recursive events from file */
-struct recur_event_s *
+struct recur_event *
recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
- struct tm until, char *note, struct days_s **exc)
+ struct tm until, char *note, struct days **exc)
{
char buf[BUFSIZ], *nl;
time_t tstart, tuntil;
@@ -493,7 +487,7 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
/* Writting of a recursive appointment into file. */
static void
-recur_apoint_write (recur_apoint_llist_node_t *o, FILE *f)
+recur_apoint_write (struct recur_apoint *o, FILE *f)
{
struct tm *lt;
time_t t;
@@ -536,7 +530,7 @@ recur_apoint_write (recur_apoint_llist_node_t *o, FILE *f)
/* Writting of a recursive event into file. */
static void
-recur_event_write (struct recur_event_s *o, FILE *f)
+recur_event_write (struct recur_event *o, FILE *f)
{
struct tm *lt;
time_t t;
@@ -578,8 +572,8 @@ recur_event_write (struct recur_event_s *o, FILE *f)
void
recur_save_data (FILE *f)
{
- struct recur_event_s *re;
- recur_apoint_llist_node_t *ra;
+ struct recur_event *re;
+ struct recur_apoint *ra;
for (re = recur_elist; re != 0; re = re->next)
recur_event_write (re, f);
@@ -664,13 +658,13 @@ diff_years (struct tm lt_start, struct tm lt_end)
* calculation of recurrent dates after a turn of years.
*/
unsigned
-recur_item_inday (long item_start, struct days_s *item_exc, int rpt_type,
+recur_item_inday (long item_start, struct days *item_exc, int rpt_type,
int rpt_freq, long rpt_until, long day_start)
{
- date_t start_date;
+ struct date start_date;
long day_end, diff;
struct tm lt_item, lt_day;
- struct days_s *exc;
+ struct days *exc;
time_t t;
day_end = day_start + DAYINSEC;
@@ -746,10 +740,10 @@ recur_item_inday (long item_start, struct days_s *item_exc, int rpt_type,
*/
void
recur_event_erase (long start, unsigned num, unsigned delete_whole,
- erase_flag_e flag)
+ enum eraseflg flag)
{
unsigned n = 0;
- struct recur_event_s *i, **iptr;
+ struct recur_event *i, **iptr;
iptr = &recur_elist;
for (i = recur_elist; i != 0; i = i->next)
@@ -811,10 +805,10 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole,
*/
void
recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
- erase_flag_e flag)
+ enum eraseflg flag)
{
unsigned n = 0;
- recur_apoint_llist_node_t *i, **iptr;
+ struct recur_apoint *i, **iptr;
int need_check_notify = 0;
pthread_mutex_lock (&(recur_alist_p->mutex));
@@ -888,14 +882,14 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole,
* and then delete the selected item to recreate it as a recurrent one
*/
void
-recur_repeat_item (conf_t *conf)
+recur_repeat_item (struct conf *conf)
{
struct tm *lt;
time_t t;
int ch = 0;
int date_entered = 0;
int year = 0, month = 0, day = 0;
- date_t until_date;
+ struct date until_date;
char outstr[BUFSIZ];
char user_input[BUFSIZ] = "";
char *mesg_type_1 =
@@ -914,9 +908,9 @@ recur_repeat_item (conf_t *conf)
_("Sorry, the date you entered is older than the item start time.");
int type = 0, freq = 0;
int item_nb;
- struct day_item_s *p;
- recur_apoint_llist_node_t *ra;
- struct recur_event_s *re;
+ struct day_item *p;
+ struct recur_apoint *ra;
+ struct recur_event *re;
long until, date;
item_nb = apoint_hilt ();
@@ -1035,12 +1029,12 @@ recur_repeat_item (conf_t *conf)
* Read days for which recurrent items must not be repeated
* (such days are called exceptions).
*/
-struct days_s *
+struct days *
recur_exc_scan (FILE *data_file)
{
int c = 0;
struct tm day;
- struct days_s *exc_head, *exc;
+ struct days *exc_head, *exc;
exc_head = 0;
while ((c = getc (data_file)) == '!')
@@ -1056,7 +1050,7 @@ recur_exc_scan (FILE *data_file)
day.tm_isdst = -1;
day.tm_year -= 1900;
day.tm_mon--;
- exc = mem_malloc (sizeof (struct days_s));
+ exc = mem_malloc (sizeof (struct days));
exc->st = mktime (&day);
exc->next = exc_head;
exc_head = exc;
@@ -1068,10 +1062,10 @@ recur_exc_scan (FILE *data_file)
* Look in the appointment list if we have an item which starts before the item
* stored in the notify_app structure (which is the next item to be notified).
*/
-struct notify_app_s *
-recur_apoint_check_next (struct notify_app_s *app, long start, long day)
+struct notify_app *
+recur_apoint_check_next (struct notify_app *app, long start, long day)
{
- recur_apoint_llist_node_t *i;
+ struct recur_apoint *i;
long real_recur_start_time;
pthread_mutex_lock (&(recur_alist_p->mutex));
@@ -1102,10 +1096,10 @@ recur_apoint_check_next (struct notify_app_s *app, long start, long day)
}
/* Returns a structure containing the selected recurrent appointment. */
-recur_apoint_llist_node_t *
+struct recur_apoint *
recur_get_apoint (long date, int num)
{
- recur_apoint_llist_node_t *o;
+ struct recur_apoint *o;
int n = 0;
pthread_mutex_lock (&(recur_alist_p->mutex));
@@ -1128,10 +1122,10 @@ recur_get_apoint (long date, int num)
}
/* Returns a structure containing the selected recurrent event. */
-struct recur_event_s *
+struct recur_event *
recur_get_event (long date, int num)
{
- struct recur_event_s *o;
+ struct recur_event *o;
int n = 0;
for (o = recur_elist; o != 0; o = o->next)
@@ -1156,7 +1150,7 @@ void
recur_apoint_switch_notify (long date, int recur_nb)
{
int n, need_chk_notify;
- recur_apoint_llist_node_t *o;
+ struct recur_apoint *o;
n = 0;
need_chk_notify = 0;
@@ -1199,7 +1193,7 @@ recur_event_paste_item (void)
bkp_cut_recur_event.rpt->until += time_shift;
if (bkp_cut_recur_event.exc)
{
- struct days_s *exc;
+ struct days *exc;
for (exc = bkp_cut_recur_event.exc; exc != 0; exc = exc->next)
exc->st += time_shift;
@@ -1229,7 +1223,7 @@ recur_apoint_paste_item (void)
bkp_cut_recur_apoint.rpt->until += time_shift;
if (bkp_cut_recur_apoint.exc)
{
- struct days_s *exc;
+ struct days *exc;
for (exc = bkp_cut_recur_apoint.exc; exc != 0; exc = exc->next)
exc->st += time_shift;
diff --git a/src/recur.h b/src/recur.h
deleted file mode 100755
index 5d5195a..0000000
--- a/src/recur.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $calcurse: recur.h,v 1.27 2009/07/05 20:33:23 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_RECUR_H
-#define CALCURSE_RECUR_H
-
-typedef enum
-{ RECUR_NO,
- RECUR_DAILY,
- RECUR_WEEKLY,
- RECUR_MONTHLY,
- RECUR_YEARLY,
- RECUR_TYPES
-}
-recur_types_t;
-
-typedef struct days_s
-{
- struct days_s *next;
- long st; /* beggining of the considered day, in seconds */
-} days_t;
-
-struct rpt_s
-{
- int type; /* repetition type, see RECUR_* defines */
- int freq; /* repetition frequence */
- long until; /* ending date for repeated event */
-};
-
-typedef struct recur_apoint_llist_node
-{
- struct recur_apoint_llist_node *next;
- struct rpt_s *rpt; /* information about repetition */
- struct days_s *exc; /* days when the item should not be repeated */
- long start; /* beggining of the appointment */
- long dur; /* duration of the appointment */
- char state; /* 8 bits to store item state */
- char *mesg; /* appointment description */
- char *note; /* note attached to appointment */
-}
-recur_apoint_llist_node_t;
-
-typedef struct recur_apoint_llist
-{
- recur_apoint_llist_node_t *root;
- pthread_mutex_t mutex;
-}
-recur_apoint_llist_t;
-
-struct recur_event_s
-{
- struct recur_event_s *next;
- struct rpt_s *rpt; /* information about repetition */
- struct days_s *exc; /* days when the item should not be repeated */
- int id; /* event type */
- long day; /* day at which event occurs */
- char *mesg; /* event description */
- char *note; /* note attached to event */
-};
-
-typedef void (*recur_cb_foreach_date_t)(FILE *, long, char *);
-
-extern recur_apoint_llist_t *recur_alist_p;
-extern struct recur_event_s *recur_elist;
-
-void recur_event_free_bkp (erase_flag_e);
-void recur_apoint_free_bkp (erase_flag_e);
-void recur_apoint_llist_init (void);
-void recur_apoint_llist_free (void);
-void recur_event_llist_free (void);
-recur_apoint_llist_node_t *recur_apoint_new (char *, char *, long, long, char,
- int, int, long, struct days_s **);
-struct recur_event_s *recur_event_new (char *, char *, long, int, int, int,
- long, struct days_s **);
-char recur_def2char (recur_types_t);
-int recur_char2def (char);
-recur_apoint_llist_node_t *recur_apoint_scan (FILE *, struct tm, struct tm,
- char, int, struct tm, char *,
- struct days_s **, char);
-struct recur_event_s *recur_event_scan (FILE *, struct tm, int, char,
- int, struct tm, char *,
- struct days_s **);
-void recur_save_data (FILE *);
-unsigned recur_item_inday (long, struct days_s *, int, int,
- long, long);
-void recur_event_erase (long, unsigned, unsigned,
- erase_flag_e);
-void recur_apoint_erase (long, unsigned, unsigned,
- erase_flag_e);
-void recur_repeat_item (conf_t *);
-struct days_s *recur_exc_scan (FILE *);
-struct notify_app_s *recur_apoint_check_next (struct notify_app_s *,
- long, long);
-recur_apoint_llist_node_t *recur_get_apoint (long, int);
-struct recur_event_s *recur_get_event (long, int);
-void recur_apoint_switch_notify (long, int);
-void recur_event_paste_item (void);
-void recur_apoint_paste_item (void);
-
-#endif /* CALCURSE_RECUR_H */
diff --git a/src/sigs.c b/src/sigs.c
index bfe6ee1..2a24492 100755
--- a/src/sigs.c
+++ b/src/sigs.c
@@ -1,9 +1,9 @@
-/* $calcurse: sigs.c,v 1.10 2009/08/09 15:49:58 culot Exp $ */
+/* $calcurse: sigs.c,v 1.11 2010/03/20 10:54:48 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2007-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2007-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,10 +41,9 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include <signal.h>
-#include "i18n.h"
-#include "utils.h"
-#include "sigs.h"
+#include "calcurse.h"
/*
* General signal handling routine.
diff --git a/src/sigs.h b/src/sigs.h
deleted file mode 100755
index 5f1a6d2..0000000
--- a/src/sigs.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $calcurse: sigs.h,v 1.5 2009/07/19 16:51:36 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2007-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_SIGS_H
-#define CALCURSE_SIGS_H
-
-#include <signal.h>
-
-void sigs_init (void);
-unsigned sigs_set_hdlr (int, void (*)(int));
-
-#endif /* CALCURSE_SIGS_H */
diff --git a/src/todo.c b/src/todo.c
index 3d5ff10..8771e4e 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,9 +1,9 @@
-/* $calcurse: todo.c,v 1.35 2009/07/19 08:20:01 culot Exp $ */
+/* $calcurse: todo.c,v 1.36 2010/03/20 10:54:48 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,24 +40,19 @@
#include <string.h>
#include <unistd.h>
-#include "utils.h"
-#include "custom.h"
-#include "keys.h"
-#include "i18n.h"
-#include "mem.h"
-#include "todo.h"
+#include "calcurse.h"
-struct todo_s *todolist;
+struct todo *todolist;
static int hilt = 0;
static int todos = 0;
static int first = 1;
static char *msgsav;
/* Returns a structure containing the selected item. */
-static struct todo_s *
+static struct todo *
todo_get_item (int item_number)
{
- struct todo_s *o;
+ struct todo *o;
int i;
o = todolist;
@@ -169,13 +164,13 @@ todo_new_item (void)
/*
* Add an item in the todo linked list.
*/
-struct todo_s *
+struct todo *
todo_add (char *mesg, int id, char *note)
{
- struct todo_s *o, **i;
+ struct todo *o, **i;
int absid;
- o = (struct todo_s *) mem_malloc (sizeof (struct todo_s));
+ o = mem_malloc (sizeof (struct todo));
o->mesg = mem_strdup (mesg);
o->id = id;
o->note = (note != NULL && note[0] != '\0') ? mem_strdup (note) : NULL;
@@ -205,7 +200,7 @@ static void
todo_delete_note_bynum (unsigned num)
{
unsigned n;
- struct todo_s *i, **iptr;
+ struct todo *i, **iptr;
n = 0;
iptr = &todolist;
@@ -227,10 +222,10 @@ todo_delete_note_bynum (unsigned num)
/* Delete an item from the todo linked list. */
static void
-todo_delete_bynum (unsigned num, erase_flag_e flag)
+todo_delete_bynum (unsigned num, enum eraseflg flag)
{
unsigned n;
- struct todo_s *i, **iptr;
+ struct todo *i, **iptr;
n = 0;
iptr = &todolist;
@@ -260,7 +255,7 @@ todo_delete_bynum (unsigned num, erase_flag_e flag)
void
todo_flag (void)
{
- struct todo_s *t;
+ struct todo *t;
t = todo_get_item (hilt);
t->id = -t->id;
@@ -268,7 +263,7 @@ todo_flag (void)
/* Delete an item from the ToDo list. */
void
-todo_delete (conf_t *conf)
+todo_delete (struct conf *conf)
{
char *choices = "[y/n] ";
char *del_todo_str = _("Do you really want to delete this task ?");
@@ -336,12 +331,12 @@ todo_delete (conf_t *conf)
/*
* Returns the position into the linked list corresponding to the
- * given todo_s item.
+ * given todo item.
*/
static int
-todo_get_position (struct todo_s *i)
+todo_get_position (struct todo *i)
{
- struct todo_s *o;
+ struct todo *o;
int n = 1, found = 0;
for (o = todolist; o; o = o->next)
@@ -368,7 +363,7 @@ todo_get_position (struct todo_s *i)
void
todo_chg_priority (int action)
{
- struct todo_s *backup;
+ struct todo *backup;
char backup_mesg[BUFSIZ];
int backup_id;
char backup_note[NOTESIZ + 1];
@@ -405,7 +400,7 @@ todo_chg_priority (int action)
void
todo_edit_item (void)
{
- struct todo_s *i;
+ struct todo *i;
char *mesg = _("Enter the new ToDo description :");
status_mesg (mesg, "");
@@ -447,7 +442,7 @@ display_todo_item (int incolor, char *msg, int prio, int note, int len, int y,
void
todo_update_panel (int which_pan)
{
- struct todo_s *i;
+ struct todo *i;
int len = win[TOD].w - 8;
int num_todo = 0;
int y_offset = 3, x_offset = 1;
@@ -498,7 +493,7 @@ todo_update_panel (int which_pan)
void
todo_edit_note (char *editor)
{
- struct todo_s *i;
+ struct todo *i;
char fullname[BUFSIZ];
char *filename;
@@ -518,7 +513,7 @@ todo_edit_note (char *editor)
void
todo_view_note (char *pager)
{
- struct todo_s *i;
+ struct todo *i;
char fullname[BUFSIZ];
i = todo_get_item (hilt);
@@ -531,7 +526,7 @@ todo_view_note (char *pager)
void
todo_free_list (void)
{
- struct todo_s *o, **i;
+ struct todo *o, **i;
i = &todolist;
while (*i)
diff --git a/src/todo.h b/src/todo.h
deleted file mode 100755
index 7cc3475..0000000
--- a/src/todo.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $calcurse: todo.h,v 1.15 2009/07/05 20:33:24 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_TODO_H
-#define CALCURSE_TODO_H
-
-struct todo_s
-{
- struct todo_s *next;
- char *mesg;
- int id;
- char *note;
-};
-
-extern struct todo_s *todolist;
-
-void todo_hilt_set (int);
-void todo_hilt_decrease (void);
-void todo_hilt_increase (void);
-int todo_hilt (void);
-int todo_nb (void);
-void todo_set_nb (int);
-void todo_set_first (int);
-void todo_first_increase (void);
-void todo_first_decrease (void);
-int todo_hilt_pos (void);
-char *todo_saved_mesg (void);
-void todo_new_item (void);
-struct todo_s *todo_add (char *, int, char *);
-void todo_flag (void);
-void todo_delete (conf_t *);
-void todo_chg_priority (int);
-void todo_edit_item (void);
-void todo_update_panel (int);
-void todo_edit_note (char *);
-void todo_view_note (char *);
-void todo_free_list (void);
-
-#endif /* CALCURSE_TODO_H */
diff --git a/src/utils.c b/src/utils.c
index 2354ad1..ce976e6 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,9 +1,9 @@
-/* $calcurse: utils.c,v 1.82 2009/08/01 17:53:11 culot Exp $ */
+/* $calcurse: utils.c,v 1.83 2010/03/20 10:54:49 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,20 +45,7 @@
#include <sys/types.h>
#include <errno.h>
-#include "utils.h"
-#include "i18n.h"
-#include "wins.h"
-#include "custom.h"
-#include "keys.h"
-#include "io.h"
-#include "recur.h"
-#include "event.h"
-#include "apoint.h"
-#include "todo.h"
-#include "day.h"
-#include "keys.h"
-#include "dmon.h"
-#include "mem.h"
+#include "calcurse.h"
/* General routine to exit calcurse properly. */
void
@@ -331,7 +318,7 @@ add_char (int pos, int ch, char *str)
* environment, otherwise the cursor would move from place to place without
* control.
*/
-int
+enum getstr
getstring (WINDOW *win, char *str, int l, int x, int y)
{
int ch, newpos, len = 0;
@@ -503,7 +490,7 @@ get_item_min (long date)
}
long
-date2sec (date_t day, unsigned hour, unsigned min)
+date2sec (struct date day, unsigned hour, unsigned min)
{
struct tm start, *lt;
time_t tstart, t;
@@ -622,7 +609,7 @@ update_time_in_date (long date, unsigned hr, unsigned mn)
* If no date is entered, current date is chosen.
*/
long
-get_sec_date (date_t date)
+get_sec_date (struct date date)
{
struct tm *ptrtime;
time_t timer;
@@ -752,7 +739,7 @@ get_today (void)
struct tm *lt;
time_t current_time;
long current_day;
- date_t day;
+ struct date day;
current_time = time (NULL);
lt = localtime (&current_time);
@@ -866,7 +853,7 @@ new_tempfile (const char *prefix, int trailing_len)
/* Erase a note previously attached to a todo, event or appointment. */
void
-erase_note (char **note, erase_flag_e flag)
+erase_note (char **note, enum eraseflg flag)
{
char fullname[BUFSIZ];
@@ -888,7 +875,8 @@ erase_note (char **note, erase_flag_e flag)
* Returns 1 if sucessfully converted or 0 if the string is an invalid date.
*/
int
-parse_date (char *date_string, int datefmt, int *year, int *month, int *day)
+parse_date (char *date_string, enum datefmt datefmt, int *year, int *month,
+ int *day)
{
int in1, in2, in3;
int lyear, lmonth, lday;
diff --git a/src/utils.h b/src/utils.h
deleted file mode 100755
index 3f5e36f..0000000
--- a/src/utils.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $calcurse: utils.h,v 1.49 2009/07/27 19:35:09 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_UTILS_H
-#define CALCURSE_UTILS_H
-
-#include <stdlib.h>
-
-#include "calendar.h"
-#include "vars.h"
-
-#define MAX(x,y) ((x)>(y)?(x):(y))
-#define MIN(x,y) ((x)<(y)?(x):(y))
-
-#define STRING_BUILD(str) {str, sizeof (str) - 1}
-
-#define ERROR_MSG(...) do { \
- char msg[BUFSIZ]; \
- int len; \
- \
- len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
- (void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- fatalbox (msg); \
- else \
- (void)fprintf (stderr, "%s\n", msg); \
-} while (0)
-
-#define WARN_MSG(...) do { \
- char msg[BUFSIZ]; \
- \
- (void)snprintf (msg, BUFSIZ, __VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- warnbox (msg); \
- else \
- (void)fprintf (stderr, "%s\n", msg); \
-} while (0)
-
-#define EXIT(...) do { \
- ERROR_MSG(__VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- exit_calcurse (EXIT_FAILURE); \
- else \
- exit (EXIT_FAILURE); \
-} while (0)
-
-#define EXIT_IF(cond, ...) do { \
- if ((cond)) \
- EXIT(__VA_ARGS__); \
-} while (0)
-
-#define RETURN_IF(cond, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- return; \
- } \
-} while (0)
-
-#define RETVAL_IF(cond, val, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- return (val); \
- } \
-} while (0)
-
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-#define __FILE_POS__ __FILE__ ":" TOSTRING(__LINE__)
-
-#define GETSTRING_VALID 0 /* value returned by getstring() if text is valid */
-#define GETSTRING_ESC 1 /* user pressed escape to cancel editing */
-#define GETSTRING_RET 2 /* return was pressed without entering any text */
-
-typedef struct {
- const char *str;
- const int len;
-} string_t;
-
-typedef enum
-{
- ERASE_DONT_FORCE,
- ERASE_FORCE,
- ERASE_FORCE_KEEP_NOTE,
- ERASE_FORCE_ONLY_NOTE,
- ERASE_CUT
-}
-erase_flag_e;
-
-void exit_calcurse (int);
-void free_user_data (void);
-void fatalbox (const char *);
-void warnbox (const char *);
-void status_mesg (char *, char *);
-void erase_window_part (WINDOW *, int, int, int, int);
-WINDOW *popup (int, int, int, int, char *, char *, int);
-void print_in_middle (WINDOW *, int, int, int, char *);
-int getstring (WINDOW *, char *, int, int, int);
-int updatestring (WINDOW *, char **, int, int);
-int is_all_digit (char *);
-long get_item_time (long);
-int get_item_hour (long);
-int get_item_min (long);
-long date2sec (date_t, unsigned, unsigned);
-char *date_sec2hour_str (long);
-char *date_sec2date_str (long, char *);
-void date_sec2date_fmt (long, const char *, char *);
-long date_sec_change (long, int, int);
-long update_time_in_date (long, unsigned, unsigned);
-long get_sec_date (date_t);
-long min2sec (unsigned);
-int check_time (char *);
-void draw_scrollbar (WINDOW *, int, int, int, int, int, unsigned);
-void item_in_popup (char *, char *, char *, char *);
-long get_today (void);
-long now (void);
-char *nowstr (void);
-long mystrtol (const char *);
-void print_bool_option_incolor (WINDOW *, unsigned, int, int);
-char *new_tempfile (const char *, int);
-void erase_note (char **, erase_flag_e);
-int parse_date (char *, int, int *, int *, int *);
-char *str_toupper (char *);
-void file_close (FILE *, const char *);
-void psleep (unsigned);
-
-#endif /* CALCURSE_UTILS_H */
diff --git a/src/vars.c b/src/vars.c
index fcc002c..5fbb1ba 100755
--- a/src/vars.c
+++ b/src/vars.c
@@ -1,9 +1,9 @@
-/* $calcurse: vars.c,v 1.20 2009/08/01 13:31:21 culot Exp $ */
+/* $calcurse: vars.c,v 1.21 2010/03/20 10:54:49 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2008 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2008, 2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,13 +39,7 @@
#include <stdlib.h>
#include <string.h>
-#include "i18n.h"
-#include "calendar.h"
-#include "custom.h"
-#include "wins.h"
-#include "keys.h"
-#include "mem.h"
-#include "vars.h"
+#include "calcurse.h"
/*
* variables to store window size
@@ -60,7 +54,7 @@ unsigned colorize = 0;
* calcurse is running in command-line mode).
* This is useful to konw how to display messages on the screen.
*/
-ui_mode_e ui_mode = UI_CMDLINE;
+enum ui_mode ui_mode = UI_CMDLINE;
/*
* variables to store calendar names
@@ -107,19 +101,19 @@ char path_dpid[] = "";
char path_dmon_log[] = "";
/* Variable to handle pads. */
-struct pad_s apad;
+struct pad apad;
/* Variable to store notify-bar settings. */
-struct nbar_s nbar;
+struct nbar nbar;
/* Variable to store daemon configuration. */
-struct dmon_conf_s dmon;
+struct dmon_conf dmon;
/*
* Variables init
*/
void
-vars_init (conf_t *conf)
+vars_init (struct conf *conf)
{
char *PATH_VI = "/usr/bin/vi";
char *PATH_LESS = "/usr/bin/less";
diff --git a/src/vars.h b/src/vars.h
deleted file mode 100755
index fbb88c1..0000000
--- a/src/vars.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $calcurse: vars.h,v 1.38 2010/03/08 08:44:44 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2004-2010 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_VARS_H
-#define CALCURSE_VARS_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#elif defined HAVE_NCURSES_NCURSES_H
-#include <ncurses/ncurses.h>
-#elif defined HAVE_NCURSESW_NCURSES_H
-#include <ncursesw/ncurses.h>
-#else
-#error "Missing ncurses header. Aborting..."
-#endif
-
-#include <pthread.h>
-
-#define DIR_NAME ".calcurse/"
-#define TODO_PATH_NAME "todo"
-#define APTS_PATH_NAME "apts"
-#define CONF_PATH_NAME "conf"
-#define KEYS_PATH_NAME "keys"
-#define CPID_PATH_NAME ".calcurse.pid"
-#define DPID_PATH_NAME ".daemon.pid"
-#define DLOG_PATH_NAME "daemon.log"
-#define NOTES_DIR_NAME "notes/"
-
-#define TODO_PATH DIR_NAME TODO_PATH_NAME
-#define APTS_PATH DIR_NAME APTS_PATH_NAME
-#define CONF_PATH DIR_NAME CONF_PATH_NAME
-#define KEYS_PATH DIR_NAME KEYS_PATH_NAME
-#define CPID_PATH DIR_NAME CPID_PATH_NAME
-#define DLOG_PATH DIR_NAME DLOG_PATH_NAME
-#define DPID_PATH DIR_NAME DPID_PATH_NAME
-#define NOTES_DIR DIR_NAME NOTES_DIR_NAME
-
-#define ATTR_FALSE 0
-#define ATTR_TRUE 1
-#define ATTR_LOWEST 2
-#define ATTR_LOW 3
-#define ATTR_MIDDLE 4
-#define ATTR_HIGH 5
-#define ATTR_HIGHEST 6
-
-#define STATUSHEIGHT 2
-#define NOTESIZ 6
-
-enum {
- DATEFMT_MMDDYYYY = 1,
- DATEFMT_DDMMYYYY,
- DATEFMT_YYYYMMDD,
- DATEFMT_ISO,
- DATE_FORMATS
-};
-
-#define DATEFMT(datefmt) (datefmt == DATEFMT_MMDDYYYY ? "%m/%d/%Y" : \
- (datefmt == DATEFMT_DDMMYYYY ? "%d/%m/%Y" : \
- (datefmt == DATEFMT_YYYYMMDD ? "%Y/%m/%d" : "%Y-%m-%d")))
-
-#define DATEFMT_DESC(datefmt) (datefmt == DATEFMT_MMDDYYYY ? \
- _("mm/dd/yyyy") : \
- (datefmt == DATEFMT_DDMMYYYY ? \
- _("dd/mm/yyyy") : \
- (datefmt == DATEFMT_YYYYMMDD ? \
- _("yyyy/mm/dd") : _("yyyy-mm-dd"))))
-
-typedef enum {
- UI_CURSES,
- UI_CMDLINE,
- UI_MODES
-} ui_mode_e;
-
-struct pad_s
-{
- int width;
- int length;
- int first_onscreen; /* first line to be displayed inside window */
- WINDOW *ptrwin; /* pointer to the pad window */
-};
-
-struct nbar_s
-{
- int show; /* display or hide the notify-bar */
- int cntdwn; /* warn when time left before next app
- * becomes lesser than cntdwn */
- char datefmt[BUFSIZ]; /* format for displaying date */
- char timefmt[BUFSIZ]; /* format for displaying time */
- char cmd[BUFSIZ]; /* notification command */
- char *shell; /* user shell to launch notif. cmd */
- pthread_mutex_t mutex;
-};
-
-struct dmon_conf_s
-{
- unsigned enable; /* launch daemon automatically when exiting */
- unsigned log; /* log daemon activity */
-};
-
-/* General configuration variables */
-typedef struct
-{
- unsigned auto_save;
- unsigned periodic_save;
- unsigned confirm_quit;
- unsigned confirm_delete;
- unsigned skip_system_dialogs;
- unsigned skip_progress_bar;
- char *editor;
- char *pager;
- char output_datefmt[BUFSIZ]; /* format for displaying date */
- int input_datefmt; /* format for reading date */
-}
-conf_t;
-
-extern int col, row;
-extern unsigned colorize;
-extern ui_mode_e ui_mode;
-extern int days[12];
-extern char *monthnames[12];
-extern char *daynames[8];
-extern char path_dir[BUFSIZ];
-extern char path_todo[BUFSIZ];
-extern char path_apts[BUFSIZ];
-extern char path_conf[BUFSIZ];
-extern char path_keys[BUFSIZ];
-extern char path_notes[BUFSIZ];
-extern char path_cpid[BUFSIZ];
-extern char path_dpid[BUFSIZ];
-extern char path_dmon_log[BUFSIZ];
-
-extern struct pad_s apad;
-extern struct nbar_s nbar;
-extern struct dmon_conf_s dmon;
-
-void vars_init (conf_t *);
-
-#endif /* CALCURSE_VARS_H */
diff --git a/src/wins.c b/src/wins.c
index 3387a97..8d45c13 100755
--- a/src/wins.c
+++ b/src/wins.c
@@ -1,9 +1,9 @@
-/* $calcurse: wins.c,v 1.28 2009/10/28 13:23:05 culot Exp $ */
+/* $calcurse: wins.c,v 1.29 2010/03/20 10:54:49 culot Exp $ */
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2007-2009 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2007-2010 Frederic Culot <frederic@culot.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,19 +40,12 @@
#include <string.h>
#include <math.h>
-#include "i18n.h"
-#include "keys.h"
-#include "notify.h"
-#include "utils.h"
-#include "todo.h"
-#include "custom.h"
-#include "mem.h"
-#include "wins.h"
+#include "calcurse.h"
/* Variables to handle calcurse windows. */
-window_t win[NBWINS];
+struct window win[NBWINS];
-static window_e slctd_win;
+static enum win slctd_win;
static int layout;
/* Get the current layout. */
@@ -77,7 +70,7 @@ wins_slctd_init (void)
}
/* Returns an enum which corresponds to the window which is selected. */
-window_e
+enum win
wins_slctd (void)
{
return (slctd_win);
@@ -85,7 +78,7 @@ wins_slctd (void)
/* Sets the selected window. */
void
-wins_slctd_set (window_e window)
+wins_slctd_set (enum win window)
{
slctd_win = window;
}
@@ -141,7 +134,7 @@ wins_init (void)
* scrolling faster.
*/
void
-wins_scrollwin_init (scrollwin_t *sw)
+wins_scrollwin_init (struct scrollwin *sw)
{
EXIT_IF (sw == 0, "null pointer");
sw->win.p = newwin (sw->win.h, sw->win.w, sw->win.y, sw->win.x);
@@ -152,7 +145,7 @@ wins_scrollwin_init (scrollwin_t *sw)
/* Free an already created scrollwin. */
void
-wins_scrollwin_delete (scrollwin_t *sw)
+wins_scrollwin_delete (struct scrollwin *sw)
{
EXIT_IF (sw == 0, "null pointer");
delwin(sw->win.p);
@@ -161,7 +154,7 @@ wins_scrollwin_delete (scrollwin_t *sw)
/* Display a scrolling window. */
void
-wins_scrollwin_display (scrollwin_t *sw)
+wins_scrollwin_display (struct scrollwin *sw)
{
const int visible_lines = sw->win.h - sw->pad.y - 1;
@@ -185,14 +178,14 @@ wins_scrollwin_display (scrollwin_t *sw)
}
void
-wins_scrollwin_up (scrollwin_t *sw, int amount)
+wins_scrollwin_up (struct scrollwin *sw, int amount)
{
if (sw->first_visible_line > 0)
sw->first_visible_line -= amount;
}
void
-wins_scrollwin_down (scrollwin_t *sw, int amount)
+wins_scrollwin_down (struct scrollwin *sw, int amount)
{
if (sw->total_lines
> (sw->first_visible_line + sw->win.h - sw->pad.y - 1))
@@ -512,50 +505,50 @@ void
wins_status_bar (void)
{
#define NB_PANELS 3 /* 3 panels: CALENDAR, APPOINTMENT, TODO */
- window_e which_pan;
+ enum win which_pan;
int start, end;
const int pos[NB_PANELS + 1] =
{ 0, NB_CAL_CMDS, NB_CAL_CMDS + NB_APP_CMDS, TOTAL_CMDS };
- binding_t help = {_("Help"), KEY_GENERIC_HELP};
- binding_t quit = {_("Quit"), KEY_GENERIC_QUIT};
- binding_t save = {_("Save"), KEY_GENERIC_SAVE};
- binding_t cut = {_("Cut"), KEY_GENERIC_CUT};
- binding_t paste = {_("Paste"), KEY_GENERIC_PASTE};
- binding_t chgvu = {_("Chg Win"), KEY_GENERIC_CHANGE_VIEW};
- binding_t import = {_("Import"), KEY_GENERIC_IMPORT};
- binding_t export = {_("Export"), KEY_GENERIC_EXPORT};
- binding_t togo = {_("Go to"), KEY_GENERIC_GOTO};
- binding_t othr = {_("OtherCmd"), KEY_GENERIC_OTHER_CMD};
- binding_t conf = {_("Config"), KEY_GENERIC_CONFIG_MENU};
- binding_t draw = {_("Redraw"), KEY_GENERIC_REDRAW};
- binding_t appt = {_("Add Appt"), KEY_GENERIC_ADD_APPT};
- binding_t todo = {_("Add Todo"), KEY_GENERIC_ADD_TODO};
- binding_t gnday = {_("+1 Day"), KEY_GENERIC_NEXT_DAY};
- binding_t gpday = {_("-1 Day"), KEY_GENERIC_PREV_DAY};
- binding_t gnweek = {_("+1 Week"), KEY_GENERIC_NEXT_WEEK};
- binding_t gpweek = {_("-1 Week"), KEY_GENERIC_PREV_WEEK};
- binding_t today = {_("Today"), KEY_GENERIC_GOTO_TODAY};
- binding_t nview = {_("Nxt View"), KEY_GENERIC_SCROLL_DOWN};
- binding_t pview = {_("Prv View"), KEY_GENERIC_SCROLL_UP};
- binding_t up = {_("Up"), KEY_MOVE_UP};
- binding_t down = {_("Down"), KEY_MOVE_DOWN};
- binding_t left = {_("Left"), KEY_MOVE_LEFT};
- binding_t right = {_("Right"), KEY_MOVE_RIGHT};
- binding_t weekb = {_("beg Week"), KEY_START_OF_WEEK};
- binding_t weeke = {_("end Week"), KEY_END_OF_WEEK};
- binding_t add = {_("Add Item"), KEY_ADD_ITEM};
- binding_t del = {_("Del Item"), KEY_DEL_ITEM};
- binding_t edit = {_("Edit Itm"), KEY_EDIT_ITEM};
- binding_t view = {_("View"), KEY_VIEW_ITEM};
- binding_t flag = {_("Flag Itm"), KEY_FLAG_ITEM};
- binding_t rept = {_("Repeat"), KEY_REPEAT_ITEM};
- binding_t enote = {_("EditNote"), KEY_EDIT_NOTE};
- binding_t vnote = {_("ViewNote"), KEY_VIEW_NOTE};
- binding_t rprio = {_("Prio.+"), KEY_RAISE_PRIORITY};
- binding_t lprio = {_("Prio.-"), KEY_LOWER_PRIORITY};
+ struct binding help = {_("Help"), KEY_GENERIC_HELP};
+ struct binding quit = {_("Quit"), KEY_GENERIC_QUIT};
+ struct binding save = {_("Save"), KEY_GENERIC_SAVE};
+ struct binding cut = {_("Cut"), KEY_GENERIC_CUT};
+ struct binding paste = {_("Paste"), KEY_GENERIC_PASTE};
+ struct binding chgvu = {_("Chg Win"), KEY_GENERIC_CHANGE_VIEW};
+ struct binding import = {_("Import"), KEY_GENERIC_IMPORT};
+ struct binding export = {_("Export"), KEY_GENERIC_EXPORT};
+ struct binding togo = {_("Go to"), KEY_GENERIC_GOTO};
+ struct binding othr = {_("OtherCmd"), KEY_GENERIC_OTHER_CMD};
+ struct binding conf = {_("Config"), KEY_GENERIC_CONFIG_MENU};
+ struct binding draw = {_("Redraw"), KEY_GENERIC_REDRAW};
+ struct binding appt = {_("Add Appt"), KEY_GENERIC_ADD_APPT};
+ struct binding todo = {_("Add Todo"), KEY_GENERIC_ADD_TODO};
+ struct binding gnday = {_("+1 Day"), KEY_GENERIC_NEXT_DAY};
+ struct binding gpday = {_("-1 Day"), KEY_GENERIC_PREV_DAY};
+ struct binding gnweek = {_("+1 Week"), KEY_GENERIC_NEXT_WEEK};
+ struct binding gpweek = {_("-1 Week"), KEY_GENERIC_PREV_WEEK};
+ struct binding today = {_("Today"), KEY_GENERIC_GOTO_TODAY};
+ struct binding nview = {_("Nxt View"), KEY_GENERIC_SCROLL_DOWN};
+ struct binding pview = {_("Prv View"), KEY_GENERIC_SCROLL_UP};
+ struct binding up = {_("Up"), KEY_MOVE_UP};
+ struct binding down = {_("Down"), KEY_MOVE_DOWN};
+ struct binding left = {_("Left"), KEY_MOVE_LEFT};
+ struct binding right = {_("Right"), KEY_MOVE_RIGHT};
+ struct binding weekb = {_("beg Week"), KEY_START_OF_WEEK};
+ struct binding weeke = {_("end Week"), KEY_END_OF_WEEK};
+ struct binding add = {_("Add Item"), KEY_ADD_ITEM};
+ struct binding del = {_("Del Item"), KEY_DEL_ITEM};
+ struct binding edit = {_("Edit Itm"), KEY_EDIT_ITEM};
+ struct binding view = {_("View"), KEY_VIEW_ITEM};
+ struct binding flag = {_("Flag Itm"), KEY_FLAG_ITEM};
+ struct binding rept = {_("Repeat"), KEY_REPEAT_ITEM};
+ struct binding enote = {_("EditNote"), KEY_EDIT_NOTE};
+ struct binding vnote = {_("ViewNote"), KEY_VIEW_NOTE};
+ struct binding rprio = {_("Prio.+"), KEY_RAISE_PRIORITY};
+ struct binding lprio = {_("Prio.-"), KEY_LOWER_PRIORITY};
- binding_t *binding[TOTAL_CMDS] = {
+ struct binding *binding[TOTAL_CMDS] = {
/* calendar keys */
&help, &quit, &save, &chgvu, &nview, &pview, &up, &down, &left, &right,
&togo, &othr, &import, &export, &weekb, &weeke, &appt, &todo,
diff --git a/src/wins.h b/src/wins.h
deleted file mode 100755
index 22833c2..0000000
--- a/src/wins.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $calcurse: wins.h,v 1.12 2009/07/05 20:33:26 culot Exp $ */
-
-/*
- * Calcurse - text-based organizer
- *
- * Copyright (c) 2007-2009 Frederic Culot <frederic@culot.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Send your feedback or comments to : calcurse@culot.org
- * Calcurse home page : http://culot.org/calcurse
- *
- */
-
-#ifndef CALCURSE_WINS_H
-#define CALCURSE_WINS_H
-
-#include "vars.h"
-
-typedef enum
-{
- CAL,
- APP,
- TOD,
- NOT,
- STA,
- NBWINS
-}
-window_e;
-
-/* Generic window structure. */
-typedef struct
-{
- WINDOW *p; /* pointer to window */
- unsigned w; /* width */
- unsigned h; /* height */
- int x; /* x position */
- int y; /* y position */
-} window_t;
-
-/* Generic scrolling window structure. */
-typedef struct
-{
- window_t win;
- window_t pad;
- unsigned first_visible_line;
- unsigned total_lines;
- char label[BUFSIZ];
-} scrollwin_t;
-
-extern window_t win[NBWINS];
-
-int wins_layout (void);
-void wins_set_layout (int);
-void wins_slctd_init (void);
-window_e wins_slctd (void);
-void wins_slctd_set (window_e);
-void wins_slctd_next (void);
-void wins_init (void);
-void wins_scrollwin_init (scrollwin_t *);
-void wins_scrollwin_delete (scrollwin_t *);
-void wins_scrollwin_display (scrollwin_t *);
-void wins_scrollwin_up (scrollwin_t *, int);
-void wins_scrollwin_down (scrollwin_t *, int);
-void wins_reinit (void);
-void wins_show (WINDOW *, char *);
-void wins_get_config (void);
-void wins_update (void);
-void wins_reset (void);
-void wins_launch_external (const char *, const char *);
-void wins_status_bar (void);
-void wins_erase_status_bar (void);
-void wins_other_status_page (int);
-void wins_reset_status_page (void);
-
-#endif /* CALCURSE_WINS_H */