Do not cast unused return values to void

A small style fix that removes all remaining "(void)" casts. Using these
isn't encouraged in GNU coding guidelines and doesn't serve a certain
purpose, except for satisfying a few static code analysis tools. We
already nuked some of these in previous patches, but this semantic patch
should fix what's left:

    @@
    identifier func;
    @@

    - (void)func (
    + func (
    ...);

Long lines were re-formatted manually.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2011-10-19 23:31:56 +02:00
parent 44bc9605d6
commit 7cc6305588
20 changed files with 470 additions and 492 deletions

View File

@ -191,7 +191,7 @@ apoint_add (void)
else else
{ {
status_mesg (format_message_1, enter_str); status_mesg (format_message_1, enter_str);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
else else
@ -231,7 +231,7 @@ apoint_add (void)
else else
{ {
status_mesg (format_message_2, enter_str); status_mesg (format_message_2, enter_str);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
else else
@ -247,14 +247,12 @@ apoint_add (void)
if (is_appointment) if (is_appointment)
{ {
apoint_start = date2sec (*calendar_get_slctd_day (), heures, minutes); apoint_start = date2sec (*calendar_get_slctd_day (), heures, minutes);
(void)apoint_new (item_mesg, 0L, apoint_start, apoint_new (item_mesg, 0L, apoint_start, min2sec (apoint_duration), 0L);
min2sec (apoint_duration), 0L);
if (notify_bar ()) if (notify_bar ())
notify_check_added (item_mesg, apoint_start, 0L); notify_check_added (item_mesg, apoint_start, 0L);
} }
else else
(void)event_new (item_mesg, 0L, event_new (item_mesg, 0L, date2sec (*calendar_get_slctd_day (), 0, 0), Id);
date2sec (*calendar_get_slctd_day (), 0, 0), Id);
if (hilt == 0) if (hilt == 0)
hilt++; hilt++;
@ -397,20 +395,20 @@ apoint_sec2str (struct apoint *o, int type, long day, char *start, char *end)
time_t t; time_t t;
if (o->start < day) if (o->start < day)
(void)strncpy (start, "..:..", 6); strncpy (start, "..:..", 6);
else else
{ {
t = o->start; t = o->start;
lt = localtime (&t); lt = localtime (&t);
(void)snprintf (start, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min); snprintf (start, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min);
} }
if (o->start + o->dur > day + DAYINSEC) if (o->start + o->dur > day + DAYINSEC)
(void)strncpy (end, "..:..", 6); strncpy (end, "..:..", 6);
else else
{ {
t = o->start + o->dur; t = o->start + o->dur;
lt = localtime (&t); lt = localtime (&t);
(void)snprintf (end, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min); snprintf (end, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min);
} }
} }
@ -422,25 +420,23 @@ apoint_write (struct apoint *o, FILE *f)
t = o->start; t = o->start;
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, "%02u/%02u/%04u @ %02u:%02u", fprintf (f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, lt->tm_hour, 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
lt->tm_min);
t = o->start + o->dur; t = o->start + o->dur;
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u ", fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u ", lt->tm_mon + 1, lt->tm_mday,
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, lt->tm_hour, 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
lt->tm_min);
if (o->note != NULL) if (o->note != NULL)
(void)fprintf (f, ">%s ", o->note); fprintf (f, ">%s ", o->note);
if (o->state & APOINT_NOTIFY) if (o->state & APOINT_NOTIFY)
(void)fputc ('!', f); fputc ('!', f);
else else
(void)fputc ('|', f); fputc ('|', f);
(void)fprintf (f, "%s\n", o->mesg); fprintf (f, "%s\n", o->mesg);
} }
struct apoint * struct apoint *
@ -450,10 +446,10 @@ apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note)
time_t tstart, tend, t; time_t tstart, tend, t;
t = time (NULL); t = time (NULL);
(void)localtime (&t); localtime (&t);
/* Read the appointment description */ /* Read the appointment description */
(void)fgets (buf, sizeof buf, f); fgets (buf, sizeof buf, f);
newline = strchr (buf, '\n'); newline = strchr (buf, '\n');
if (newline) if (newline)
*newline = '\0'; *newline = '\0';
@ -725,9 +721,8 @@ apoint_paste_item (void)
bkp_time = get_item_time (bkp_cut_apoint.start); bkp_time = get_item_time (bkp_cut_apoint.start);
bkp_start = calendar_get_slctd_day_sec () + bkp_time; bkp_start = calendar_get_slctd_day_sec () + bkp_time;
(void)apoint_new (bkp_cut_apoint.mesg, bkp_cut_apoint.note, apoint_new (bkp_cut_apoint.mesg, bkp_cut_apoint.note, bkp_start,
bkp_start, bkp_cut_apoint.dur, bkp_cut_apoint.dur, bkp_cut_apoint.state);
bkp_cut_apoint.state);
if (notify_bar ()) if (notify_bar ())
notify_check_added (bkp_cut_apoint.mesg, bkp_start, bkp_cut_apoint.state); notify_check_added (bkp_cut_apoint.mesg, bkp_start, bkp_cut_apoint.state);

View File

@ -209,7 +209,7 @@ print_notefile (FILE *out, char *filename, int nbtab)
else else
linestarter[0] = '\0'; linestarter[0] = '\0';
(void)snprintf (path_to_notefile, BUFSIZ, "%s/%s", path_notes, filename); snprintf (path_to_notefile, BUFSIZ, "%s/%s", path_notes, filename);
notefile = fopen (path_to_notefile, "r"); notefile = fopen (path_to_notefile, "r");
if (notefile) if (notefile)
{ {
@ -319,7 +319,7 @@ next_arg (void)
hours_left = (time_left / HOURINSEC); hours_left = (time_left / HOURINSEC);
min_left = (time_left - hours_left * HOURINSEC) / MININSEC; min_left = (time_left - hours_left * HOURINSEC) / MININSEC;
fputs (_("next appointment:\n"), stdout); fputs (_("next appointment:\n"), stdout);
(void)snprintf (mesg, BUFSIZ, " [%02d:%02d] %s\n", hours_left, min_left, snprintf (mesg, BUFSIZ, " [%02d:%02d] %s\n", hours_left, min_left,
next_app.txt); next_app.txt);
fputs (mesg, stdout); fputs (mesg, stdout);
mem_free (next_app.txt); mem_free (next_app.txt);
@ -548,7 +548,7 @@ display_app (struct tm *t, int numdays, int add_line, int print_note,
if (app_found) if (app_found)
add_line = 1; add_line = 1;
t->tm_mday++; t->tm_mday++;
(void)mktime (t); mktime (t);
} }
} }
@ -596,13 +596,13 @@ date_arg (char *ddate, int add_line, int print_note, struct conf *conf,
if (parse_date (ddate, conf->input_datefmt, (int *)&day.yyyy, if (parse_date (ddate, conf->input_datefmt, (int *)&day.yyyy,
(int *)&day.mm, (int *)&day.dd, NULL)) (int *)&day.mm, (int *)&day.dd, NULL))
{ {
(void)app_arg (add_line, &day, 0, print_note, conf, regex); app_arg (add_line, &day, 0, print_note, conf, regex);
} }
else else
{ {
char outstr[BUFSIZ]; char outstr[BUFSIZ];
fputs (_("Argument to the '-d' flag is not valid\n"), stderr); fputs (_("Argument to the '-d' flag is not valid\n"), stderr);
(void)snprintf (outstr, BUFSIZ, snprintf (outstr, BUFSIZ,
"Possible argument format are: '%s' or 'n'\n", "Possible argument format are: '%s' or 'n'\n",
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
fputs (_(outstr), stdout); fputs (_(outstr), stdout);
@ -650,7 +650,7 @@ date_arg_extended (char *startday, char *range, int add_line, int print_note,
{ {
t.tm_year -= 1900; t.tm_year -= 1900;
t.tm_mon--; t.tm_mon--;
(void)mktime (&t); mktime (&t);
} }
else else
{ {
@ -665,7 +665,7 @@ date_arg_extended (char *startday, char *range, int add_line, int print_note,
{ {
char outstr[BUFSIZ]; char outstr[BUFSIZ];
fputs (_("Argument is not valid\n"), stderr); fputs (_("Argument is not valid\n"), stderr);
(void)snprintf (outstr, BUFSIZ, snprintf (outstr, BUFSIZ,
"Argument format for -s and --startday is: '%s'\n", "Argument format for -s and --startday is: '%s'\n",
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
fputs (_(outstr), stdout); fputs (_(outstr), stdout);
@ -983,7 +983,7 @@ parse_args (int argc, char **argv, struct conf *conf)
custom_load_conf (conf); /* To get output date format. */ custom_load_conf (conf); /* To get output date format. */
io_load_app (); io_load_app ();
day.dd = day.mm = day.yyyy = 0; day.dd = day.mm = day.yyyy = 0;
(void)app_arg (add_line, &day, 0, Nflag, conf, preg); app_arg (add_line, &day, 0, Nflag, conf, preg);
non_interactive = 1; non_interactive = 1;
} }
} }

View File

@ -161,21 +161,21 @@
int len; \ int len; \
\ \
len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \ len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
(void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \ snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
if (ui_mode == UI_CURSES) \ if (ui_mode == UI_CURSES) \
fatalbox (msg); \ fatalbox (msg); \
else \ else \
(void)fprintf (stderr, "%s\n", msg); \ fprintf (stderr, "%s\n", msg); \
} while (0) } while (0)
#define WARN_MSG(...) do { \ #define WARN_MSG(...) do { \
char msg[BUFSIZ]; \ char msg[BUFSIZ]; \
\ \
(void)snprintf (msg, BUFSIZ, __VA_ARGS__); \ snprintf (msg, BUFSIZ, __VA_ARGS__); \
if (ui_mode == UI_CURSES) \ if (ui_mode == UI_CURSES) \
warnbox (msg); \ warnbox (msg); \
else \ else \
(void)fprintf (stderr, "%s\n", msg); \ fprintf (stderr, "%s\n", msg); \
} while (0) } while (0)
#define EXIT(...) do { \ #define EXIT(...) do { \

View File

@ -124,7 +124,7 @@ calendar_date_thread (void *arg)
tomorrow = (time_t) (get_today () + DAYINSEC); tomorrow = (time_t) (get_today () + DAYINSEC);
while ((actual = time (NULL)) < tomorrow) while ((actual = time (NULL)) < tomorrow)
(void)sleep (tomorrow - actual); sleep (tomorrow - actual);
calendar_set_current_date (); calendar_set_current_date ();
calendar_update_panel (&win[CAL]); calendar_update_panel (&win[CAL]);
@ -233,12 +233,12 @@ calendar_get_wday (struct date *date)
{ {
struct tm t; struct tm t;
(void)memset (&t, 0, sizeof (struct tm)); memset (&t, 0, sizeof (struct tm));
t.tm_mday = date->dd; t.tm_mday = date->dd;
t.tm_mon = date->mm - 1; t.tm_mon = date->mm - 1;
t.tm_year = date->yyyy - 1900; t.tm_year = date->yyyy - 1900;
(void)mktime (&t); mktime (&t);
return t.tm_wday; return t.tm_wday;
} }
@ -492,12 +492,12 @@ draw_weekly_view (struct window *cwin, struct date *current_day,
else else
days_to_remove = c_wday == 0 ? WEEKINDAYS - 1 : c_wday - 1; days_to_remove = c_wday == 0 ? WEEKINDAYS - 1 : c_wday - 1;
(void)memset (&t, 0, sizeof (struct tm)); memset (&t, 0, sizeof (struct tm));
t.tm_mday = slctd_day.dd; t.tm_mday = slctd_day.dd;
t.tm_mon = slctd_day.mm - 1; t.tm_mon = slctd_day.mm - 1;
t.tm_year = slctd_day.yyyy - 1900; t.tm_year = slctd_day.yyyy - 1900;
(void)mktime (&t); mktime (&t);
(void)date_change (&t, 0, -days_to_remove); date_change (&t, 0, -days_to_remove);
/* Print the week number. */ /* Print the week number. */
weeknum = ISO8601weeknum (&t); weeknum = ISO8601weeknum (&t);
@ -569,7 +569,7 @@ draw_weekly_view (struct window *cwin, struct date *current_day,
} }
/* get next day */ /* get next day */
(void)date_change (&t, 0, 1); date_change (&t, 0, 1);
} }
/* Draw marks to indicate midday on the sides of the calendar. */ /* Draw marks to indicate midday on the sides of the calendar. */
@ -633,7 +633,7 @@ calendar_change_day (int datefmt)
while (wrong_day) while (wrong_day)
{ {
(void)snprintf (outstr, BUFSIZ, request_date, DATEFMT_DESC (datefmt)); snprintf (outstr, BUFSIZ, request_date, DATEFMT_DESC (datefmt));
status_mesg (_(outstr), ""); status_mesg (_(outstr), "");
if (getstring (win[STA].p, selected_day, LDAY, 0, 1) == GETSTRING_ESC) if (getstring (win[STA].p, selected_day, LDAY, 0, 1) == GETSTRING_ESC)
return; return;
@ -656,7 +656,7 @@ calendar_change_day (int datefmt)
if (wrong_day) if (wrong_day)
{ {
status_mesg (mesg_line1, mesg_line2); status_mesg (mesg_line1, mesg_line2);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
} }
@ -670,7 +670,7 @@ calendar_move (enum move move, int count)
int ret, days_to_remove, days_to_add; int ret, days_to_remove, days_to_add;
struct tm t; struct tm t;
(void)memset (&t, 0, sizeof (struct tm)); memset (&t, 0, sizeof (struct tm));
t.tm_mday = slctd_day.dd; t.tm_mday = slctd_day.dd;
t.tm_mon = slctd_day.mm - 1; t.tm_mon = slctd_day.mm - 1;
t.tm_year = slctd_day.yyyy - 1900; t.tm_year = slctd_day.yyyy - 1900;
@ -703,7 +703,7 @@ calendar_move (enum move move, int count)
break; break;
case WEEK_START: case WEEK_START:
/* Normalize struct tm to get week day number. */ /* Normalize struct tm to get week day number. */
(void)mktime (&t); mktime (&t);
if (calendar_week_begins_on_monday ()) if (calendar_week_begins_on_monday ())
days_to_remove = ((t.tm_wday == 0) ? WEEKINDAYS - 1 : t.tm_wday - 1); days_to_remove = ((t.tm_wday == 0) ? WEEKINDAYS - 1 : t.tm_wday - 1);
else else
@ -712,7 +712,7 @@ calendar_move (enum move move, int count)
ret = date_change (&t, 0, -days_to_remove); ret = date_change (&t, 0, -days_to_remove);
break; break;
case WEEK_END: case WEEK_END:
(void)mktime (&t); mktime (&t);
if (calendar_week_begins_on_monday ()) if (calendar_week_begins_on_monday ())
days_to_add = ((t.tm_wday == 0) ? 0 : WEEKINDAYS - t.tm_wday); days_to_add = ((t.tm_wday == 0) ? 0 : WEEKINDAYS - t.tm_wday);
else else

View File

@ -334,23 +334,23 @@ custom_set_conf (struct conf *conf, enum conf_var var, char *val)
return conf_parse_bool (&nbar.show, val); return conf_parse_bool (&nbar.show, val);
break; break;
case CUSTOM_CONF_NOTIFYBARDATE: case CUSTOM_CONF_NOTIFYBARDATE:
(void)strncpy (nbar.datefmt, val, strlen (val) + 1); strncpy (nbar.datefmt, val, strlen (val) + 1);
break; break;
case CUSTOM_CONF_NOTIFYBARCLOCK: case CUSTOM_CONF_NOTIFYBARCLOCK:
(void)strncpy (nbar.timefmt, val, strlen (val) + 1); strncpy (nbar.timefmt, val, strlen (val) + 1);
break; break;
case CUSTOM_CONF_NOTIFYBARWARNING: case CUSTOM_CONF_NOTIFYBARWARNING:
return conf_parse_int (&nbar.cntdwn, val); return conf_parse_int (&nbar.cntdwn, val);
break; break;
case CUSTOM_CONF_NOTIFYBARCOMMAND: case CUSTOM_CONF_NOTIFYBARCOMMAND:
(void)strncpy (nbar.cmd, val, strlen (val) + 1); strncpy (nbar.cmd, val, strlen (val) + 1);
break; break;
case CUSTOM_CONF_NOTIFYALL: case CUSTOM_CONF_NOTIFYALL:
return conf_parse_bool (&nbar.notify_all, val); return conf_parse_bool (&nbar.notify_all, val);
break; break;
case CUSTOM_CONF_OUTPUTDATEFMT: case CUSTOM_CONF_OUTPUTDATEFMT:
if (val[0] != '\0') if (val[0] != '\0')
(void)strncpy (conf->output_datefmt, val, strlen (val) + 1); strncpy (conf->output_datefmt, val, strlen (val) + 1);
break; break;
case CUSTOM_CONF_INPUTDATEFMT: case CUSTOM_CONF_INPUTDATEFMT:
return conf_parse_int (&conf->input_datefmt, val); return conf_parse_int (&conf->input_datefmt, val);
@ -390,7 +390,7 @@ custom_load_conf (struct conf *conf)
status_mesg (mesg_line1, mesg_line2); status_mesg (mesg_line1, mesg_line2);
wnoutrefresh (win[STA].p); wnoutrefresh (win[STA].p);
wins_doupdate (); wins_doupdate ();
(void)keys_getch (win[STA].p, NULL); keys_getch (win[STA].p, NULL);
} }
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
@ -573,7 +573,7 @@ custom_layout_config (void)
" 't' -> todo panel\n\n"); " 't' -> todo panel\n\n");
conf_win.p = (WINDOW *)0; conf_win.p = (WINDOW *)0;
(void)strncpy (label, _("layout configuration"), BUFSIZ); strncpy (label, _("layout configuration"), BUFSIZ);
custom_confwin_init (&conf_win, label); custom_confwin_init (&conf_win, label);
cursor = mark = wins_layout () - 1; cursor = mark = wins_layout () - 1;
display_layout_config (&conf_win, mark, cursor); display_layout_config (&conf_win, mark, cursor);
@ -723,7 +723,7 @@ custom_confwin_init (struct window *confwin, char *label)
{ {
erase_window_part (confwin->p, confwin->x, confwin->y, erase_window_part (confwin->p, confwin->x, confwin->y,
confwin->x + confwin->w, confwin->y + confwin->h); confwin->x + confwin->w, confwin->y + confwin->h);
(void)delwin (confwin->p); delwin (confwin->p);
} }
wins_get_config (); wins_get_config ();
@ -893,7 +893,7 @@ custom_color_config (void)
char label[BUFSIZ]; char label[BUFSIZ];
conf_win.p = 0; conf_win.p = 0;
(void)strncpy (label, _("color theme"), BUFSIZ); strncpy (label, _("color theme"), BUFSIZ);
custom_confwin_init (&conf_win, label); custom_confwin_init (&conf_win, label);
mark_fore = NBUSERCOLORS; mark_fore = NBUSERCOLORS;
mark_back = SIZE - 1; mark_back = SIZE - 1;
@ -995,7 +995,7 @@ custom_color_theme_name (char *theme_name)
}; };
if (!colorize) if (!colorize)
(void)strncpy (theme_name, "0", BUFSIZ); strncpy (theme_name, "0", BUFSIZ);
else else
{ {
pair_content (COLR_CUSTOM, &color[0], &color[1]); pair_content (COLR_CUSTOM, &color[0], &color[1]);
@ -1011,8 +1011,7 @@ custom_color_theme_name (char *theme_name)
/* NOTREACHED */ /* NOTREACHED */
} }
} }
(void)snprintf (theme_name, BUFSIZ, "%s on %s", color_name[0], snprintf (theme_name, BUFSIZ, "%s on %s", color_name[0], color_name[1]);
color_name[1]);
} }
} }
@ -1160,7 +1159,7 @@ custom_general_config (struct conf *conf)
clear (); clear ();
custom_set_swsiz (&cwin); custom_set_swsiz (&cwin);
(void)strncpy (cwin.label, _("general options"), BUFSIZ); strncpy (cwin.label, _("general options"), BUFSIZ);
wins_scrollwin_init (&cwin); wins_scrollwin_init (&cwin);
wins_show (cwin.win.p, cwin.label); wins_show (cwin.win.p, cwin.label);
status_mesg (number_str, keys); status_mesg (number_str, keys);
@ -1217,11 +1216,11 @@ custom_general_config (struct conf *conf)
break; break;
case '9': case '9':
status_mesg (output_datefmt_str, ""); status_mesg (output_datefmt_str, "");
(void)strncpy (buf, conf->output_datefmt, strncpy (buf, conf->output_datefmt,
strlen (conf->output_datefmt) + 1); strlen (conf->output_datefmt) + 1);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
(void)strncpy (conf->output_datefmt, buf, strlen (buf) + 1); strncpy (conf->output_datefmt, buf, strlen (buf) + 1);
} }
status_mesg (number_str, keys); status_mesg (number_str, keys);
break; break;
@ -1293,7 +1292,7 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff)
int nbkeys; int nbkeys;
nbkeys = keys_action_count_keys (action); nbkeys = keys_action_count_keys (action);
(void)snprintf (actionstr, BUFSIZ, "%s", keys_get_label (action)); snprintf (actionstr, BUFSIZ, "%s", keys_get_label (action));
if (action == selected_row) if (action == selected_row)
custom_apply_attr (win, ATTR_HIGHEST); custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, XPOS, "%s ", actionstr); mvwprintw (win, y, XPOS, "%s ", actionstr);
@ -1365,7 +1364,7 @@ custom_keys_config (void)
clear (); clear ();
custom_set_swsiz (&kwin); custom_set_swsiz (&kwin);
nbdisplayed = (kwin.win.h - LABELLINES) / LINESPERKEY; nbdisplayed = (kwin.win.h - LABELLINES) / LINESPERKEY;
(void)strncpy (kwin.label, _("keys configuration"), BUFSIZ); strncpy (kwin.label, _("keys configuration"), BUFSIZ);
wins_scrollwin_init (&kwin); wins_scrollwin_init (&kwin);
wins_show (kwin.win.p, kwin.label); wins_show (kwin.win.p, kwin.label);
custom_keys_config_bar (); custom_keys_config_bar ();

View File

@ -151,7 +151,7 @@ day_store_events (long date)
LLIST_FIND_FOREACH_CONT (&eventlist, date, event_inday, i) LLIST_FIND_FOREACH_CONT (&eventlist, date, event_inday, i)
{ {
struct event *ev = LLIST_TS_GET_DATA (i); struct event *ev = LLIST_TS_GET_DATA (i);
(void)day_add_event (EVNT, ev->mesg, ev->note, ev->day, ev->id); day_add_event (EVNT, ev->mesg, ev->note, ev->day, ev->id);
e_nb++; e_nb++;
} }
@ -174,8 +174,7 @@ day_store_recur_events (long date)
LLIST_FIND_FOREACH (&recur_elist, date, recur_event_inday, i) LLIST_FIND_FOREACH (&recur_elist, date, recur_event_inday, i)
{ {
struct recur_event *rev = LLIST_TS_GET_DATA (i); struct recur_event *rev = LLIST_TS_GET_DATA (i);
(void)day_add_event (RECUR_EVNT, rev->mesg, rev->note, rev->day, day_add_event (RECUR_EVNT, rev->mesg, rev->note, rev->day, rev->id);
rev->id);
e_nb++; e_nb++;
} }
@ -199,7 +198,7 @@ day_store_apoints (long date)
LLIST_TS_FIND_FOREACH_CONT (&alist_p, date, apoint_inday, i) LLIST_TS_FIND_FOREACH_CONT (&alist_p, date, apoint_inday, i)
{ {
struct apoint *apt = LLIST_TS_GET_DATA (i); struct apoint *apt = LLIST_TS_GET_DATA (i);
(void)day_add_apoint (APPT, apt->mesg, apt->note, apt->start, apt->dur, day_add_apoint (APPT, apt->mesg, apt->note, apt->start, apt->dur,
apt->state, 0); apt->state, 0);
a_nb++; a_nb++;
} }
@ -228,7 +227,7 @@ day_store_recur_apoints (long date)
unsigned real_start; unsigned real_start;
if (recur_apoint_find_occurrence (rapt, date, &real_start)) if (recur_apoint_find_occurrence (rapt, date, &real_start))
{ {
(void)day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start, day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start,
rapt->dur, rapt->state, a_nb); rapt->dur, rapt->state, a_nb);
a_nb++; a_nb++;
} }
@ -591,7 +590,7 @@ day_edit_time (int time, unsigned *new_hour, unsigned *new_minute)
else else
{ {
status_mesg (fmt_msg, enter_str); status_mesg (fmt_msg, enter_str);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
else else
@ -631,7 +630,7 @@ day_edit_duration (int start, int dur, unsigned *new_duration)
else else
{ {
status_mesg (fmt_msg, enter_str); status_mesg (fmt_msg, enter_str);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
else else
@ -665,7 +664,7 @@ update_start_time (long *start, long *dur)
else else
{ {
status_mesg (msg_wrong_time, msg_enter); status_mesg (msg_wrong_time, msg_enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
valid_date = 0; valid_date = 0;
} }
} }
@ -710,7 +709,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
{ {
status_mesg (msg_rpt_type, msg_rpt_ans); status_mesg (msg_rpt_type, msg_rpt_ans);
typstr = mem_calloc (SINGLECHAR, sizeof (char)); typstr = mem_calloc (SINGLECHAR, sizeof (char));
(void)snprintf (typstr, SINGLECHAR, "%c", recur_def2char ((*rpt)->type)); snprintf (typstr, SINGLECHAR, "%c", recur_def2char ((*rpt)->type));
if (updatestring (win[STA].p, &typstr, 0, 1) == GETSTRING_VALID) if (updatestring (win[STA].p, &typstr, 0, 1) == GETSTRING_VALID)
{ {
ch = toupper (*typstr); ch = toupper (*typstr);
@ -728,7 +727,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
{ {
status_mesg (_("Enter the new repetition frequence:"), ""); status_mesg (_("Enter the new repetition frequence:"), "");
freqstr = mem_malloc (BUFSIZ); freqstr = mem_malloc (BUFSIZ);
(void)snprintf (freqstr, BUFSIZ, "%d", (*rpt)->freq); snprintf (freqstr, BUFSIZ, "%d", (*rpt)->freq);
if (updatestring (win[STA].p, &freqstr, 0, 1) == GETSTRING_VALID) if (updatestring (win[STA].p, &freqstr, 0, 1) == GETSTRING_VALID)
{ {
newfreq = atoi (freqstr); newfreq = atoi (freqstr);
@ -736,7 +735,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
if (newfreq == 0) if (newfreq == 0)
{ {
status_mesg (msg_wrong_freq, msg_enter); status_mesg (msg_wrong_freq, msg_enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
else else
@ -749,7 +748,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
do do
{ {
(void)snprintf (outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'", snprintf (outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'",
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
status_mesg (_(outstr), ""); status_mesg (_(outstr), "");
timstr = timstr =
@ -783,7 +782,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
if (newuntil < start) if (newuntil < start)
{ {
status_mesg (msg_wrong_time, msg_enter); status_mesg (msg_wrong_time, msg_enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
date_entered = 0; date_entered = 0;
} }
else else
@ -791,10 +790,10 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
} }
else else
{ {
(void)snprintf (outstr, BUFSIZ, msg_fmts, snprintf (outstr, BUFSIZ, msg_fmts,
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
status_mesg (msg_wrong_date, _(outstr)); status_mesg (msg_wrong_date, _(outstr));
(void)wgetch (win[STA].p); wgetch (win[STA].p);
date_entered = 0; date_entered = 0;
} }
} }

View File

@ -49,7 +49,7 @@
#define DMON_LOG(...) do { \ #define DMON_LOG(...) do { \
if (dmon.log) \ if (dmon.log) \
(void)io_fprintln (path_dmon_log, __VA_ARGS__); \ io_fprintln (path_dmon_log, __VA_ARGS__); \
} while (0) } while (0)
#define DMON_ABRT(...) do { \ #define DMON_ABRT(...) do { \
@ -131,15 +131,15 @@ daemonize (int status)
/* Redirect standard file descriptors to /dev/null. */ /* Redirect standard file descriptors to /dev/null. */
if ((fd = open (_PATH_DEVNULL, O_RDWR, 0)) != -1) if ((fd = open (_PATH_DEVNULL, O_RDWR, 0)) != -1)
{ {
(void)dup2 (fd, STDIN_FILENO); dup2 (fd, STDIN_FILENO);
(void)dup2 (fd, STDOUT_FILENO); dup2 (fd, STDOUT_FILENO);
(void)dup2 (fd, STDERR_FILENO); dup2 (fd, STDERR_FILENO);
if (fd > 2) if (fd > 2)
(void)close (fd); close (fd);
} }
/* Write access for the owner only. */ /* Write access for the owner only. */
(void)umask (0022); umask (0022);
if (!sigs_set_hdlr (SIGINT, dmon_sigs_hdlr) if (!sigs_set_hdlr (SIGINT, dmon_sigs_hdlr)
|| !sigs_set_hdlr (SIGTERM, dmon_sigs_hdlr) || !sigs_set_hdlr (SIGTERM, dmon_sigs_hdlr)

View File

@ -131,11 +131,11 @@ event_write (struct event *o, FILE *f)
t = o->day; t = o->day;
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, "%02u/%02u/%04u [%d] ", lt->tm_mon + 1, lt->tm_mday, fprintf (f, "%02u/%02u/%04u [%d] ", lt->tm_mon + 1, lt->tm_mday,
1900 + lt->tm_year, o->id); 1900 + lt->tm_year, o->id);
if (o->note != NULL) if (o->note != NULL)
(void)fprintf (f, ">%s ", o->note); fprintf (f, ">%s ", o->note);
(void)fprintf (f, "%s\n", o->mesg); fprintf (f, "%s\n", o->mesg);
} }
/* Load the events from file */ /* Load the events from file */
@ -146,10 +146,10 @@ event_scan (FILE *f, struct tm start, int id, char *note)
time_t tstart, t; time_t tstart, t;
t = time (NULL); t = time (NULL);
(void)localtime (&t); localtime (&t);
/* Read the event description */ /* Read the event description */
(void)fgets (buf, sizeof buf, f); fgets (buf, sizeof buf, f);
nl = strchr (buf, '\n'); nl = strchr (buf, '\n');
if (nl) if (nl)
{ {
@ -212,8 +212,7 @@ event_delete_bynum (long start, unsigned num, enum eraseflg flag)
void void
event_paste_item (void) event_paste_item (void)
{ {
(void)event_new (bkp_cut_event.mesg, bkp_cut_event.note, event_new (bkp_cut_event.mesg, bkp_cut_event.note,
date2sec (*calendar_get_slctd_day (), 0, 0), date2sec (*calendar_get_slctd_day (), 0, 0), bkp_cut_event.id);
bkp_cut_event.id);
event_free_bkp (); event_free_bkp ();
} }

View File

@ -282,7 +282,7 @@ updatestring (WINDOW *win, char **str, int x, int y)
EXIT_IF (len + 1 > BUFSIZ, _("Internal error: line too long")); EXIT_IF (len + 1 > BUFSIZ, _("Internal error: line too long"));
buf = mem_malloc (BUFSIZ); buf = mem_malloc (BUFSIZ);
(void)memcpy (buf, *str, len + 1); memcpy (buf, *str, len + 1);
ret = getstring (win, buf, BUFSIZ, x, y); ret = getstring (win, buf, BUFSIZ, x, y);
@ -291,7 +291,7 @@ updatestring (WINDOW *win, char **str, int x, int y)
len = strlen (buf); len = strlen (buf);
*str = mem_realloc (*str, len + 1, 1); *str = mem_realloc (*str, len + 1, 1);
EXIT_IF (*str == NULL, _("out of memory")); EXIT_IF (*str == NULL, _("out of memory"));
(void)memcpy (*str, buf, len + 1); memcpy (*str, buf, len + 1);
} }
mem_free (buf); mem_free (buf);

View File

@ -168,7 +168,7 @@ help_wins_init (struct scrollwin *hwin, int x, int y, int h, int w)
hwin->pad.h = BUFSIZ; hwin->pad.h = BUFSIZ;
hwin->pad.w = hwin->win.w - 2 * PADOFFSET + 1; hwin->pad.w = hwin->win.w - 2 * PADOFFSET + 1;
(void)strncpy (hwin->label, _("Calcurse help"), BUFSIZ); strncpy (hwin->label, _("Calcurse help"), BUFSIZ);
wins_scrollwin_init (hwin); wins_scrollwin_init (hwin);
wins_show (hwin->win.p, hwin->label); wins_show (hwin->win.p, hwin->label);
} }
@ -342,7 +342,7 @@ help_screen (void)
hscr[HELP_MAIN].title = hscr[HELP_MAIN].title =
_(" Welcome to Calcurse. This is the main help screen.\n"); _(" Welcome to Calcurse. This is the main help screen.\n");
(void)snprintf (hscr[HELP_MAIN].text, HELPTEXTSIZ, snprintf (hscr[HELP_MAIN].text, HELPTEXTSIZ,
_("Moving around: Press '%s' or '%s' to scroll text upward or downward\n" _("Moving around: Press '%s' or '%s' to scroll text upward or downward\n"
" inside help screens, if necessary.\n\n" " inside help screens, if necessary.\n\n"
" Exit help: When finished, press '%s' to exit help and go back to\n" " Exit help: When finished, press '%s' to exit help and go back to\n"
@ -363,7 +363,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_CREDITS)); keys_action_firstkey (KEY_GENERIC_CREDITS));
hscr[HELP_SAVE].title = _("Save\n"); hscr[HELP_SAVE].title = _("Save\n");
(void)snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ, snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
_("Save calcurse data.\n" _("Save calcurse data.\n"
"Data are splitted into four different files which contain :" "Data are splitted into four different files which contain :"
"\n\n" "\n\n"
@ -376,7 +376,7 @@ help_screen (void)
"automatically before quitting.")); "automatically before quitting."));
hscr[HELP_IMPORT].title = _("Import\n"); hscr[HELP_IMPORT].title = _("Import\n");
(void)snprintf (hscr[HELP_IMPORT].text, HELPTEXTSIZ, snprintf (hscr[HELP_IMPORT].text, HELPTEXTSIZ,
_("Import data from an icalendar file.\n" _("Import data from an icalendar file.\n"
"You will be asked to enter the file name from which to load ical\n" "You will be asked to enter the file name from which to load ical\n"
"items. At the end of the import process, and if the general option\n" "items. At the end of the import process, and if the general option\n"
@ -394,7 +394,7 @@ help_screen (void)
"the item could not be imported.\n")); "the item could not be imported.\n"));
hscr[HELP_EXPORT].title = _("Export\n"); hscr[HELP_EXPORT].title = _("Export\n");
(void)snprintf (hscr[HELP_EXPORT].text, HELPTEXTSIZ, snprintf (hscr[HELP_EXPORT].text, HELPTEXTSIZ,
_("Export calcurse data (appointments, events and todos).\n" _("Export calcurse data (appointments, events and todos).\n"
"This leads to the export submenu, from which you can choose between\n" "This leads to the export submenu, from which you can choose between\n"
"two different export formats: 'ical' and 'pcal'. Choosing one of\n" "two different export formats: 'ical' and 'pcal'. Choosing one of\n"
@ -409,15 +409,15 @@ help_screen (void)
"Calcurse data are exported in the following order:\n" "Calcurse data are exported in the following order:\n"
" events, appointments, todos.\n")); " events, appointments, todos.\n"));
(void)strncpy (keystr[MOVE_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ); strncpy (keystr[MOVE_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ);
(void)strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN), strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN),
BUFSIZ); BUFSIZ);
(void)strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT), strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT),
BUFSIZ); BUFSIZ);
(void)strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT), strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT),
BUFSIZ); BUFSIZ);
hscr[HELP_DISPLACEMENT].title = _("Displacement keys\n"); hscr[HELP_DISPLACEMENT].title = _("Displacement keys\n");
(void)snprintf (hscr[HELP_DISPLACEMENT].text, HELPTEXTSIZ, snprintf (hscr[HELP_DISPLACEMENT].text, HELPTEXTSIZ,
_("Move around inside calcurse screens.\n" _("Move around inside calcurse screens.\n"
"The following scheme summarizes how to get around:\n\n" "The following scheme summarizes how to get around:\n\n"
" move up\n" " move up\n"
@ -444,7 +444,7 @@ help_screen (void)
keys_action_firstkey (KEY_END_OF_WEEK)); keys_action_firstkey (KEY_END_OF_WEEK));
hscr[HELP_VIEW].title = _("View\n"); hscr[HELP_VIEW].title = _("View\n");
(void)snprintf (hscr[HELP_VIEW].text, HELPTEXTSIZ, snprintf (hscr[HELP_VIEW].text, HELPTEXTSIZ,
_("View the item you select in either the Todo or Appointment panel.\n" _("View the item you select in either the Todo or Appointment panel.\n"
"\nThis is usefull when an event description is longer than the " "\nThis is usefull when an event description is longer than the "
"available\nspace to display it. " "available\nspace to display it. "
@ -457,7 +457,7 @@ help_screen (void)
keys_action_firstkey (KEY_VIEW_ITEM)); keys_action_firstkey (KEY_VIEW_ITEM));
hscr[HELP_PIPE].title = _("Pipe\n"); hscr[HELP_PIPE].title = _("Pipe\n");
(void)snprintf (hscr[HELP_PIPE].text, HELPTEXTSIZ, snprintf (hscr[HELP_PIPE].text, HELPTEXTSIZ,
_("Pipe the selected item to an external program.\n" _("Pipe the selected item to an external program.\n"
"\nPress the '%s' key to pipe the currently selected appointment or\n" "\nPress the '%s' key to pipe the currently selected appointment or\n"
"todo entry to an external program.\n" "todo entry to an external program.\n"
@ -465,7 +465,7 @@ help_screen (void)
keys_action_firstkey (KEY_PIPE_ITEM)); keys_action_firstkey (KEY_PIPE_ITEM));
hscr[HELP_TAB].title = _("Tab\n"); hscr[HELP_TAB].title = _("Tab\n");
(void)snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ, snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
_("Switch between panels.\n" _("Switch between panels.\n"
"The panel currently in use has its border colorized.\n" "The panel currently in use has its border colorized.\n"
"\nSome actions are possible only if the right panel is selected.\n" "\nSome actions are possible only if the right panel is selected.\n"
@ -480,7 +480,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW)); keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW));
hscr[HELP_GOTO].title = _("Goto\n"); hscr[HELP_GOTO].title = _("Goto\n");
(void)snprintf (hscr[HELP_GOTO].text, HELPTEXTSIZ, snprintf (hscr[HELP_GOTO].text, HELPTEXTSIZ,
_("Jump to a specific day in the calendar.\n" _("Jump to a specific day in the calendar.\n"
"\nUsing this command, you do not need to travel to that day using\n" "\nUsing this command, you do not need to travel to that day using\n"
"the displacement keys inside the calendar panel.\n" "the displacement keys inside the calendar panel.\n"
@ -491,7 +491,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY)); keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
hscr[HELP_DELETE].title = _("Delete\n"); hscr[HELP_DELETE].title = _("Delete\n");
(void)snprintf (hscr[HELP_DELETE].text, HELPTEXTSIZ, snprintf (hscr[HELP_DELETE].text, HELPTEXTSIZ,
_("Delete an element in the ToDo or Appointment list.\n" _("Delete an element in the ToDo or Appointment list.\n"
"\nDepending on which panel is selected when you press the delete key,\n" "\nDepending on which panel is selected when you press the delete key,\n"
"the hilighted item of either the ToDo or Appointment list will be \n" "the hilighted item of either the ToDo or Appointment list will be \n"
@ -505,7 +505,7 @@ help_screen (void)
"next time you launch Calcurse.")); "next time you launch Calcurse."));
hscr[HELP_ADD].title = _("Add\n"); hscr[HELP_ADD].title = _("Add\n");
(void)snprintf (hscr[HELP_ADD].text, HELPTEXTSIZ, snprintf (hscr[HELP_ADD].text, HELPTEXTSIZ,
_("Add an item in either the ToDo or Appointment list, depending on which\n" _("Add an item in either the ToDo or Appointment list, depending on which\n"
"panel is selected when you press '%s'.\n" "panel is selected when you press '%s'.\n"
"\nTo enter a new item in the TODO list, you will need first to enter the" "\nTo enter a new item in the TODO list, you will need first to enter the"
@ -542,7 +542,7 @@ help_screen (void)
keys_action_firstkey (KEY_ADD_ITEM)); keys_action_firstkey (KEY_ADD_ITEM));
hscr[HELP_CUT_PASTE].title = _("Cut and Paste\n"); hscr[HELP_CUT_PASTE].title = _("Cut and Paste\n");
(void)snprintf (hscr[HELP_CUT_PASTE].text, HELPTEXTSIZ, snprintf (hscr[HELP_CUT_PASTE].text, HELPTEXTSIZ,
_("Cut and paste the currently selected item. This is useful to quickly\n" _("Cut and paste the currently selected item. This is useful to quickly\n"
"move an item from one date to another.\n" "move an item from one date to another.\n"
"To do so, one must first highlight the item that needs to be moved,\n" "To do so, one must first highlight the item that needs to be moved,\n"
@ -558,7 +558,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_PASTE)); keys_action_firstkey (KEY_GENERIC_PASTE));
hscr[HELP_EDIT].title = _("Edit Item\n"); hscr[HELP_EDIT].title = _("Edit Item\n");
(void)snprintf (hscr[HELP_EDIT].text, HELPTEXTSIZ, snprintf (hscr[HELP_EDIT].text, HELPTEXTSIZ,
_("Edit the item which is currently selected.\n" _("Edit the item which is currently selected.\n"
"Depending on the item type (appointment, event, or todo), and if it is\n" "Depending on the item type (appointment, event, or todo), and if it is\n"
"repeated or not, you will be asked to choose one of the item properties" "repeated or not, you will be asked to choose one of the item properties"
@ -575,7 +575,7 @@ help_screen (void)
" modified properties next time you launch Calcurse.")); " modified properties next time you launch Calcurse."));
hscr[HELP_ENOTE].title = _("EditNote\n"); hscr[HELP_ENOTE].title = _("EditNote\n");
(void)snprintf (hscr[HELP_ENOTE].text, HELPTEXTSIZ, snprintf (hscr[HELP_ENOTE].text, HELPTEXTSIZ,
_("Attach a note to any type of item, or edit an already existing note.\n" _("Attach a note to any type of item, or edit an already existing note.\n"
"This feature is useful if you do not have enough space to store all\n" "This feature is useful if you do not have enough space to store all\n"
"of your item description, or if you would like to add sub-tasks to an\n" "of your item description, or if you would like to add sub-tasks to an\n"
@ -596,7 +596,7 @@ help_screen (void)
keys_action_firstkey (KEY_EDIT_NOTE)); keys_action_firstkey (KEY_EDIT_NOTE));
hscr[HELP_VNOTE].title = _("ViewNote\n"); hscr[HELP_VNOTE].title = _("ViewNote\n");
(void)snprintf (hscr[HELP_VNOTE].text, HELPTEXTSIZ, snprintf (hscr[HELP_VNOTE].text, HELPTEXTSIZ,
_("View a note which was previously attached to an item (an item which\n" _("View a note which was previously attached to an item (an item which\n"
"owns a note has a '>' sign in front of it).\n" "owns a note has a '>' sign in front of it).\n"
"This command only permits to view the note, not to edit it (to do so,\n" "This command only permits to view the note, not to edit it (to do so,\n"
@ -615,7 +615,7 @@ help_screen (void)
keys_action_firstkey (KEY_VIEW_NOTE)); keys_action_firstkey (KEY_VIEW_NOTE));
hscr[HELP_PRIORITY].title = _("Priority\n"); hscr[HELP_PRIORITY].title = _("Priority\n");
(void)snprintf (hscr[HELP_PRIORITY].text, HELPTEXTSIZ, snprintf (hscr[HELP_PRIORITY].text, HELPTEXTSIZ,
_("Change the priority of the currently selected item in the ToDo list.\n" _("Change the priority of the currently selected item in the ToDo list.\n"
"Priorities are represented by the number appearing in front of the\n" "Priorities are represented by the number appearing in front of the\n"
"todo description. This number goes from 9 for the lowest priority to\n" "todo description. This number goes from 9 for the lowest priority to\n"
@ -633,7 +633,7 @@ help_screen (void)
keys_action_firstkey (KEY_LOWER_PRIORITY)); keys_action_firstkey (KEY_LOWER_PRIORITY));
hscr[HELP_REPEAT].title = _("Repeat\n"); hscr[HELP_REPEAT].title = _("Repeat\n");
(void)snprintf (hscr[HELP_REPEAT].text, HELPTEXTSIZ, snprintf (hscr[HELP_REPEAT].text, HELPTEXTSIZ,
_("Repeat an event or an appointment.\n" _("Repeat an event or an appointment.\n"
"You must first select the item to be repeated by moving inside the\n" "You must first select the item to be repeated by moving inside the\n"
"appointment panel. Then pressing '%s' will lead you to a set of three\n" "appointment panel. Then pressing '%s' will lead you to a set of three\n"
@ -660,7 +660,7 @@ help_screen (void)
keys_action_firstkey (KEY_REPEAT_ITEM)); keys_action_firstkey (KEY_REPEAT_ITEM));
hscr[HELP_FLAG].title = _("Flag Item\n"); hscr[HELP_FLAG].title = _("Flag Item\n");
(void)snprintf (hscr[HELP_FLAG].text, HELPTEXTSIZ, snprintf (hscr[HELP_FLAG].text, HELPTEXTSIZ,
_("Toggle an appointment's 'important' flag or a todo's 'completed' flag.\n" _("Toggle an appointment's 'important' flag or a todo's 'completed' flag.\n"
"If a todo is flagged as completed, its priority number will be replaced\n" "If a todo is flagged as completed, its priority number will be replaced\n"
"by an 'X' sign. Completed tasks will no longer appear in exported data\n" "by an 'X' sign. Completed tasks will no longer appear in exported data\n"
@ -674,7 +674,7 @@ help_screen (void)
"\nand how long before it he gets notified.")); "\nand how long before it he gets notified."));
hscr[HELP_CONFIG].title = _("Config\n"); hscr[HELP_CONFIG].title = _("Config\n");
(void)snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ, snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
_("Open the configuration submenu.\n" _("Open the configuration submenu.\n"
"From this submenu, you can select between color, layout, notification\n" "From this submenu, you can select between color, layout, notification\n"
"and general options, and you can also configure your keybindings.\n" "and general options, and you can also configure your keybindings.\n"
@ -689,7 +689,7 @@ help_screen (void)
"\nnext time you launch Calcurse.")); "\nnext time you launch Calcurse."));
hscr[HELP_GENERAL].title = _("Generic keybindings\n"); hscr[HELP_GENERAL].title = _("Generic keybindings\n");
(void)snprintf (hscr[HELP_GENERAL].text, HELPTEXTSIZ, snprintf (hscr[HELP_GENERAL].text, HELPTEXTSIZ,
_("Some of the keybindings apply whatever panel is selected. They are\n" _("Some of the keybindings apply whatever panel is selected. They are\n"
"called generic keybinding.\n" "called generic keybinding.\n"
"Here is the list of all the generic key bindings, together with their\n" "Here is the list of all the generic key bindings, together with their\n"
@ -720,7 +720,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_SCROLL_DOWN)); keys_action_firstkey (KEY_GENERIC_SCROLL_DOWN));
hscr[HELP_OTHER].title = _("OtherCmd\n"); hscr[HELP_OTHER].title = _("OtherCmd\n");
(void)snprintf (hscr[HELP_OTHER].text, HELPTEXTSIZ, snprintf (hscr[HELP_OTHER].text, HELPTEXTSIZ,
_("Switch between status bar help pages.\n" _("Switch between status bar help pages.\n"
"Because the terminal screen is too narrow to display all of the\n" "Because the terminal screen is too narrow to display all of the\n"
"available commands, you need to press '%s' to see the next set of\n" "available commands, you need to press '%s' to see the next set of\n"
@ -731,7 +731,7 @@ help_screen (void)
keys_action_firstkey (KEY_GENERIC_OTHER_CMD)); keys_action_firstkey (KEY_GENERIC_OTHER_CMD));
hscr[HELP_CREDITS].title = _("Calcurse - text-based organizer"); hscr[HELP_CREDITS].title = _("Calcurse - text-based organizer");
(void)snprintf (hscr[HELP_CREDITS].text, HELPTEXTSIZ, snprintf (hscr[HELP_CREDITS].text, HELPTEXTSIZ,
_("\nCopyright (c) 2004-2011 calcurse Development Team\n" _("\nCopyright (c) 2004-2011 calcurse Development Team\n"
"All rights reserved.\n" "All rights reserved.\n"
"\n" "\n"

434
src/io.c
View File

@ -215,10 +215,9 @@ get_export_stream (enum export_type type)
stream = NULL; stream = NULL;
stream_name = (char *) mem_malloc (BUFSIZ); stream_name = (char *) mem_malloc (BUFSIZ);
if ((home = getenv ("HOME")) != NULL) if ((home = getenv ("HOME")) != NULL)
(void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", home, snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", home, file_ext[type]);
file_ext[type]);
else else
(void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", get_tempdir (), snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", get_tempdir (),
file_ext[type]); file_ext[type]);
while (stream == NULL) while (stream == NULL)
@ -234,7 +233,7 @@ get_export_stream (enum export_type type)
if (stream == NULL) if (stream == NULL)
{ {
status_mesg (wrong_name, press_enter); status_mesg (wrong_name, press_enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
mem_free (stream_name); mem_free (stream_name);
@ -295,41 +294,40 @@ foreach_date_dump (const long date_end, struct rpt *rpt, llist_t *exc,
static void static void
ical_export_valarm (FILE *stream) ical_export_valarm (FILE *stream)
{ {
(void)fputs ("BEGIN:VALARM\n", stream); fputs ("BEGIN:VALARM\n", stream);
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)fprintf (stream, "TRIGGER:-P%dS\n", nbar.cntdwn); fprintf (stream, "TRIGGER:-P%dS\n", nbar.cntdwn);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
(void)fputs ("ACTION:DISPLAY\n", stream); fputs ("ACTION:DISPLAY\n", stream);
(void)fputs ("END:VALARM\n", stream); fputs ("END:VALARM\n", stream);
} }
/* Export header. */ /* Export header. */
static void static void
ical_export_header (FILE *stream) ical_export_header (FILE *stream)
{ {
(void)fputs ("BEGIN:VCALENDAR\n", stream); fputs ("BEGIN:VCALENDAR\n", stream);
(void)fprintf (stream, "PRODID:-//calcurse//NONSGML v%s//EN\n", VERSION); fprintf (stream, "PRODID:-//calcurse//NONSGML v%s//EN\n", VERSION);
(void)fputs ("VERSION:2.0\n", stream); fputs ("VERSION:2.0\n", stream);
} }
static void static void
pcal_export_header (FILE *stream) pcal_export_header (FILE *stream)
{ {
(void)fputs ("# calcurse pcal export\n", stream); fputs ("# calcurse pcal export\n", stream);
(void)fputs ("\n# =======\n# options\n# =======\n", stream); fputs ("\n# =======\n# options\n# =======\n", stream);
(void)fprintf (stream, "opt -A -K -l -m -F %s\n", fprintf (stream, "opt -A -K -l -m -F %s\n",
calendar_week_begins_on_monday () ? calendar_week_begins_on_monday () ? "Monday" : "Sunday");
"Monday" : "Sunday"); fputs ("# Display week number (i.e. 1-52) on every Monday\n", stream);
(void)fputs ("# Display week number (i.e. 1-52) on every Monday\n", stream); fprintf (stream, "all monday in all %s %%w\n", _("Week"));
(void)fprintf (stream, "all monday in all %s %%w\n", _("Week")); fputc ('\n', stream);
(void)fputc ('\n', stream);
} }
/* Export footer. */ /* Export footer. */
static void static void
ical_export_footer (FILE *stream) ical_export_footer (FILE *stream)
{ {
(void)fputs ("END:VCALENDAR\n", stream); fputs ("END:VCALENDAR\n", stream);
} }
static void static void
@ -348,36 +346,36 @@ ical_export_recur_events (FILE *stream)
{ {
struct recur_event *rev = LLIST_GET_DATA (i); struct recur_event *rev = LLIST_GET_DATA (i);
date_sec2date_fmt (rev->day, ICALDATEFMT, ical_date); date_sec2date_fmt (rev->day, ICALDATEFMT, ical_date);
(void)fputs ("BEGIN:VEVENT\n", stream); fputs ("BEGIN:VEVENT\n", stream);
(void)fprintf (stream, "DTSTART:%s\n", ical_date); fprintf (stream, "DTSTART:%s\n", ical_date);
(void)fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d", fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
ical_recur_type[rev->rpt->type], rev->rpt->freq); ical_recur_type[rev->rpt->type], rev->rpt->freq);
if (rev->rpt->until != 0) if (rev->rpt->until != 0)
{ {
date_sec2date_fmt (rev->rpt->until, ICALDATEFMT, ical_date); date_sec2date_fmt (rev->rpt->until, ICALDATEFMT, ical_date);
(void)fprintf (stream, ";UNTIL=%s\n", ical_date); fprintf (stream, ";UNTIL=%s\n", ical_date);
} }
else else
(void)fputc ('\n', stream); fputc ('\n', stream);
if (LLIST_FIRST (&rev->exc)) if (LLIST_FIRST (&rev->exc))
{ {
(void)fputs ("EXDATE:", stream); fputs ("EXDATE:", stream);
LLIST_FOREACH (&rev->exc, j) LLIST_FOREACH (&rev->exc, j)
{ {
struct excp *exc = LLIST_GET_DATA (j); struct excp *exc = LLIST_GET_DATA (j);
date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date); date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date);
(void)fprintf (stream, "%s", ical_date); fprintf (stream, "%s", ical_date);
if (LLIST_NEXT (j)) if (LLIST_NEXT (j))
(void)fputc (',', stream); fputc (',', stream);
else else
(void)fputc ('\n', stream); fputc ('\n', stream);
} }
} }
(void)fprintf (stream, "SUMMARY:%s\n", rev->mesg); fprintf (stream, "SUMMARY:%s\n", rev->mesg);
(void)fputs ("END:VEVENT\n", stream); fputs ("END:VEVENT\n", stream);
} }
} }
@ -389,7 +387,7 @@ pcal_dump_event (FILE *stream, long event_date, long event_dur,
char pcal_date[BUFSIZ]; char pcal_date[BUFSIZ];
date_sec2date_fmt (event_date, "%b %d", pcal_date); date_sec2date_fmt (event_date, "%b %d", pcal_date);
(void)fprintf (stream, "%s %s\n", pcal_date, event_mesg); fprintf (stream, "%s %s\n", pcal_date, event_mesg);
} }
/* Format and dump appointment data to a pcal formatted file. */ /* Format and dump appointment data to a pcal formatted file. */
@ -402,8 +400,8 @@ pcal_dump_apoint (FILE *stream, long apoint_date, long apoint_dur,
date_sec2date_fmt (apoint_date, "%b %d", pcal_date); date_sec2date_fmt (apoint_date, "%b %d", pcal_date);
date_sec2date_fmt (apoint_date, "%R", pcal_beg); date_sec2date_fmt (apoint_date, "%R", pcal_beg);
date_sec2date_fmt (apoint_date + apoint_dur, "%R", pcal_end); date_sec2date_fmt (apoint_date + apoint_dur, "%R", pcal_end);
(void)fprintf (stream, "%s ", pcal_date); fprintf (stream, "%s ", pcal_date);
(void)fprintf (stream, "(%s -> %s) %s\n", pcal_beg, pcal_end, apoint_mesg); fprintf (stream, "(%s -> %s) %s\n", pcal_beg, pcal_end, apoint_mesg);
} }
static void static void
@ -412,11 +410,10 @@ pcal_export_recur_events (FILE *stream)
llist_item_t *i; llist_item_t *i;
char pcal_date[BUFSIZ]; char pcal_date[BUFSIZ];
(void)fputs ("\n# =============", stream); fputs ("\n# =============", stream);
(void)fputs ("\n# Recur. Events", stream); fputs ("\n# Recur. Events", stream);
(void)fputs ("\n# =============\n", stream); fputs ("\n# =============\n", stream);
(void)fputs ("# (pcal does not support from..until dates specification\n", fputs ("# (pcal does not support from..until dates specification\n", stream);
stream);
LLIST_FOREACH (&recur_elist, i) LLIST_FOREACH (&recur_elist, i)
{ {
@ -427,23 +424,22 @@ pcal_export_recur_events (FILE *stream)
{ {
case RECUR_DAILY: case RECUR_DAILY:
date_sec2date_fmt (rev->day, "%b %d", pcal_date); date_sec2date_fmt (rev->day, "%b %d", pcal_date);
(void)fprintf (stream, "all day on_or_after %s %s\n", fprintf (stream, "all day on_or_after %s %s\n", pcal_date,
pcal_date, rev->mesg); rev->mesg);
break; break;
case RECUR_WEEKLY: case RECUR_WEEKLY:
date_sec2date_fmt (rev->day, "%a", pcal_date); date_sec2date_fmt (rev->day, "%a", pcal_date);
(void)fprintf (stream, "all %s on_or_after ", pcal_date); fprintf (stream, "all %s on_or_after ", pcal_date);
date_sec2date_fmt (rev->day, "%b %d", pcal_date); date_sec2date_fmt (rev->day, "%b %d", pcal_date);
(void)fprintf (stream, "%s %s\n", pcal_date, rev->mesg); fprintf (stream, "%s %s\n", pcal_date, rev->mesg);
break; break;
case RECUR_MONTHLY: case RECUR_MONTHLY:
date_sec2date_fmt (rev->day, "%d", pcal_date); date_sec2date_fmt (rev->day, "%d", pcal_date);
(void)fprintf (stream, "day on all %s %s\n", pcal_date, fprintf (stream, "day on all %s %s\n", pcal_date, rev->mesg);
rev->mesg);
break; break;
case RECUR_YEARLY: case RECUR_YEARLY:
date_sec2date_fmt (rev->day, "%b %d", pcal_date); date_sec2date_fmt (rev->day, "%b %d", pcal_date);
(void)fprintf (stream, "%s %s\n", pcal_date, rev->mesg); fprintf (stream, "%s %s\n", pcal_date, rev->mesg);
break; break;
default: default:
EXIT (_("incoherent repetition type")); EXIT (_("incoherent repetition type"));
@ -472,10 +468,10 @@ ical_export_events (FILE *stream)
{ {
struct event *ev = LLIST_TS_GET_DATA (i); struct event *ev = LLIST_TS_GET_DATA (i);
date_sec2date_fmt (ev->day, ICALDATEFMT, ical_date); date_sec2date_fmt (ev->day, ICALDATEFMT, ical_date);
(void)fputs ("BEGIN:VEVENT\n", stream); fputs ("BEGIN:VEVENT\n", stream);
(void)fprintf (stream, "DTSTART:%s\n", ical_date); fprintf (stream, "DTSTART:%s\n", ical_date);
(void)fprintf (stream, "SUMMARY:%s\n", ev->mesg); fprintf (stream, "SUMMARY:%s\n", ev->mesg);
(void)fputs ("END:VEVENT\n", stream); fputs ("END:VEVENT\n", stream);
} }
} }
@ -484,13 +480,13 @@ pcal_export_events (FILE *stream)
{ {
llist_item_t *i; llist_item_t *i;
(void)fputs ("\n# ======\n# Events\n# ======\n", stream); fputs ("\n# ======\n# Events\n# ======\n", stream);
LLIST_FOREACH (&eventlist, i) LLIST_FOREACH (&eventlist, i)
{ {
struct event *ev = LLIST_TS_GET_DATA (i); struct event *ev = LLIST_TS_GET_DATA (i);
pcal_dump_event (stream, ev->day, 0, ev->mesg); pcal_dump_event (stream, ev->day, 0, ev->mesg);
} }
(void)fputc ('\n', stream); fputc ('\n', stream);
} }
/* Export recurrent appointments. */ /* Export recurrent appointments. */
@ -507,40 +503,40 @@ ical_export_recur_apoints (FILE *stream)
struct recur_apoint *rapt = LLIST_TS_GET_DATA (i); struct recur_apoint *rapt = LLIST_TS_GET_DATA (i);
date_sec2date_fmt (rapt->start, ICALDATETIMEFMT, ical_datetime); date_sec2date_fmt (rapt->start, ICALDATETIMEFMT, ical_datetime);
(void)fputs ("BEGIN:VEVENT\n", stream); fputs ("BEGIN:VEVENT\n", stream);
(void)fprintf (stream, "DTSTART:%s\n", ical_datetime); fprintf (stream, "DTSTART:%s\n", ical_datetime);
(void)fprintf (stream, "DURATION:PT0H0M%ldS\n", rapt->dur); fprintf (stream, "DURATION:PT0H0M%ldS\n", rapt->dur);
(void)fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d", fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
ical_recur_type[rapt->rpt->type], rapt->rpt->freq); ical_recur_type[rapt->rpt->type], rapt->rpt->freq);
if (rapt->rpt->until != 0) if (rapt->rpt->until != 0)
{ {
date_sec2date_fmt (rapt->rpt->until + HOURINSEC, ICALDATEFMT, date_sec2date_fmt (rapt->rpt->until + HOURINSEC, ICALDATEFMT,
ical_date); ical_date);
(void)fprintf (stream, ";UNTIL=%s\n", ical_date); fprintf (stream, ";UNTIL=%s\n", ical_date);
} }
else else
(void)fputc ('\n', stream); fputc ('\n', stream);
if (LLIST_FIRST (&rapt->exc)) if (LLIST_FIRST (&rapt->exc))
{ {
(void)fputs ("EXDATE:", stream); fputs ("EXDATE:", stream);
LLIST_FOREACH (&rapt->exc, j) LLIST_FOREACH (&rapt->exc, j)
{ {
struct excp *exc = LLIST_GET_DATA (j); struct excp *exc = LLIST_GET_DATA (j);
date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date); date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date);
(void)fprintf (stream, "%s", ical_date); fprintf (stream, "%s", ical_date);
if (LLIST_NEXT (j)) if (LLIST_NEXT (j))
(void)fputc (',', stream); fputc (',', stream);
else else
(void)fputc ('\n', stream); fputc ('\n', stream);
} }
} }
(void)fprintf (stream, "SUMMARY:%s\n", rapt->mesg); fprintf (stream, "SUMMARY:%s\n", rapt->mesg);
if (rapt->state & APOINT_NOTIFY) if (rapt->state & APOINT_NOTIFY)
ical_export_valarm (stream); ical_export_valarm (stream);
(void)fputs ("END:VEVENT\n", stream); fputs ("END:VEVENT\n", stream);
} }
LLIST_TS_UNLOCK (&recur_alist_p); LLIST_TS_UNLOCK (&recur_alist_p);
} }
@ -551,11 +547,10 @@ pcal_export_recur_apoints (FILE *stream)
llist_item_t *i; llist_item_t *i;
char pcal_date[BUFSIZ], pcal_beg[BUFSIZ], pcal_end[BUFSIZ]; char pcal_date[BUFSIZ], pcal_beg[BUFSIZ], pcal_end[BUFSIZ];
(void)fputs ("\n# ==============", stream); fputs ("\n# ==============", stream);
(void)fputs ("\n# Recur. Apoints", stream); fputs ("\n# Recur. Apoints", stream);
(void)fputs ("\n# ==============\n", stream); fputs ("\n# ==============\n", stream);
(void)fputs ("# (pcal does not support from..until dates specification\n", fputs ("# (pcal does not support from..until dates specification\n", stream);
stream);
LLIST_TS_FOREACH (&recur_alist_p, i) LLIST_TS_FOREACH (&recur_alist_p, i)
{ {
@ -569,25 +564,25 @@ pcal_export_recur_apoints (FILE *stream)
{ {
case RECUR_DAILY: case RECUR_DAILY:
date_sec2date_fmt (rapt->start, "%b %d", pcal_date); date_sec2date_fmt (rapt->start, "%b %d", pcal_date);
(void)fprintf (stream, "all day on_or_after %s (%s -> %s) %s\n", fprintf (stream, "all day on_or_after %s (%s -> %s) %s\n",
pcal_date, pcal_beg, pcal_end, rapt->mesg); pcal_date, pcal_beg, pcal_end, rapt->mesg);
break; break;
case RECUR_WEEKLY: case RECUR_WEEKLY:
date_sec2date_fmt (rapt->start, "%a", pcal_date); date_sec2date_fmt (rapt->start, "%a", pcal_date);
(void)fprintf (stream, "all %s on_or_after ", pcal_date); fprintf (stream, "all %s on_or_after ", pcal_date);
date_sec2date_fmt (rapt->start, "%b %d", pcal_date); date_sec2date_fmt (rapt->start, "%b %d", pcal_date);
(void)fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, pcal_beg,
pcal_beg, pcal_end, rapt->mesg); pcal_end, rapt->mesg);
break; break;
case RECUR_MONTHLY: case RECUR_MONTHLY:
date_sec2date_fmt (rapt->start, "%d", pcal_date); date_sec2date_fmt (rapt->start, "%d", pcal_date);
(void)fprintf (stream, "day on all %s (%s -> %s) %s\n", fprintf (stream, "day on all %s (%s -> %s) %s\n", pcal_date,
pcal_date, pcal_beg, pcal_end, rapt->mesg); pcal_beg, pcal_end, rapt->mesg);
break; break;
case RECUR_YEARLY: case RECUR_YEARLY:
date_sec2date_fmt (rapt->start, "%b %d", pcal_date); date_sec2date_fmt (rapt->start, "%b %d", pcal_date);
(void)fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, pcal_beg,
pcal_beg, pcal_end, rapt->mesg); pcal_end, rapt->mesg);
break; break;
default: default:
EXIT (_("incoherent repetition type")); EXIT (_("incoherent repetition type"));
@ -618,13 +613,13 @@ ical_export_apoints (FILE *stream)
{ {
struct apoint *apt = LLIST_TS_GET_DATA (i); struct apoint *apt = LLIST_TS_GET_DATA (i);
date_sec2date_fmt (apt->start, ICALDATETIMEFMT, ical_datetime); date_sec2date_fmt (apt->start, ICALDATETIMEFMT, ical_datetime);
(void)fputs ("BEGIN:VEVENT\n", stream); fputs ("BEGIN:VEVENT\n", stream);
(void)fprintf (stream, "DTSTART:%s\n", ical_datetime); fprintf (stream, "DTSTART:%s\n", ical_datetime);
(void)fprintf (stream, "DURATION:PT0H0M%ldS\n", apt->dur); fprintf (stream, "DURATION:PT0H0M%ldS\n", apt->dur);
(void)fprintf (stream, "SUMMARY:%s\n", apt->mesg); fprintf (stream, "SUMMARY:%s\n", apt->mesg);
if (apt->state & APOINT_NOTIFY) if (apt->state & APOINT_NOTIFY)
ical_export_valarm (stream); ical_export_valarm (stream);
(void)fputs ("END:VEVENT\n", stream); fputs ("END:VEVENT\n", stream);
} }
LLIST_TS_UNLOCK (&alist_p); LLIST_TS_UNLOCK (&alist_p);
} }
@ -634,7 +629,7 @@ pcal_export_apoints (FILE *stream)
{ {
llist_item_t *i; llist_item_t *i;
(void)fputs ("\n# ============\n# Appointments\n# ============\n", stream); fputs ("\n# ============\n# Appointments\n# ============\n", stream);
LLIST_TS_LOCK (&alist_p); LLIST_TS_LOCK (&alist_p);
LLIST_TS_FOREACH (&alist_p, i) LLIST_TS_FOREACH (&alist_p, i)
{ {
@ -642,7 +637,7 @@ pcal_export_apoints (FILE *stream)
pcal_dump_apoint (stream, apt->start, apt->dur, apt->mesg); pcal_dump_apoint (stream, apt->start, apt->dur, apt->mesg);
} }
LLIST_TS_UNLOCK (&alist_p); LLIST_TS_UNLOCK (&alist_p);
(void)fputc ('\n', stream); fputc ('\n', stream);
} }
/* Export todo items. */ /* Export todo items. */
@ -657,10 +652,10 @@ ical_export_todo (FILE *stream)
if (todo->id < 0) /* completed items */ if (todo->id < 0) /* completed items */
continue; continue;
(void)fputs ("BEGIN:VTODO\n", stream); fputs ("BEGIN:VTODO\n", stream);
(void)fprintf (stream, "PRIORITY:%d\n", todo->id); fprintf (stream, "PRIORITY:%d\n", todo->id);
(void)fprintf (stream, "SUMMARY:%s\n", todo->mesg); fprintf (stream, "SUMMARY:%s\n", todo->mesg);
(void)fputs ("END:VTODO\n", stream); fputs ("END:VTODO\n", stream);
} }
} }
@ -669,17 +664,17 @@ pcal_export_todo (FILE *stream)
{ {
llist_item_t *i; llist_item_t *i;
(void)fputs ("#\n# Todos\n#\n", stream); fputs ("#\n# Todos\n#\n", stream);
LLIST_FOREACH (&todolist, i) LLIST_FOREACH (&todolist, i)
{ {
struct todo *todo = LLIST_TS_GET_DATA (i); struct todo *todo = LLIST_TS_GET_DATA (i);
if (todo->id < 0) /* completed items */ if (todo->id < 0) /* completed items */
continue; continue;
(void)fputs ("note all ", stream); fputs ("note all ", stream);
(void)fprintf (stream, "%d. %s\n", todo->id, todo->mesg); fprintf (stream, "%d. %s\n", todo->id, todo->mesg);
} }
(void)fputc ('\n', stream); fputc ('\n', stream);
} }
/* Append a line to a file. */ /* Append a line to a file. */
@ -728,15 +723,15 @@ io_init (char *cfile, char *datadir)
if (datadir != NULL) if (datadir != NULL)
{ {
home = datadir; home = datadir;
(void)snprintf (path_dir, BUFSIZ, "%s", home); snprintf (path_dir, BUFSIZ, "%s", home);
(void)snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH_NAME, home); snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH_NAME, home);
(void)snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH_NAME, home); snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH_NAME, home);
(void)snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR_NAME, home); snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR_NAME, home);
(void)snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH_NAME, home); snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH_NAME, home);
(void)snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH_NAME, home); snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH_NAME, home);
(void)snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH_NAME, home); snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH_NAME, home);
(void)snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH_NAME, home); snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH_NAME, home);
(void)snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH_NAME, home); snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH_NAME, home);
} }
else else
{ {
@ -745,22 +740,22 @@ io_init (char *cfile, char *datadir)
{ {
home = "."; home = ".";
} }
(void)snprintf (path_dir, BUFSIZ, "%s/" DIR_NAME, home); snprintf (path_dir, BUFSIZ, "%s/" DIR_NAME, home);
(void)snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH, home); snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH, home);
(void)snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH, home); snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH, home);
(void)snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH, home); snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH, home);
(void)snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH, home); snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH, home);
(void)snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH, home); snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH, home);
(void)snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH, home); snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH, home);
(void)snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR, home); snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR, home);
if (cfile == NULL) if (cfile == NULL)
{ {
(void)snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH, home); snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH, home);
} }
else else
{ {
(void)snprintf (apts_file, BUFSIZ, "%s", cfile); snprintf (apts_file, BUFSIZ, "%s", cfile);
(void)strncpy (path_apts, apts_file, BUFSIZ); strncpy (path_apts, apts_file, BUFSIZ);
/* check if the file exists, otherwise create it */ /* check if the file exists, otherwise create it */
data_file = fopen (path_apts, "r"); data_file = fopen (path_apts, "r");
if (data_file == NULL) if (data_file == NULL)
@ -860,119 +855,118 @@ io_save_conf (struct conf *conf)
custom_color_theme_name (theme_name); custom_color_theme_name (theme_name);
(void)fprintf (fp, "%s\n", config_txt); fprintf (fp, "%s\n", config_txt);
(void)fputs ("# If this option is set to yes, " fputs ("# If this option is set to yes, "
"automatic save is done when quitting\n", fp); "automatic save is done when quitting\n", fp);
(void)fputs ("auto_save=", fp); fputs ("auto_save=", fp);
(void)fprintf (fp, "%s\n", (conf->auto_save) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->auto_save) ? "yes" : "no");
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"the GC is run automatically when quitting\n", fp); "the GC is run automatically when quitting\n", fp);
(void)fputs ("auto_gc=", fp); fputs ("auto_gc=", fp);
(void)fprintf (fp, "%s\n", (conf->auto_gc) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->auto_gc) ? "yes" : "no");
(void)fputs ("\n# If not null, perform automatic saves every " fputs ("\n# If not null, perform automatic saves every "
"'periodic_save' minutes\n", fp); "'periodic_save' minutes\n", fp);
(void)fputs ("periodic_save=", fp); fputs ("periodic_save=", fp);
(void)fprintf (fp, "%d\n", conf->periodic_save); fprintf (fp, "%d\n", conf->periodic_save);
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"confirmation is required before quitting\n", fp); "confirmation is required before quitting\n", fp);
(void)fputs ("confirm_quit=", fp); fputs ("confirm_quit=", fp);
(void)fprintf (fp, "%s\n", (conf->confirm_quit) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->confirm_quit) ? "yes" : "no");
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"confirmation is required before deleting an event\n", fp); "confirmation is required before deleting an event\n", fp);
(void)fputs ("confirm_delete=", fp); fputs ("confirm_delete=", fp);
(void)fprintf (fp, "%s\n", (conf->confirm_delete) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->confirm_delete) ? "yes" : "no");
(void)fputs ("\n# If this option is set to yes, messages about loaded and " fputs ("\n# If this option is set to yes, messages about loaded and "
"saved data will not be displayed\n", fp); "saved data will not be displayed\n", fp);
(void)fputs ("skip_system_dialogs=", fp); fputs ("skip_system_dialogs=", fp);
(void)fprintf (fp, "%s\n", (conf->skip_system_dialogs) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->skip_system_dialogs) ? "yes" : "no");
(void)fputs ("\n# If this option is set to yes, progress bar appearing " fputs ("\n# If this option is set to yes, progress bar appearing "
"when saving data will not be displayed\n", fp); "when saving data will not be displayed\n", fp);
(void)fputs ("skip_progress_bar=", fp); fputs ("skip_progress_bar=", fp);
(void)fprintf (fp, "%s\n", (conf->skip_progress_bar) ? "yes" : "no"); fprintf (fp, "%s\n", (conf->skip_progress_bar) ? "yes" : "no");
(void)fputs ("\n# Default calendar view (0)monthly (1)weekly:\n", fp); fputs ("\n# Default calendar view (0)monthly (1)weekly:\n", fp);
(void)fputs ("calendar_default_view=", fp); fputs ("calendar_default_view=", fp);
(void)fprintf (fp, "%d\n", calendar_get_view ()); fprintf (fp, "%d\n", calendar_get_view ());
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"monday is the first day of the week, else it is sunday\n", fp); "monday is the first day of the week, else it is sunday\n", fp);
(void)fputs ("week_begins_on_monday=", fp); fputs ("week_begins_on_monday=", fp);
(void)fprintf (fp, "%s\n", fprintf (fp, "%s\n", (calendar_week_begins_on_monday ())? "yes" : "no");
(calendar_week_begins_on_monday ())? "yes" : "no");
(void)fputs ("\n# This is the color theme used for menus :\n", fp); fputs ("\n# This is the color theme used for menus :\n", fp);
(void)fputs ("color-theme=", fp); fputs ("color-theme=", fp);
(void)fprintf (fp, "%s\n", theme_name); fprintf (fp, "%s\n", theme_name);
(void)fputs ("\n# This is the layout of the calendar :\n", fp); fputs ("\n# This is the layout of the calendar :\n", fp);
(void)fputs ("layout=", fp); fputs ("layout=", fp);
(void)fprintf (fp, "%d\n", wins_layout ()); fprintf (fp, "%d\n", wins_layout ());
(void)fputs ("\n# Width ( percentage, 0 being minimun width, fp) " fputs ("\n# Width ( percentage, 0 being minimun width, fp) "
"of the side bar :\n", fp); "of the side bar :\n", fp);
(void)fputs ("side-bar_width=", fp); fputs ("side-bar_width=", fp);
(void)fprintf (fp, "%d\n", wins_sbar_wperc ()); fprintf (fp, "%d\n", wins_sbar_wperc ());
if (ui_mode == UI_CURSES) if (ui_mode == UI_CURSES)
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"notify-bar will be displayed :\n", fp); "notify-bar will be displayed :\n", fp);
(void)fputs ("notify-bar_show=", fp); fputs ("notify-bar_show=", fp);
(void)fprintf (fp, "%s\n", (nbar.show) ? "yes" : "no"); fprintf (fp, "%s\n", (nbar.show) ? "yes" : "no");
(void)fputs ("\n# Format of the date to be displayed inside notify-bar :\n", fp); fputs ("\n# Format of the date to be displayed inside notify-bar :\n", fp);
(void)fputs ("notify-bar_date=", fp); fputs ("notify-bar_date=", fp);
(void)fprintf (fp, "%s\n", nbar.datefmt); fprintf (fp, "%s\n", nbar.datefmt);
(void)fputs ("\n# Format of the time to be displayed inside notify-bar :\n", fp); fputs ("\n# Format of the time to be displayed inside notify-bar :\n", fp);
(void)fputs ("notify-bar_clock=", fp); fputs ("notify-bar_clock=", fp);
(void)fprintf (fp, "%s\n", nbar.timefmt); fprintf (fp, "%s\n", nbar.timefmt);
(void)fputs ("\n# Warn user if he has an appointment within next " fputs ("\n# Warn user if he has an appointment within next "
"'notify-bar_warning' seconds :\n", fp); "'notify-bar_warning' seconds :\n", fp);
(void)fputs ("notify-bar_warning=", fp); fputs ("notify-bar_warning=", fp);
(void)fprintf (fp, "%d\n", nbar.cntdwn); fprintf (fp, "%d\n", nbar.cntdwn);
(void)fputs ("\n# Command used to notify user of " fputs ("\n# Command used to notify user of "
"an upcoming appointment :\n", fp); "an upcoming appointment :\n", fp);
(void)fputs ("notify-bar_command=", fp); fputs ("notify-bar_command=", fp);
(void)fprintf (fp, "%s\n", nbar.cmd); fprintf (fp, "%s\n", nbar.cmd);
(void)fputs ("\n# Notify all appointments instead of flagged ones only\n", fp); fputs ("\n# Notify all appointments instead of flagged ones only\n", fp);
(void)fputs ("notify-all=", fp); fputs ("notify-all=", fp);
(void)fprintf (fp, "%s\n", (nbar.notify_all) ? "yes" : "no"); fprintf (fp, "%s\n", (nbar.notify_all) ? "yes" : "no");
(void)fputs ("\n# Format of the date to be displayed " fputs ("\n# Format of the date to be displayed "
"in non-interactive mode :\n", fp); "in non-interactive mode :\n", fp);
(void)fputs ("output_datefmt=", fp); fputs ("output_datefmt=", fp);
(void)fprintf (fp, "%s\n", conf->output_datefmt); fprintf (fp, "%s\n", conf->output_datefmt);
(void)fputs ("\n# Format to be used when entering a date " fputs ("\n# Format to be used when entering a date "
"(1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd) " "(1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd) "
"(4)yyyy-mm-dd:\n", fp); "(4)yyyy-mm-dd:\n", fp);
(void)fputs ("input_datefmt=", fp); fputs ("input_datefmt=", fp);
(void)fprintf (fp, "%d\n", conf->input_datefmt); fprintf (fp, "%d\n", conf->input_datefmt);
if (ui_mode == UI_CURSES) if (ui_mode == UI_CURSES)
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"calcurse will run in background to get notifications " "calcurse will run in background to get notifications "
"after exiting\n", fp); "after exiting\n", fp);
(void)fputs ("notify-daemon_enable=", fp); fputs ("notify-daemon_enable=", fp);
(void)fprintf (fp, "%s\n", dmon.enable ? "yes" : "no"); fprintf (fp, "%s\n", dmon.enable ? "yes" : "no");
(void)fputs ("\n# If this option is set to yes, " fputs ("\n# If this option is set to yes, "
"activity will be logged when running in background\n", fp); "activity will be logged when running in background\n", fp);
(void)fputs ("notify-daemon_log=", fp); fputs ("notify-daemon_log=", fp);
(void)fprintf (fp, "%s\n", dmon.log ? "yes" : "no"); fprintf (fp, "%s\n", dmon.log ? "yes" : "no");
file_close (fp, __FILE_POS__); file_close (fp, __FILE_POS__);
@ -1093,7 +1087,7 @@ io_save_cal (struct conf *conf, enum save_display display)
&& display != IO_SAVE_DISPLAY_MARK) && display != IO_SAVE_DISPLAY_MARK)
{ {
status_mesg (save_success, enter); status_mesg (save_success, enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
pthread_mutex_unlock (&io_save_mutex); pthread_mutex_unlock (&io_save_mutex);
@ -1129,7 +1123,7 @@ io_load_app (void)
c = getc (data_file); c = getc (data_file);
if (c == EOF) if (c == EOF)
break; break;
(void)ungetc (c, data_file); ungetc (c, data_file);
/* Read the date first: it is common to both events /* Read the date first: it is common to both events
* and appointments. * and appointments.
@ -1153,7 +1147,7 @@ io_load_app (void)
{ {
EXIT (_("no event nor appointment found")); EXIT (_("no event nor appointment found"));
} }
(void)ungetc (c, data_file); ungetc (c, data_file);
/* Read the remaining informations. */ /* Read the remaining informations. */
if (is_appointment) if (is_appointment)
@ -1178,38 +1172,38 @@ io_load_app (void)
if (c == '{') if (c == '{')
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
is_recursive = 1; is_recursive = 1;
fscanf (data_file, "{ %d%c ", &freq, &type); fscanf (data_file, "{ %d%c ", &freq, &type);
c = getc (data_file); c = getc (data_file);
if (c == '}') if (c == '}')
{ /* endless recurrent item */ { /* endless recurrent item */
(void)ungetc (c, data_file); ungetc (c, data_file);
fscanf (data_file, "} "); fscanf (data_file, "} ");
until.tm_year = 0; until.tm_year = 0;
} }
else if (c == '-') else if (c == '-')
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
fscanf (data_file, " -> %u / %u / %u ", fscanf (data_file, " -> %u / %u / %u ",
&until.tm_mon, &until.tm_mday, &until.tm_year); &until.tm_mon, &until.tm_mday, &until.tm_year);
c = getc (data_file); c = getc (data_file);
if (c == '!') if (c == '!')
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
recur_exc_scan (&exc, data_file); recur_exc_scan (&exc, data_file);
c = getc (data_file); c = getc (data_file);
} }
else else
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
fscanf (data_file, "} "); fscanf (data_file, "} ");
} }
} }
else if (c == '!') else if (c == '!')
{ // endless item with exceptions { // endless item with exceptions
(void)ungetc (c, data_file); ungetc (c, data_file);
recur_exc_scan (&exc, data_file); recur_exc_scan (&exc, data_file);
c = getc (data_file); c = getc (data_file);
until.tm_year = 0; until.tm_year = 0;
@ -1221,7 +1215,7 @@ io_load_app (void)
} }
} }
else else
(void)ungetc (c, data_file); ungetc (c, data_file);
/* Check if a note is attached to the item. */ /* Check if a note is attached to the item. */
c = getc (data_file); c = getc (data_file);
@ -1233,7 +1227,7 @@ io_load_app (void)
else else
{ {
notep = NULL; notep = NULL;
(void)ungetc (c, data_file); ungetc (c, data_file);
} }
/* /*
@ -1245,13 +1239,13 @@ io_load_app (void)
c = getc (data_file); c = getc (data_file);
if (c == '!') if (c == '!')
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
fscanf (data_file, " ! "); fscanf (data_file, " ! ");
state |= APOINT_NOTIFY; state |= APOINT_NOTIFY;
} }
else else
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
fscanf (data_file, " | "); fscanf (data_file, " | ");
state = 0L; state = 0L;
} }
@ -1302,7 +1296,7 @@ io_load_todo (void)
if (data_file == NULL) if (data_file == NULL)
{ {
status_mesg (mesg_line1, mesg_line2); status_mesg (mesg_line1, mesg_line2);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
for (;;) for (;;)
{ {
@ -1318,7 +1312,7 @@ io_load_todo (void)
else else
{ {
id = 9; id = 9;
(void)ungetc (c, data_file); ungetc (c, data_file);
} }
/* Now read the attached note, if any. */ /* Now read the attached note, if any. */
c = getc (data_file); c = getc (data_file);
@ -1327,7 +1321,7 @@ io_load_todo (void)
else else
note[0] = '\0'; note[0] = '\0';
/* Then read todo description. */ /* Then read todo description. */
(void)fgets (buf, sizeof buf, data_file); fgets (buf, sizeof buf, data_file);
newline = strchr (buf, '\n'); newline = strchr (buf, '\n');
if (newline) if (newline)
*newline = '\0'; *newline = '\0';
@ -1521,8 +1515,8 @@ io_check_dir (char *dir, int *missing)
{ {
if (errno != EEXIST) if (errno != EEXIST)
{ {
(void)fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), dir,
dir, strerror (errno)); strerror (errno));
exit_calcurse (EXIT_FAILURE); exit_calcurse (EXIT_FAILURE);
} }
} }
@ -1544,7 +1538,7 @@ io_file_exist (char *file)
if ((fd = fopen (file, "r")) == NULL) if ((fd = fopen (file, "r")) == NULL)
return 0; return 0;
(void)fclose (fd); fclose (fd);
return 1; return 1;
} }
@ -1561,8 +1555,8 @@ io_check_file (char *file, int *missing)
(*missing)++; (*missing)++;
if ((fd = fopen (file, "w")) == NULL) if ((fd = fopen (file, "w")) == NULL)
{ {
(void)fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), file,
file, strerror (errno)); strerror (errno));
exit_calcurse (EXIT_FAILURE); exit_calcurse (EXIT_FAILURE);
} }
file_close (fd, __FILE_POS__); file_close (fd, __FILE_POS__);
@ -1615,12 +1609,12 @@ io_startup_screen (unsigned skip_dialogs, int no_data_file)
if (no_data_file != 0) if (no_data_file != 0)
{ {
status_mesg (welcome_mesg, enter); status_mesg (welcome_mesg, enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
else if (!skip_dialogs) else if (!skip_dialogs)
{ {
status_mesg (data_mesg, enter); status_mesg (data_mesg, enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
@ -1676,7 +1670,7 @@ io_export_data (enum export_type type, struct conf *conf)
if (!conf->skip_system_dialogs && ui_mode == UI_CURSES) if (!conf->skip_system_dialogs && ui_mode == UI_CURSES)
{ {
status_mesg (success, enter); status_mesg (success, enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
@ -1725,7 +1719,7 @@ ical_log_init (FILE *log, float version)
"+-------------------------------------------------------------------+\n\n"; "+-------------------------------------------------------------------+\n\n";
if (log) if (log)
(void)fprintf (log, header, version); fprintf (log, header, version);
} }
/* /*
@ -1741,7 +1735,7 @@ ical_log (FILE *log, ical_types_e type, unsigned lineno, char *msg)
RETURN_IF (type < 0 || type >= ICAL_TYPES, _("unknown ical type")); RETURN_IF (type < 0 || type >= ICAL_TYPES, _("unknown ical type"));
if (log) if (log)
(void)fprintf (log, "%s [%d]: %s\n", typestr[type], lineno, msg); fprintf (log, "%s [%d]: %s\n", typestr[type], lineno, msg);
} }
static void static void
@ -2287,7 +2281,7 @@ ical_read_exdate (llist_t *exc, FILE *log, char *exstr, unsigned *noskipped,
char buf[BUFSIZ]; char buf[BUFSIZ];
const int buflen = q - p; const int buflen = q - p;
(void)strncpy (buf, p, buflen); strncpy (buf, p, buflen);
buf[buflen] = '\0'; buf[buflen] = '\0';
date = ical_datetime2long (buf, NULL); date = ical_datetime2long (buf, NULL);
ical_add_exc (exc, date); ical_add_exc (exc, date);
@ -2332,11 +2326,11 @@ ical_read_note (char *line, unsigned *noskipped, ical_vevent_e item_type,
else else
{ {
sha1_digest (notestr, sha1); sha1_digest (notestr, sha1);
(void)snprintf (fullnotename, BUFSIZ, "%s%s", path_notes, sha1); snprintf (fullnotename, BUFSIZ, "%s%s", path_notes, sha1);
fdo = fopen (fullnotename, "w"); fdo = fopen (fullnotename, "w");
EXIT_IF (fdo == NULL, _("Warning: could not open %s, Aborting..."), EXIT_IF (fdo == NULL, _("Warning: could not open %s, Aborting..."),
fullnotename); fullnotename);
(void)fprintf (fdo, "%s", notestr); fprintf (fdo, "%s", notestr);
file_close (fdo, __FILE_POS__); file_close (fdo, __FILE_POS__);
mem_free (notestr); mem_free (notestr);
return sha1; return sha1;
@ -2683,7 +2677,7 @@ get_import_stream (enum export_type type)
if (stream == NULL) if (stream == NULL)
{ {
status_mesg (wrong_file, press_enter); status_mesg (wrong_file, press_enter);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
} }
mem_free (stream_name); mem_free (stream_name);
@ -2778,12 +2772,12 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name)
{ {
char read[BUFSIZ], stat[BUFSIZ]; char read[BUFSIZ], stat[BUFSIZ];
(void)snprintf (read, BUFSIZ, proc_report, stats.lines); snprintf (read, BUFSIZ, proc_report, stats.lines);
(void)snprintf (stat, BUFSIZ, "%s / %s / %s / %s (%s)", stats_str[0], snprintf (stat, BUFSIZ, "%s / %s / %s / %s (%s)", stats_str[0],
stats_str[1], stats_str[2], stats_str[3], stats_str[1], stats_str[2], stats_str[3],
_("Press [ENTER] to continue")); _("Press [ENTER] to continue"));
status_mesg (read, stat); status_mesg (read, stat);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
else if (ui_mode == UI_CMDLINE) else if (ui_mode == UI_CMDLINE)
{ {
@ -2819,7 +2813,7 @@ io_log_init (void)
log = mem_malloc (sizeof (struct io_file)); log = mem_malloc (sizeof (struct io_file));
RETVAL_IF (log == NULL, 0, RETVAL_IF (log == NULL, 0,
_("Warning: could not open temporary log file, Aborting...")); _("Warning: could not open temporary log file, Aborting..."));
(void)snprintf (log->name, sizeof (log->name), "%s%s", logprefix, logname); snprintf (log->name, sizeof (log->name), "%s%s", logprefix, logname);
mem_free (logname); mem_free (logname);
log->fd = fopen (log->name, "w"); log->fd = fopen (log->name, "w");
if (log->fd == NULL) if (log->fd == NULL)
@ -2836,7 +2830,7 @@ void
io_log_print (struct io_file *log, int line, char *msg) io_log_print (struct io_file *log, int line, char *msg)
{ {
if (log && log->fd) if (log && log->fd)
(void)fprintf (log->fd, "line %d: %s\n", line, msg); fprintf (log->fd, "line %d: %s\n", line, msg);
} }
void void
@ -2854,8 +2848,8 @@ io_log_display (struct io_file *log, char *msg, char *pager)
{ {
char cmd[BUFSIZ]; char cmd[BUFSIZ];
(void)snprintf (cmd, BUFSIZ, "%s %s", pager, log->name); snprintf (cmd, BUFSIZ, "%s %s", pager, log->name);
(void)system (cmd); system (cmd);
} }
} }
else else
@ -2900,7 +2894,7 @@ io_psave_thread (void *arg)
for (;;) for (;;)
{ {
(void)sleep (delay * MININSEC); sleep (delay * MININSEC);
io_save_cal (config, IO_SAVE_DISPLAY_MARK); io_save_cal (config, IO_SAVE_DISPLAY_MARK);
} }
} }
@ -2952,7 +2946,7 @@ io_set_lock (void)
if (lock != NULL) if (lock != NULL)
{ {
(void)fprintf (stderr, fprintf (stderr,
_("\nWARNING: it seems that another calcurse instance is " _("\nWARNING: it seems that another calcurse instance is "
"already running.\n" "already running.\n"
"If this is not the case, please remove the following " "If this is not the case, please remove the following "
@ -3010,7 +3004,7 @@ io_get_pid (char *file)
if (fscanf (fp, "%u", &pid) != 1) if (fscanf (fp, "%u", &pid) != 1)
return 0; return 0;
(void)fclose (fp); fclose (fp);
return pid; return pid;
} }

View File

@ -125,7 +125,7 @@ dump_intro (FILE *fd)
"# A description of what each ACTION keyword is used for is available\n" "# A description of what each ACTION keyword is used for is available\n"
"# from calcurse online configuration menu.\n"); "# from calcurse online configuration menu.\n");
(void)fprintf (fd, "%s\n", intro); fprintf (fd, "%s\n", intro);
} }
void void
@ -171,7 +171,7 @@ keys_dump_defaults (char *file)
dump_intro (fd); dump_intro (fd);
for (i = 0; i < NBKEYS; i++) for (i = 0; i < NBKEYS; i++)
(void)fprintf (fd, "%s %s\n", keydef[i].label, keydef[i].binding); fprintf (fd, "%s %s\n", keydef[i].label, keydef[i].binding);
file_close (fd, __FILE_POS__); file_close (fd, __FILE_POS__);
} }
@ -274,7 +274,7 @@ del_key_str (enum key action, int key)
if (action < 0 || action > NBKEYS) if (action < 0 || action > NBKEYS)
return; return;
(void)strncpy (oldstr, keys_int2str (key), BUFSIZ); strncpy (oldstr, keys_int2str (key), BUFSIZ);
for (i = &keys[action]; *i; i = &(*i)->next) for (i = &keys[action]; *i; i = &(*i)->next)
{ {
if (!strcmp ((*i)->str, oldstr)) if (!strcmp ((*i)->str, oldstr))
@ -423,8 +423,8 @@ keys_action_allkeys (enum key action)
for (i = keys[action]; i; i = i->next) for (i = keys[action]; i; i = i->next)
{ {
const int MAXLEN = sizeof (keystr) - 1 - strlen (keystr); const int MAXLEN = sizeof (keystr) - 1 - strlen (keystr);
(void)strncat (keystr, i->str, MAXLEN - 1); strncat (keystr, i->str, MAXLEN - 1);
(void)strncat (keystr, CHAR_SPACE, 1); strncat (keystr, CHAR_SPACE, 1);
} }
return keystr; return keystr;
@ -444,18 +444,18 @@ keys_format_label (char *key, int keylen)
bzero (fmtkey, sizeof (fmtkey)); bzero (fmtkey, sizeof (fmtkey));
if (len == 0) if (len == 0)
(void)strncpy (fmtkey, "?", sizeof (fmtkey)); strncpy (fmtkey, "?", sizeof (fmtkey));
else if (len <= keylen) else if (len <= keylen)
{ {
for (i = 0; i < keylen - len; i++) for (i = 0; i < keylen - len; i++)
fmtkey[i] = ' '; fmtkey[i] = ' ';
(void)strncat (fmtkey, key, keylen); strncat (fmtkey, key, keylen);
} }
else else
{ {
for (i = 0; i < keylen - 1; i++) for (i = 0; i < keylen - 1; i++)
fmtkey[i] = key[i]; fmtkey[i] = key[i];
(void)strncat (fmtkey, dot, strlen (dot)); strncat (fmtkey, dot, strlen (dot));
} }
return fmtkey; return fmtkey;
} }
@ -479,14 +479,13 @@ keys_display_bindings_bar (WINDOW *win, struct binding **binding, int first_key,
const int KEY_POS = j * cmdlen; const int KEY_POS = j * cmdlen;
const int LABEL_POS = j * cmdlen + KEYS_KEYLEN + 1; const int LABEL_POS = j * cmdlen + KEYS_KEYLEN + 1;
(void)strncpy (key, keys_action_firstkey (binding[i]->action), strncpy (key, keys_action_firstkey (binding[i]->action), KEYS_KEYLEN);
KEYS_KEYLEN);
fmtkey = keys_format_label (key, KEYS_KEYLEN); fmtkey = keys_format_label (key, KEYS_KEYLEN);
custom_apply_attr (win, ATTR_HIGHEST); custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, 0, KEY_POS, fmtkey); mvwprintw (win, 0, KEY_POS, fmtkey);
if (i + 1 != last_key) if (i + 1 != last_key)
{ {
(void)strncpy (key, keys_action_firstkey (binding[i + 1]->action), strncpy (key, keys_action_firstkey (binding[i + 1]->action),
KEYS_KEYLEN); KEYS_KEYLEN);
key[KEYS_KEYLEN] = 0; key[KEYS_KEYLEN] = 0;
fmtkey = keys_format_label (key, KEYS_KEYLEN); fmtkey = keys_format_label (key, KEYS_KEYLEN);
@ -601,7 +600,7 @@ keys_popup_info (enum key key)
#define WINCOL (col - 4) #define WINCOL (col - 4)
infowin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2, infowin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2,
keydef[key].label, info[key], 1); keydef[key].label, info[key], 1);
(void)keys_getch (infowin, NULL); keys_getch (infowin, NULL);
delwin (infowin); delwin (infowin);
#undef WINROW #undef WINROW
#undef WINCOL #undef WINCOL
@ -615,7 +614,7 @@ keys_save_bindings (FILE *fd)
EXIT_IF (fd == NULL, _("FATAL ERROR: null file pointer.")); EXIT_IF (fd == NULL, _("FATAL ERROR: null file pointer."));
dump_intro (fd); dump_intro (fd);
for (i = 0; i < NBKEYS; i++) for (i = 0; i < NBKEYS; i++)
(void)fprintf (fd, "%s %s\n", keydef[i].label, keys_action_allkeys (i)); fprintf (fd, "%s %s\n", keydef[i].label, keys_action_allkeys (i));
} }
int int
@ -642,7 +641,7 @@ keys_fill_missing (void)
{ {
char *p, tmpbuf[BUFSIZ]; char *p, tmpbuf[BUFSIZ];
(void)strncpy (tmpbuf, keydef[i].binding, BUFSIZ); strncpy (tmpbuf, keydef[i].binding, BUFSIZ);
p = tmpbuf; p = tmpbuf;
for (;;) for (;;)
{ {

View File

@ -94,7 +94,7 @@ view_note (char *note, char *pager)
if (note == NULL) if (note == NULL)
return; return;
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, note); snprintf (fullname, BUFSIZ, "%s%s", path_notes, note);
wins_launch_external (fullname, pager); wins_launch_external (fullname, pager);
} }

View File

@ -126,18 +126,17 @@ notify_init_vars (void)
pthread_mutex_init (&nbar.mutex, NULL); pthread_mutex_init (&nbar.mutex, NULL);
nbar.show = 1; nbar.show = 1;
nbar.cntdwn = 300; nbar.cntdwn = 300;
(void)strncpy (nbar.datefmt, date_format, strlen (date_format) + 1); strncpy (nbar.datefmt, date_format, strlen (date_format) + 1);
(void)strncpy (nbar.timefmt, time_format, strlen (time_format) + 1); strncpy (nbar.timefmt, time_format, strlen (time_format) + 1);
(void)strncpy (nbar.cmd, cmd, strlen (cmd) + 1); strncpy (nbar.cmd, cmd, strlen (cmd) + 1);
if ((nbar.shell = getenv ("SHELL")) == NULL) if ((nbar.shell = getenv ("SHELL")) == NULL)
nbar.shell = "/bin/sh"; nbar.shell = "/bin/sh";
nbar.notify_all = 0; nbar.notify_all = 0;
(void)pthread_attr_init (&detached_thread_attr); pthread_attr_init (&detached_thread_attr);
(void)pthread_attr_setdetachstate (&detached_thread_attr, pthread_attr_setdetachstate (&detached_thread_attr, PTHREAD_CREATE_DETACHED);
PTHREAD_CREATE_DETACHED);
} }
/* Extract the appointment file name from the complete file path. */ /* Extract the appointment file name from the complete file path. */
@ -272,7 +271,7 @@ notify_update_bar (void)
too_long = 1; too_long = 1;
shrink_len = txt_max_len > 3 ? txt_max_len - 3 : 1; shrink_len = txt_max_len > 3 ? txt_max_len - 3 : 1;
(void)strncpy (buf, notify_app.txt, shrink_len); strncpy (buf, notify_app.txt, shrink_len);
buf[shrink_len] = '\0'; buf[shrink_len] = '\0';
} }
time_left = notify_time_left (); time_left = notify_time_left ();
@ -303,7 +302,7 @@ notify_update_bar (void)
wattroff (notify.win, A_BLINK); wattroff (notify.win, A_BLINK);
if (blinking) if (blinking)
(void)notify_launch_cmd (); notify_launch_cmd ();
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
} }
else else
@ -379,8 +378,8 @@ notify_get_next (struct notify_app *a)
a->got_app = 0; a->got_app = 0;
a->state = 0; a->state = 0;
a->txt = (char *)0; a->txt = (char *)0;
(void)recur_apoint_check_next (a, current_time, get_today ()); recur_apoint_check_next (a, current_time, get_today ());
(void)apoint_check_next (a, current_time); apoint_check_next (a, current_time);
return 1; return 1;
} }
@ -605,7 +604,7 @@ print_option (WINDOW *win, unsigned x, unsigned y, char *name,
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
(void)strncpy (buf, valstr, maxlen - 1); strncpy (buf, valstr, maxlen - 1);
buf[maxlen - 1] = '\0'; buf[maxlen - 1] = '\0';
mvwprintw (win, y, x_opt, "%s...", buf); mvwprintw (win, y, x_opt, "%s...", buf);
} }
@ -665,10 +664,10 @@ print_config_options (WINDOW *optwin)
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
/* String value options */ /* String value options */
(void)strncpy (opt[DATE].valstr, nbar.datefmt, BUFSIZ); strncpy (opt[DATE].valstr, nbar.datefmt, BUFSIZ);
(void)strncpy (opt[CLOCK].valstr, nbar.timefmt, BUFSIZ); strncpy (opt[CLOCK].valstr, nbar.timefmt, BUFSIZ);
(void)snprintf (opt[WARN].valstr, BUFSIZ, "%d", nbar.cntdwn); snprintf (opt[WARN].valstr, BUFSIZ, "%d", nbar.cntdwn);
(void)strncpy (opt[CMD].valstr, nbar.cmd, BUFSIZ); strncpy (opt[CMD].valstr, nbar.cmd, BUFSIZ);
/* Boolean options */ /* Boolean options */
opt[SHOW].valnum = nbar.show; opt[SHOW].valnum = nbar.show;
@ -727,7 +726,7 @@ notify_config_bar (void)
clear (); clear ();
custom_set_swsiz (&cwin); custom_set_swsiz (&cwin);
(void)strncpy (cwin.label, _("notification options"), BUFSIZ); strncpy (cwin.label, _("notification options"), BUFSIZ);
wins_scrollwin_init (&cwin); wins_scrollwin_init (&cwin);
wins_show (cwin.win.p, cwin.label); wins_show (cwin.win.p, cwin.label);
status_mesg (number_str, keys); status_mesg (number_str, keys);
@ -761,24 +760,24 @@ notify_config_bar (void)
case '2': case '2':
status_mesg (date_str, ""); status_mesg (date_str, "");
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar.datefmt, strlen (nbar.datefmt) + 1); strncpy (buf, nbar.datefmt, strlen (nbar.datefmt) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar.datefmt, buf, strlen (buf) + 1); strncpy (nbar.datefmt, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
} }
break; break;
case '3': case '3':
status_mesg (time_str, ""); status_mesg (time_str, "");
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar.timefmt, strlen (nbar.timefmt) + 1); strncpy (buf, nbar.timefmt, strlen (nbar.timefmt) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar.timefmt, buf, strlen (buf) + 1); strncpy (nbar.timefmt, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
} }
break; break;
@ -798,12 +797,12 @@ notify_config_bar (void)
case '5': case '5':
status_mesg (cmd_str, ""); status_mesg (cmd_str, "");
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar.cmd, strlen (nbar.cmd) + 1); strncpy (buf, nbar.cmd, strlen (nbar.cmd) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar.mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar.cmd, buf, strlen (buf) + 1); strncpy (nbar.cmd, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar.mutex); pthread_mutex_unlock (&nbar.mutex);
} }
break; break;

View File

@ -360,7 +360,7 @@ recur_write_exc (llist_t *lexc, FILE *f)
st_mon = lt->tm_mon + 1; st_mon = lt->tm_mon + 1;
st_day = lt->tm_mday; st_day = lt->tm_mday;
st_year = lt->tm_year + 1900; st_year = lt->tm_year + 1900;
(void)fprintf (f, " !%02u/%02u/%04u", st_mon, st_day, st_year); fprintf (f, " !%02u/%02u/%04u", st_mon, st_day, st_year);
} }
} }
@ -374,7 +374,7 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
time_t tstart, tend, tuntil; time_t tstart, tend, tuntil;
/* Read the appointment description */ /* Read the appointment description */
(void)fgets (buf, sizeof buf, f); fgets (buf, sizeof buf, f);
nl = strchr (buf, '\n'); nl = strchr (buf, '\n');
if (nl) if (nl)
{ {
@ -419,7 +419,7 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
time_t tstart, tuntil; time_t tstart, tuntil;
/* Read the event description */ /* Read the event description */
(void)fgets (buf, sizeof buf, f); fgets (buf, sizeof buf, f);
nl = strchr (buf, '\n'); nl = strchr (buf, '\n');
if (nl) if (nl)
{ {
@ -458,37 +458,35 @@ recur_apoint_write (struct recur_apoint *o, FILE *f)
t = o->start; t = o->start;
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, "%02u/%02u/%04u @ %02u:%02u", fprintf (f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
lt->tm_hour, lt->tm_min);
t = o->start + o->dur; t = o->start + o->dur;
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u", fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, 1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
lt->tm_hour, lt->tm_min);
t = o->rpt->until; t = o->rpt->until;
if (t == 0) if (t == 0)
{ /* We have an endless recurrent appointment. */ { /* We have an endless recurrent appointment. */
(void)fprintf (f, " {%d%c", o->rpt->freq, recur_def2char (o->rpt->type)); fprintf (f, " {%d%c", o->rpt->freq, recur_def2char (o->rpt->type));
} }
else else
{ {
lt = localtime (&t); lt = localtime (&t);
(void)fprintf (f, " {%d%c -> %02u/%02u/%04u", fprintf (f, " {%d%c -> %02u/%02u/%04u", o->rpt->freq,
o->rpt->freq, recur_def2char (o->rpt->type), recur_def2char (o->rpt->type), lt->tm_mon + 1, lt->tm_mday,
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year); 1900 + lt->tm_year);
} }
recur_write_exc (&o->exc, f); recur_write_exc (&o->exc, f);
(void)fputs ("} ", f); fputs ("} ", f);
if (o->note != NULL) if (o->note != NULL)
(void)fprintf (f, ">%s ", o->note); fprintf (f, ">%s ", o->note);
if (o->state & APOINT_NOTIFY) if (o->state & APOINT_NOTIFY)
(void)fputc ('!', f); fputc ('!', f);
else else
(void)fputc ('|', f); fputc ('|', f);
(void)fprintf (f, "%s\n", o->mesg); fprintf (f, "%s\n", o->mesg);
} }
/* Writting of a recursive event into file. */ /* Writting of a recursive event into file. */
@ -508,9 +506,8 @@ recur_event_write (struct recur_event *o, FILE *f)
t = o->rpt->until; t = o->rpt->until;
if (t == 0) if (t == 0)
{ /* We have an endless recurrent event. */ { /* We have an endless recurrent event. */
(void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c", fprintf (f, "%02u/%02u/%04u [%d] {%d%c", st_mon, st_day, st_year, o->id,
st_mon, st_day, st_year, o->id, o->rpt->freq, o->rpt->freq, recur_def2char (o->rpt->type));
recur_def2char (o->rpt->type));
} }
else else
{ {
@ -518,16 +515,15 @@ recur_event_write (struct recur_event *o, FILE *f)
end_mon = lt->tm_mon + 1; end_mon = lt->tm_mon + 1;
end_day = lt->tm_mday; end_day = lt->tm_mday;
end_year = lt->tm_year + 1900; end_year = lt->tm_year + 1900;
(void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u", fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u", st_mon,
st_mon, st_day, st_year, o->id, st_day, st_year, o->id, o->rpt->freq,
o->rpt->freq, recur_def2char (o->rpt->type), recur_def2char (o->rpt->type), end_mon, end_day, end_year);
end_mon, end_day, end_year);
} }
recur_write_exc (&o->exc, f); recur_write_exc (&o->exc, f);
(void)fputs ("} ", f); fputs ("} ", f);
if (o->note != NULL) if (o->note != NULL)
(void)fprintf (f, ">%s ", o->note); fprintf (f, ">%s ", o->note);
(void)fprintf (f, "%s\n", o->mesg); fprintf (f, "%s\n", o->mesg);
} }
/* Write recursive items to file. */ /* Write recursive items to file. */
@ -899,7 +895,7 @@ recur_repeat_item (struct conf *conf)
if (p->type != APPT && p->type != EVNT) if (p->type != APPT && p->type != EVNT)
{ {
status_mesg (wrong_type_1, wrong_type_2); status_mesg (wrong_type_1, wrong_type_2);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
return; return;
} }
@ -928,7 +924,7 @@ recur_repeat_item (struct conf *conf)
if (freq == 0) if (freq == 0)
{ {
status_mesg (mesg_wrong_freq, wrong_type_2); status_mesg (mesg_wrong_freq, wrong_type_2);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
} }
user_input[0] = '\0'; user_input[0] = '\0';
} }
@ -938,7 +934,7 @@ recur_repeat_item (struct conf *conf)
while (!date_entered) while (!date_entered)
{ {
(void)snprintf (outstr, BUFSIZ, mesg_until_1, snprintf (outstr, BUFSIZ, mesg_until_1,
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
status_mesg (_(outstr), ""); status_mesg (_(outstr), "");
if (getstring (win[STA].p, user_input, BUFSIZ, 0, 1) == GETSTRING_VALID) if (getstring (win[STA].p, user_input, BUFSIZ, 0, 1) == GETSTRING_VALID)
@ -962,7 +958,7 @@ recur_repeat_item (struct conf *conf)
if (until < p->start) if (until < p->start)
{ {
status_mesg (mesg_older, wrong_type_2); status_mesg (mesg_older, wrong_type_2);
(void)wgetch (win[STA].p); wgetch (win[STA].p);
date_entered = 0; date_entered = 0;
} }
else else
@ -972,10 +968,10 @@ recur_repeat_item (struct conf *conf)
} }
else else
{ {
(void)snprintf (outstr, BUFSIZ, mesg_wrong_2, snprintf (outstr, BUFSIZ, mesg_wrong_2,
DATEFMT_DESC (conf->input_datefmt)); DATEFMT_DESC (conf->input_datefmt));
status_mesg (mesg_wrong_1, _(outstr)); status_mesg (mesg_wrong_1, _(outstr));
(void)wgetch (win[STA].p); wgetch (win[STA].p);
date_entered = 0; date_entered = 0;
} }
} }
@ -987,8 +983,8 @@ recur_repeat_item (struct conf *conf)
date = calendar_get_slctd_day_sec (); date = calendar_get_slctd_day_sec ();
if (p->type == EVNT) if (p->type == EVNT)
{ {
(void)recur_event_new (p->mesg, p->note, p->start, p->evnt_id, recur_event_new (p->mesg, p->note, p->start, p->evnt_id, type, freq,
type, freq, until, NULL); until, NULL);
} }
else if (p->type == APPT) else if (p->type == APPT)
{ {
@ -1018,7 +1014,7 @@ recur_exc_scan (llist_t *lexc, FILE *data_file)
LLIST_INIT (lexc); LLIST_INIT (lexc);
while ((c = getc (data_file)) == '!') while ((c = getc (data_file)) == '!')
{ {
(void)ungetc (c, data_file); ungetc (c, data_file);
if (fscanf (data_file, "!%u / %u / %u ", if (fscanf (data_file, "!%u / %u / %u ",
&day.tm_mon, &day.tm_mday, &day.tm_year) != 3) &day.tm_mon, &day.tm_mday, &day.tm_year) != 3)
{ {
@ -1137,12 +1133,11 @@ recur_event_paste_item (void)
exc->st += time_shift; exc->st += time_shift;
} }
(void)recur_event_new (bkp_cut_recur_event.mesg, bkp_cut_recur_event.note, recur_event_new (bkp_cut_recur_event.mesg, bkp_cut_recur_event.note,
bkp_cut_recur_event.day, bkp_cut_recur_event.id, bkp_cut_recur_event.day, bkp_cut_recur_event.id,
bkp_cut_recur_event.rpt->type, bkp_cut_recur_event.rpt->type,
bkp_cut_recur_event.rpt->freq, bkp_cut_recur_event.rpt->freq,
bkp_cut_recur_event.rpt->until, bkp_cut_recur_event.rpt->until, &bkp_cut_recur_event.exc);
&bkp_cut_recur_event.exc);
recur_event_free_bkp (); recur_event_free_bkp ();
} }
@ -1166,10 +1161,9 @@ recur_apoint_paste_item (void)
exc->st += time_shift; exc->st += time_shift;
} }
(void)recur_apoint_new (bkp_cut_recur_apoint.mesg, bkp_cut_recur_apoint.note, recur_apoint_new (bkp_cut_recur_apoint.mesg, bkp_cut_recur_apoint.note,
bkp_cut_recur_apoint.start, bkp_cut_recur_apoint.dur, bkp_cut_recur_apoint.start, bkp_cut_recur_apoint.dur,
bkp_cut_recur_apoint.state, bkp_cut_recur_apoint.state, bkp_cut_recur_apoint.rpt->type,
bkp_cut_recur_apoint.rpt->type,
bkp_cut_recur_apoint.rpt->freq, bkp_cut_recur_apoint.rpt->freq,
bkp_cut_recur_apoint.rpt->until, bkp_cut_recur_apoint.rpt->until,
&bkp_cut_recur_apoint.exc); &bkp_cut_recur_apoint.exc);

View File

@ -61,7 +61,7 @@ generic_hdlr (int sig)
case SIGWINCH: case SIGWINCH:
resize = 1; resize = 1;
clearok (curscr, TRUE); clearok (curscr, TRUE);
(void)ungetch (KEY_RESIZE); ungetch (KEY_RESIZE);
break; break;
case SIGTERM: case SIGTERM:
if (unlink (path_cpid) != 0) if (unlink (path_cpid) != 0)

View File

@ -187,9 +187,9 @@ void
todo_write (struct todo *todo, FILE *f) todo_write (struct todo *todo, FILE *f)
{ {
if (todo->note) if (todo->note)
(void)fprintf (f, "[%d]>%s %s\n", todo->id, todo->note, todo->mesg); fprintf (f, "[%d]>%s %s\n", todo->id, todo->note, todo->mesg);
else else
(void)fprintf (f, "[%d] %s\n", todo->id, todo->mesg); fprintf (f, "[%d] %s\n", todo->id, todo->mesg);
} }
/* Delete a note previously attached to a todo item. */ /* Delete a note previously attached to a todo item. */
@ -338,10 +338,10 @@ todo_chg_priority (int action)
int do_chg = 1; int do_chg = 1;
backup = todo_get_item (hilt); backup = todo_get_item (hilt);
(void)strncpy (backup_mesg, backup->mesg, strlen (backup->mesg) + 1); strncpy (backup_mesg, backup->mesg, strlen (backup->mesg) + 1);
backup_id = backup->id; backup_id = backup->id;
if (backup->note) if (backup->note)
(void)strncpy (backup_note, backup->note, MAX_NOTESIZ + 1); strncpy (backup_note, backup->note, MAX_NOTESIZ + 1);
else else
backup_note[0] = '\0'; backup_note[0] = '\0';
switch (action) switch (action)

View File

@ -115,7 +115,7 @@ fatalbox (const char *errmsg)
if (errmsg == NULL) if (errmsg == NULL)
return; return;
(void)strncpy (msg, errmsg, MSGLEN); strncpy (msg, errmsg, MSGLEN);
errwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2); errwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2);
custom_apply_attr (errwin, ATTR_HIGHEST); custom_apply_attr (errwin, ATTR_HIGHEST);
box (errwin, 0, 0); box (errwin, 0, 0);
@ -124,7 +124,7 @@ fatalbox (const char *errmsg)
mvwprintw (errwin, 5, (WINCOL - strlen (msg)) / 2, "%s", msg); mvwprintw (errwin, 5, (WINCOL - strlen (msg)) / 2, "%s", msg);
custom_remove_attr (errwin, ATTR_HIGHEST); custom_remove_attr (errwin, ATTR_HIGHEST);
wins_wrefresh (errwin); wins_wrefresh (errwin);
(void)wgetch (errwin); wgetch (errwin);
delwin (errwin); delwin (errwin);
wins_doupdate (); wins_doupdate ();
} }
@ -142,7 +142,7 @@ warnbox (const char *msg)
if (msg == NULL) if (msg == NULL)
return; return;
(void)strncpy (displmsg, msg, MSGLEN); strncpy (displmsg, msg, MSGLEN);
warnwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2); warnwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2);
custom_apply_attr (warnwin, ATTR_HIGHEST); custom_apply_attr (warnwin, ATTR_HIGHEST);
box (warnwin, 0, 0); box (warnwin, 0, 0);
@ -150,7 +150,7 @@ warnbox (const char *msg)
mvwprintw (warnwin, 5, (WINCOL - strlen (displmsg)) / 2, "%s", displmsg); mvwprintw (warnwin, 5, (WINCOL - strlen (displmsg)) / 2, "%s", displmsg);
custom_remove_attr (warnwin, ATTR_HIGHEST); custom_remove_attr (warnwin, ATTR_HIGHEST);
wins_wrefresh (warnwin); wins_wrefresh (warnwin);
(void)wgetch (warnwin); wgetch (warnwin);
delwin (warnwin); delwin (warnwin);
wins_doupdate (); wins_doupdate ();
} }
@ -201,7 +201,7 @@ popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg,
mvwprintw (popup_win, MSGXPOS, (pop_col - strlen (msg)) / 2, "%s", msg); mvwprintw (popup_win, MSGXPOS, (pop_col - strlen (msg)) / 2, "%s", msg);
custom_apply_attr (popup_win, ATTR_HIGHEST); custom_apply_attr (popup_win, ATTR_HIGHEST);
box (popup_win, 0, 0); box (popup_win, 0, 0);
(void)snprintf (label, BUFSIZ, "%s", title); snprintf (label, BUFSIZ, "%s", title);
wins_show (popup_win, label); wins_show (popup_win, label);
if (hint) if (hint)
mvwprintw (popup_win, pop_row - 2, pop_col - (strlen (any_key) + 1), "%s", mvwprintw (popup_win, pop_row - 2, pop_col - (strlen (any_key) + 1), "%s",
@ -293,7 +293,7 @@ date_sec2date_str (long sec, char *datefmt)
char *datestr = (char *) mem_calloc (BUFSIZ, sizeof (char)); char *datestr = (char *) mem_calloc (BUFSIZ, sizeof (char));
if (sec == 0) if (sec == 0)
(void)strncpy (datestr, "0", BUFSIZ); strncpy (datestr, "0", BUFSIZ);
else else
{ {
lt = localtime ((time_t *)&sec); lt = localtime ((time_t *)&sec);
@ -429,7 +429,7 @@ item_in_popup (char *saved_a_start, char *saved_a_end, char *msg,
wmove (win[STA].p, 0, 0); wmove (win[STA].p, 0, 0);
pnoutrefresh (pad, 0, 0, margin_top + 2, margin_left, padl, winw); pnoutrefresh (pad, 0, 0, margin_top + 2, margin_left, padl, winw);
wins_doupdate (); wins_doupdate ();
(void)wgetch (popup_win); wgetch (popup_win);
delwin (pad); delwin (pad);
delwin (popup_win); delwin (popup_win);
} }
@ -466,7 +466,7 @@ nowstr (void)
static char buf[BUFSIZ]; static char buf[BUFSIZ];
time_t t = now (); time_t t = now ();
(void)strftime (buf, sizeof buf, "%a %b %d %T %Y", localtime (&t)); strftime (buf, sizeof buf, "%a %b %d %T %Y", localtime (&t));
return buf; return buf;
} }
@ -547,7 +547,7 @@ new_tempfile (const char *prefix, int trailing_len)
if (prefix_len + trailing_len >= BUFSIZ) if (prefix_len + trailing_len >= BUFSIZ)
return (NULL); return (NULL);
memcpy (fullname, prefix, prefix_len); memcpy (fullname, prefix, prefix_len);
(void)memset (fullname + prefix_len, 'X', trailing_len); memset (fullname + prefix_len, 'X', trailing_len);
fullname[prefix_len + trailing_len] = '\0'; fullname[prefix_len + trailing_len] = '\0';
if ((fd = mkstemp (fullname)) == -1 || (file = fdopen (fd, "w+")) == NULL) if ((fd = mkstemp (fullname)) == -1 || (file = fdopen (fd, "w+")) == NULL)
{ {

View File

@ -129,7 +129,7 @@ vars_init (struct conf *conf)
conf->periodic_save = 0; conf->periodic_save = 0;
conf->skip_system_dialogs = 0; conf->skip_system_dialogs = 0;
conf->skip_progress_bar = 0; conf->skip_progress_bar = 0;
(void)strncpy (conf->output_datefmt, "%D", 3); strncpy (conf->output_datefmt, "%D", 3);
conf->input_datefmt = 1; conf->input_datefmt = 1;
/* Default external editor and pager */ /* Default external editor and pager */

View File

@ -75,7 +75,7 @@ screen_acquire (void)
static void static void
screen_release (void) screen_release (void)
{ {
(void)pthread_mutex_unlock (&screen_mutex); pthread_mutex_unlock (&screen_mutex);
} }
int int
@ -227,17 +227,17 @@ wins_init_panels (void)
char label[BUFSIZ]; char label[BUFSIZ];
win[CAL].p = newwin (CALHEIGHT, wins_sbar_width (), win[CAL].y, win[CAL].x); win[CAL].p = newwin (CALHEIGHT, wins_sbar_width (), win[CAL].y, win[CAL].x);
(void)strncpy (label, _("Calendar"), BUFSIZ); strncpy (label, _("Calendar"), BUFSIZ);
wins_show (win[CAL].p, label); wins_show (win[CAL].p, label);
win[APP].p = newwin (win[APP].h, win[APP].w, win[APP].y, win[APP].x); win[APP].p = newwin (win[APP].h, win[APP].w, win[APP].y, win[APP].x);
(void)strncpy (label, _("Appointments"), BUFSIZ); strncpy (label, _("Appointments"), BUFSIZ);
wins_show (win[APP].p, label); wins_show (win[APP].p, label);
apad.width = win[APP].w - 3; apad.width = win[APP].w - 3;
apad.ptrwin = newpad (apad.length, apad.width); apad.ptrwin = newpad (apad.length, apad.width);
win[TOD].p = newwin (win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x); win[TOD].p = newwin (win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x);
(void)strncpy (label, _("ToDo"), BUFSIZ); strncpy (label, _("ToDo"), BUFSIZ);
wins_show (win[TOD].p, label); wins_show (win[TOD].p, label);
/* Enable function keys (i.e. arrow keys) in those windows */ /* Enable function keys (i.e. arrow keys) in those windows */