summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-12-12 20:44:50 +0000
committerFrederic Culot <calcurse@culot.org>2008-12-12 20:44:50 +0000
commit53db22a380ec76a684fd5000d216350aaa795278 (patch)
tree8902b4442302bfd8f5d2be0385357705e629be62
parentbd286546f42bbeb568e2a003882e78bf4f1ae831 (diff)
downloadcalcurse-53db22a380ec76a684fd5000d216350aaa795278.zip
code cleanup
-rwxr-xr-xChangeLog13
-rwxr-xr-xsrc/apoint.c13
-rwxr-xr-xsrc/day.c6
-rwxr-xr-xsrc/io.c13
-rwxr-xr-xsrc/keys.c10
-rwxr-xr-xsrc/notify.c15
-rwxr-xr-xsrc/recur.c6
-rwxr-xr-xsrc/todo.c33
-rwxr-xr-xsrc/utils.c116
-rwxr-xr-xsrc/utils.h62
-rwxr-xr-xsrc/wins.c12
11 files changed, 106 insertions, 193 deletions
diff --git a/ChangeLog b/ChangeLog
index d929004..30c467a 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-12-12 Frederic Culot <frederic@culot.org>
+
+ * src/utils.c (mycpy): suppressed and replaced by strdup
+
+ * src/utils.c (aerror, ierror): suppressed
+
+ * src/utils.c (warnbox): moved to fatalbox
+
+ * src/utils.h (ERROR_MSG): file name and line number added to
+ displayed error message
+
+ * src/utils.h (ASSERT): suppressed
+
2008-12-09 Frederic Culot <frederic@culot.org>
* src/calcurse.1: manpage update for 2.4
diff --git a/src/apoint.c b/src/apoint.c
index 6686572..3928b7e 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,4 +1,4 @@
-/* $calcurse: apoint.c,v 1.25 2008/12/07 09:20:38 culot Exp $ */
+/* $calcurse: apoint.c,v 1.26 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -229,7 +229,6 @@ apoint_delete (conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
{
char *choices = "[y/n] ";
char *del_app_str = _("Do you really want to delete this item ?");
- const char *errmsg = _("FATAL ERROR in apoint_delete: no such type\n");
long date;
int nb_items = *nb_apoints + *nb_events;
bool go_for_deletion = false;
@@ -274,7 +273,7 @@ apoint_delete (conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
to_be_removed = 0;
}
else
- ierror (errmsg, IERROR_FATAL);
+ EXIT (_("no such type"));
/* NOTREACHED */
if (hilt > 1)
@@ -452,8 +451,7 @@ apoint_delete_bynum (long start, unsigned num, erase_flag_e flag)
pthread_mutex_unlock (&(alist_p->mutex));
/* NOTREACHED */
- ierror (_("FATAL ERROR in apoint_delete_bynum: no such appointment"),
- IERROR_FATAL);
+ EXIT (_("no such appointment"));
}
/*
@@ -533,7 +531,7 @@ apoint_check_next (struct notify_app_s *app, long start)
if (i->start > start)
{
app->time = i->start;
- app->txt = mycpy (i->mesg);
+ app->txt = strdup (i->mesg);
app->state = i->state;
app->got_app = 1;
}
@@ -613,8 +611,7 @@ apoint_switch_notify (void)
pthread_mutex_unlock (&(alist_p->mutex));
/* NOTREACHED */
- ierror (_("FATAL ERROR in apoint_switch_notify: no such appointment"),
- IERROR_FATAL);
+ EXIT (_("no such appointment"));
}
/* Updates the Appointment panel */
diff --git a/src/day.c b/src/day.c
index 4b0e067..c727cf2 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,4 +1,4 @@
-/* $calcurse: day.c,v 1.40 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: day.c,v 1.41 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -454,15 +454,13 @@ day_write_pad (long date, int width, int length, int incolor)
void
day_popup_item (void)
{
- char *error = _("FATAL ERROR in day_popup_item: unknown item type\n");
-
if (day_saved_item->type == EVNT || day_saved_item->type == RECUR_EVNT)
item_in_popup (NULL, NULL, day_saved_item->mesg, _("Event :"));
else if (day_saved_item->type == APPT || day_saved_item->type == RECUR_APPT)
item_in_popup (day_saved_item->start, day_saved_item->end,
day_saved_item->mesg, _("Appointment :"));
else
- ierror (error, IERROR_FATAL);
+ EXIT (_("unknown item type"));
/* NOTREACHED */
}
diff --git a/src/io.c b/src/io.c
index de3950b..b67f1a6 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.46 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: io.c,v 1.47 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -1257,8 +1257,7 @@ io_load_keys (char *pager)
}
keyfp = fopen (path_keys, "r");
- EXIT_IF (keyfp == NULL,
- _("FATAL ERROR in io_load_keys: could not find any key file."));
+ EXIT_IF (keyfp == NULL, _("could not find any key file."));
log = io_log_init ();
skipped = loaded = line = 0;
while (fgets (buf, BUFSIZ, keyfp) != NULL)
@@ -1576,8 +1575,7 @@ ical_log (FILE *log, ical_types_e type, unsigned lineno, char *msg)
{
const char *typestr[ICAL_TYPES] = {"VEVENT", "VTODO"};
- RETURN_IF (type < 0 || type >= ICAL_TYPES,
- _("ERROR in ical_log: unknown ical type"));
+ RETURN_IF (type < 0 || type >= ICAL_TYPES, _("unknown ical type"));
if (log)
fprintf (log, "%s [%d]: %s\n", typestr[type], lineno, msg);
}
@@ -2586,8 +2584,7 @@ io_import_data (import_type_t type, conf_t *conf, char *stream_name)
unsigned events, apoints, todos, lines, skipped;
} stats;
- EXIT_IF (type < 0 || type >= IO_IMPORT_NBTYPES,
- _("FATAL ERROR in io_import_data: unknown import type"));
+ EXIT_IF (type < 0 || type >= IO_IMPORT_NBTYPES, _("unknown import type"));
switch (ui_mode)
{
case UI_CMDLINE:
@@ -2600,7 +2597,7 @@ io_import_data (import_type_t type, conf_t *conf, char *stream_name)
stream = get_import_stream (type);
break;
default:
- EXIT (_("FATAL ERROR in io_import_data: wrong import mode"));
+ EXIT (_("FATAL ERROR: wrong import mode"));
/* NOTREACHED */
}
diff --git a/src/keys.c b/src/keys.c
index 9b5a661..57fac95 100755
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,4 +1,4 @@
-/* $calcurse: keys.c,v 1.8 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: keys.c,v 1.9 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -133,8 +133,7 @@ keys_dump_defaults (char *file)
int i;
fd = fopen (file, "w");
- EXIT_IF (fd == NULL, _("FATAL ERROR in keys_dump_defaults: "
- "could not create default keys file."));
+ EXIT_IF (fd == NULL, _("FATAL ERROR: could not create default keys file."));
dump_intro (fd);
for (i = 0; i < NBKEYS; i++)
@@ -146,7 +145,7 @@ char *
keys_get_label (keys_e key)
{
EXIT_IF (key < 0 || key > NBKEYS,
- _("FATAL ERROR in keys_get_label: key value out of bounds"));
+ _("FATAL ERROR: key value out of bounds"));
return keydef[key].label;
}
@@ -553,8 +552,7 @@ keys_save_bindings (FILE *fd)
{
int i;
- EXIT_IF (fd == NULL, _("FATAL ERROR in keys_save_bindings: "
- "null file pointer."));
+ EXIT_IF (fd == NULL, _("FATAL ERROR: null file pointer."));
dump_intro (fd);
for (i = 0; i < NBKEYS; i++)
fprintf (fd, "%s %s\n", keydef[i].label, keys_action_allkeys (i));
diff --git a/src/notify.c b/src/notify.c
index 321b5fc..2973d16 100755
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,4 +1,4 @@
-/* $calcurse: notify.c,v 1.30 2008/12/07 09:20:38 culot Exp $ */
+/* $calcurse: notify.c,v 1.31 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -133,11 +133,10 @@ launch_cmd (char *cmd, char *shell)
pid = fork ();
if (pid < 0)
- ierror (_("FATAL ERROR in launch_cmd: could not fork"), IERROR_WARN);
+ ERROR_MSG (_("error while launching command: could not fork"));
else if (pid == 0) /* Child: launch user defined command */
- if (execlp (shell, shell, "-c", cmd, (char *) NULL) < 0)
- ierror (_("FATAL ERROR in launch_cmd: could not "
- "launch user command"), IERROR_WARN);
+ if (execlp (shell, shell, "-c", cmd, (char *)0) < 0)
+ ERROR_MSG (_("error while launching command"));
}
/*
@@ -286,7 +285,7 @@ notify_thread_app (void *arg)
{
notify_app->got_app = 1;
notify_app->time = tmp_app.time;
- notify_app->txt = mycpy (tmp_app.txt);
+ notify_app->txt = strdup (tmp_app.txt);
notify_app->state = tmp_app.state;
}
else
@@ -339,7 +338,7 @@ notify_check_added (char *mesg, long start, char state)
{
notify_app->got_app = 1;
notify_app->time = start;
- notify_app->txt = mycpy (mesg);
+ notify_app->txt = strdup (mesg);
notify_app->state = state;
}
pthread_mutex_unlock (&notify_app->mutex);
@@ -378,7 +377,7 @@ notify_check_repeated (recur_apoint_llist_node_t *i)
{
notify_app->got_app = 1;
notify_app->time = real_app_time;
- notify_app->txt = mycpy (i->mesg);
+ notify_app->txt = strdup (i->mesg);
notify_app->state = i->state;
}
pthread_mutex_unlock (&notify_app->mutex);
diff --git a/src/recur.c b/src/recur.c
index 56adf1e..912f5d0 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.41 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: recur.c,v 1.42 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -694,7 +694,7 @@ recur_repeat_item (conf_t *conf)
}
while ((ch != 'D') && (ch != 'W') && (ch != 'M')
- && (ch != 'Y') && (ch != KEY_GENERIC_CANCEL))
+ && (ch != 'Y') && (ch != ESCAPE))
{
status_mesg (mesg_type_1, mesg_type_2);
ch = wgetch (win[STA].p);
@@ -861,7 +861,7 @@ recur_apoint_check_next (struct notify_app_s *app, long start, long day)
if (real_recur_start_time > start)
{
app->time = real_recur_start_time;
- app->txt = mycpy (i->mesg);
+ app->txt = strdup (i->mesg);
app->state = i->state;
app->got_app = 1;
}
diff --git a/src/todo.c b/src/todo.c
index 6da9c42..16c9a79 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,4 +1,4 @@
-/* $calcurse: todo.c,v 1.26 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: todo.c,v 1.27 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -190,8 +190,7 @@ todo_delete_note_bynum (unsigned num)
if (n == num)
{
if (i->note == NULL)
- ierror (_("FATAL ERROR in todo_delete_note_bynum: "
- "no note attached\n"), IERROR_FATAL);
+ EXIT (_("no note attached"));
erase_note (&i->note, ERASE_FORCE_ONLY_NOTE);
return;
}
@@ -199,9 +198,7 @@ todo_delete_note_bynum (unsigned num)
n++;
}
/* NOTREACHED */
- ierror (_("FATAL ERROR in todo_delete_note_bynum: no such todo\n"),
- IERROR_FATAL);
- exit (EXIT_FAILURE);
+ EXIT (_("no such todo"));
}
/* Delete an item from the todo linked list. */
@@ -228,9 +225,7 @@ todo_delete_bynum (unsigned num, erase_flag_e flag)
n++;
}
/* NOTREACHED */
- ierror (_("FATAL ERROR in todo_delete_bynum: no such todo\n"),
- IERROR_FATAL);
- exit (EXIT_FAILURE);
+ EXIT (_("no such todo"));
}
/* Delete an item from the ToDo list. */
@@ -326,8 +321,8 @@ todo_get_position (struct todo_s *i)
}
else
{
- fputs (_("FATAL ERROR in todo_get_position: todo not found\n"), stderr);
- exit (EXIT_FAILURE);
+ EXIT (_("todo not found"));
+ return -1; /* avoid compiler warnings */
}
}
@@ -348,17 +343,17 @@ todo_chg_priority (int action)
strncpy (backup_note, backup->note, NOTESIZ + 1);
else
backup_note[0] = '\0';
- if (action == KEY_RAISE_PRIORITY)
+ switch (action)
{
+ case KEY_RAISE_PRIORITY:
(backup_id > 1) ? backup_id-- : do_chg--;
- }
- else if (action == KEY_LOWER_PRIORITY)
- {
+ break;
+ case KEY_LOWER_PRIORITY:
(backup_id < 9) ? backup_id++ : do_chg--;
- }
- else
- { /* NOTREACHED */
- fputs (_("FATAL ERROR in todo_chg_priority: no such action\n"), stderr);
+ break;
+ default:
+ EXIT (_("no such action"));
+ /* NOTREACHED */
}
if (do_chg)
{
diff --git a/src/utils.c b/src/utils.c
index b04f023..f421f10 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.56 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: utils.c,v 1.57 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -62,64 +62,27 @@ exit_calcurse (int status)
/* Function to exit on internal error. */
void
-ierror (const char *errmsg, ierror_sev_e sev)
+fatalbox (const char *errmsg)
{
WINDOW *errwin;
- char *label = _("INTERNAL ERROR");
- char *exitmsg = _("calcurse will now exit...");
- char *reportmsg = _("Please report the following bug:");
- const int winrow = 10;
- const int wincol = col - 2;
- const int msglen = wincol - 2;
- char msg[msglen];
-
- strncpy (msg, errmsg, msglen);
- errwin = newwin (winrow, wincol, (row - winrow) / 2, (col - wincol) / 2);
+ char *label = _("/!\\ INTERNAL ERROR /!\\");
+ char *reportmsg = _("Please report the following bug:");
+ const int WINROW = 10;
+ const int WINCOL = col - 2;
+ const int MSGLEN = WINCOL - 2;
+ char msg[MSGLEN];
+
+ strncpy (msg, errmsg, MSGLEN);
+ errwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2);
custom_apply_attr (errwin, ATTR_HIGHEST);
box (errwin, 0, 0);
wins_show (errwin, label);
- if (sev == IERROR_FATAL)
- mvwprintw (errwin, 3, 1, reportmsg);
- mvwprintw (errwin, 5, (wincol - strlen (msg)) / 2, "%s", msg);
- if (sev == IERROR_FATAL)
- mvwprintw (errwin, winrow - 2, wincol - strlen (exitmsg) - 1, "%s",
- exitmsg);
+ mvwprintw (errwin, 3, 1, reportmsg);
+ mvwprintw (errwin, 5, (WINCOL - strlen (msg)) / 2, "%s", msg);
custom_remove_attr (errwin, ATTR_HIGHEST);
wrefresh (errwin);
(void)wgetch (errwin);
- if (sev == IERROR_FATAL)
- exit_calcurse (EXIT_FAILURE);
-}
-
-/* Function to handle an assertion failure. */
-void
-aerror (const char *file, int line, const char *assertion)
-{
- char errmsg[BUFSIZ];
-
- snprintf (errmsg, BUFSIZ,
- "assert \"%s\" failed: file \"%s\", line %d", assertion, file,
- line);
- ierror (errmsg, IERROR_FATAL);
-}
-
-void
-warnbox (const char *msg)
-{
- const int WINCOL = col - 2;
- const int WINROW = 10;
- const int MSGLEN = WINCOL - 2;
- WINDOW *warnwin;
- char displmsg[MSGLEN];
-
- if (msg == NULL)
- return;
- strncpy (displmsg, msg, MSGLEN);
- warnwin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2,
- "/!\\", displmsg, 1);
- wrefresh (warnwin);
- (void)wgetch (warnwin);
- delwin (warnwin);
+ delwin (errwin);
doupdate ();
}
@@ -406,14 +369,9 @@ updatestring (WINDOW *win, char **str, int x, int y)
if (!escape)
{
len = strlen (newstr) + 1;
- if ((*str = (char *) realloc (*str, len)) == NULL)
- {
- /* NOTREACHED */
- ierror (_("FATAL ERROR in updatestring: out of memory"),
- IERROR_FATAL);
- }
- else
- (void) memcpy (*str, newstr, len);
+ *str = (char *) realloc (*str, len);
+ EXIT_IF (*str == 0, _("out of memory"));
+ (void) memcpy (*str, newstr, len);
}
free (newstr);
return (escape);
@@ -628,7 +586,7 @@ update_time_in_date (long date, unsigned hr, unsigned mn)
lt->tm_hour = hr;
lt->tm_min = mn;
new_date = mktime (lt);
- ASSERT (new_date != -1);
+ EXIT_IF (new_date == -1, _("error in mktime"));
return (new_date);
}
@@ -773,7 +731,6 @@ void
other_status_page (int panel)
{
int nb_item = 0, max_page;
- char *error = _("FATAL ERROR in other_status_page: unknown panel\n");
switch (panel)
{
@@ -787,7 +744,8 @@ other_status_page (int panel)
nb_item = NB_TOD_CMDS;
break;
default:
- ierror (error, IERROR_FATAL);
+ EXIT (_("unknown panel"));
+ /* NOTREACHED */
}
max_page = ceil (nb_item / (2 * CMDS_PER_LINE + 1)) + 1;
if (status_page < max_page)
@@ -825,34 +783,18 @@ now (void)
return (current_time);
}
-/* Copy a string */
-char *
-mycpy (const char *src)
-{
- char *string = malloc (strlen (src) + 1);
-
- if (string != NULL)
- return (strncpy (string, src, strlen (src) + 1));
- else
- return (NULL);
-}
-
long
mystrtol (const char *str)
{
char *ep;
long lval;
- const char *not_a_number =
- _("FATAL ERROR in mystrtol: could not convert string");
- const char *out_of_range =
- _("FATAL ERROR in mystrtol: number is out of range");
errno = 0;
lval = strtol (str, &ep, 10);
if (str[0] == '\0' || *ep != '\0')
- ierror (not_a_number, IERROR_FATAL);
+ EXIT (_("could not convert string"));
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
- ierror (out_of_range, IERROR_FATAL);
+ EXIT (_("out of range"));
return (lval);
}
@@ -875,10 +817,8 @@ print_bool_option_incolor (WINDOW *win, bool option, int pos_y, int pos_x)
strncpy (option_value, _("no"), BUFSIZ);
}
else
- {
- ierror (_("option not defined - Problem in print_option_incolor()"),
- IERROR_FATAL);
- }
+ EXIT (_("option not defined"));
+
custom_apply_attr (win, color);
mvwprintw (win, pos_y, pos_x, "%s", option_value);
custom_remove_attr (win, color);
@@ -913,9 +853,8 @@ new_tempfile (const char *prefix, int trailing_len)
unlink (fullname);
close (fd);
}
- ierror (_("FATAL ERROR: temporary file could not be created!"),
- IERROR_WARN);
- return (NULL);
+ ERROR_MSG (_("temporary file could not be created"));
+ return (char *)0;
}
fclose (file);
@@ -927,7 +866,6 @@ void
erase_note (char **note, erase_flag_e flag)
{
char fullname[BUFSIZ];
- char *errmsg = _("FATAL ERROR in erase_note: could not remove note\n");
if (*note == NULL)
return;
@@ -935,7 +873,7 @@ erase_note (char **note, erase_flag_e flag)
{
snprintf (fullname, BUFSIZ, "%s%s", path_notes, *note);
if (unlink (fullname) != 0)
- ierror (errmsg, IERROR_FATAL);
+ EXIT (_("could not remove note"));
}
free (*note);
*note = NULL;
diff --git a/src/utils.h b/src/utils.h
index 3f4cd0a..d076c06 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.39 2008/11/23 20:38:56 culot Exp $ */
+/* $calcurse: utils.h,v 1.40 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -38,13 +38,15 @@
#define STRING_BUILD(str) {str, sizeof (str) - 1}
#define ERROR_MSG(...) do { \
- char msg[BUFSIZ]; \
+ char msg[BUFSIZ]; \
+ int len; \
\
- snprintf (msg, BUFSIZ, __VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- warnbox (msg); \
- else \
- fprintf (stderr, "%s\n", msg); \
+ len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
+ snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ fatalbox (msg); \
+ else \
+ fprintf (stderr, "%s\n", msg); \
} while (0)
#define EXIT(...) do { \
@@ -56,34 +58,24 @@
} while (0)
#define EXIT_IF(cond, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- exit_calcurse (EXIT_FAILURE); \
- else \
- exit (EXIT_FAILURE); \
- } \
+ if ((cond)) \
+ EXIT(__VA_ARGS__); \
} while (0)
#define RETURN_IF(cond, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- return; \
- } \
+ 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 ASSERT(e) do { \
- ((e) ? (void)0 : aerror(__FILE__, __LINE__, #e)); \
+ if ((cond)) \
+ { \
+ ERROR_MSG(__VA_ARGS__); \
+ return (val); \
+ } \
} while (0)
#define GETSTRING_VALID 0 /* value returned by getstring() if text is valid */
@@ -97,13 +89,6 @@ typedef struct {
typedef enum
{
- IERROR_FATAL,
- IERROR_WARN
-}
-ierror_sev_e;
-
-typedef enum
-{
ERASE_DONT_FORCE,
ERASE_FORCE,
ERASE_FORCE_KEEP_NOTE,
@@ -112,9 +97,7 @@ typedef enum
erase_flag_e;
void exit_calcurse (int);
-void ierror (const char *, ierror_sev_e);
-void aerror (const char *, int, const char *);
-void warnbox (const char *);
+void fatalbox (const char *);
void status_mesg (char *, char *);
void erase_status_bar (void);
void erase_window_part (WINDOW *, int, int, int, int);
@@ -139,7 +122,6 @@ void reset_status_page (void);
void other_status_page (int);
long get_today (void);
long now (void);
-char *mycpy (const char *);
long mystrtol (const char *);
void print_bool_option_incolor (WINDOW *, bool, int, int);
char *new_tempfile (const char *, int);
diff --git a/src/wins.c b/src/wins.c
index b15d5b4..fb0db32 100755
--- a/src/wins.c
+++ b/src/wins.c
@@ -1,4 +1,4 @@
-/* $calcurse: wins.c,v 1.18 2008/11/23 20:38:56 culot Exp $ */
+/* $calcurse: wins.c,v 1.19 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -128,7 +128,7 @@ wins_init (void)
void
wins_scrollwin_init (scrollwin_t *sw)
{
- ASSERT (sw != NULL);
+ EXIT_IF (sw == 0, "null pointer");
sw->win.p = newwin (sw->win.h, sw->win.w, sw->win.y, sw->win.x);
sw->pad.p = newpad (sw->pad.h, sw->pad.w);
sw->first_visible_line = 0;
@@ -139,7 +139,7 @@ wins_scrollwin_init (scrollwin_t *sw)
void
wins_scrollwin_delete (scrollwin_t *sw)
{
- ASSERT (sw != NULL);
+ EXIT_IF (sw == 0, "null pointer");
delwin(sw->win.p);
delwin(sw->pad.p);
}
@@ -403,22 +403,18 @@ wins_update (void)
border_nocolor (win[APP].p);
border_nocolor (win[TOD].p);
break;
-
case APP:
border_color (win[APP].p);
border_nocolor (win[CAL].p);
border_nocolor (win[TOD].p);
break;
-
case TOD:
border_color (win[TOD].p);
border_nocolor (win[APP].p);
border_nocolor (win[CAL].p);
break;
-
default:
- ierror (_("FATAL ERROR in wins_update: no window selected\n"),
- IERROR_FATAL);
+ EXIT (_("no window selected"));
/* NOTREACHED */
}