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:
parent
44bc9605d6
commit
7cc6305588
45
src/apoint.c
45
src/apoint.c
@ -191,7 +191,7 @@ apoint_add (void)
|
||||
else
|
||||
{
|
||||
status_mesg (format_message_1, enter_str);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -231,7 +231,7 @@ apoint_add (void)
|
||||
else
|
||||
{
|
||||
status_mesg (format_message_2, enter_str);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -247,14 +247,12 @@ apoint_add (void)
|
||||
if (is_appointment)
|
||||
{
|
||||
apoint_start = date2sec (*calendar_get_slctd_day (), heures, minutes);
|
||||
(void)apoint_new (item_mesg, 0L, apoint_start,
|
||||
min2sec (apoint_duration), 0L);
|
||||
apoint_new (item_mesg, 0L, apoint_start, min2sec (apoint_duration), 0L);
|
||||
if (notify_bar ())
|
||||
notify_check_added (item_mesg, apoint_start, 0L);
|
||||
}
|
||||
else
|
||||
(void)event_new (item_mesg, 0L,
|
||||
date2sec (*calendar_get_slctd_day (), 0, 0), Id);
|
||||
event_new (item_mesg, 0L, date2sec (*calendar_get_slctd_day (), 0, 0), Id);
|
||||
|
||||
if (hilt == 0)
|
||||
hilt++;
|
||||
@ -397,20 +395,20 @@ apoint_sec2str (struct apoint *o, int type, long day, char *start, char *end)
|
||||
time_t t;
|
||||
|
||||
if (o->start < day)
|
||||
(void)strncpy (start, "..:..", 6);
|
||||
strncpy (start, "..:..", 6);
|
||||
else
|
||||
{
|
||||
t = o->start;
|
||||
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)
|
||||
(void)strncpy (end, "..:..", 6);
|
||||
strncpy (end, "..:..", 6);
|
||||
else
|
||||
{
|
||||
t = o->start + o->dur;
|
||||
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;
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, "%02u/%02u/%04u @ %02u:%02u",
|
||||
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, lt->tm_hour,
|
||||
lt->tm_min);
|
||||
fprintf (f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
|
||||
|
||||
t = o->start + o->dur;
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u ",
|
||||
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year, lt->tm_hour,
|
||||
lt->tm_min);
|
||||
fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u ", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
|
||||
|
||||
if (o->note != NULL)
|
||||
(void)fprintf (f, ">%s ", o->note);
|
||||
fprintf (f, ">%s ", o->note);
|
||||
|
||||
if (o->state & APOINT_NOTIFY)
|
||||
(void)fputc ('!', f);
|
||||
fputc ('!', f);
|
||||
else
|
||||
(void)fputc ('|', f);
|
||||
fputc ('|', f);
|
||||
|
||||
(void)fprintf (f, "%s\n", o->mesg);
|
||||
fprintf (f, "%s\n", o->mesg);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
t = time (NULL);
|
||||
(void)localtime (&t);
|
||||
localtime (&t);
|
||||
|
||||
/* Read the appointment description */
|
||||
(void)fgets (buf, sizeof buf, f);
|
||||
fgets (buf, sizeof buf, f);
|
||||
newline = strchr (buf, '\n');
|
||||
if (newline)
|
||||
*newline = '\0';
|
||||
@ -725,9 +721,8 @@ apoint_paste_item (void)
|
||||
|
||||
bkp_time = get_item_time (bkp_cut_apoint.start);
|
||||
bkp_start = calendar_get_slctd_day_sec () + bkp_time;
|
||||
(void)apoint_new (bkp_cut_apoint.mesg, bkp_cut_apoint.note,
|
||||
bkp_start, bkp_cut_apoint.dur,
|
||||
bkp_cut_apoint.state);
|
||||
apoint_new (bkp_cut_apoint.mesg, bkp_cut_apoint.note, bkp_start,
|
||||
bkp_cut_apoint.dur, bkp_cut_apoint.state);
|
||||
|
||||
if (notify_bar ())
|
||||
notify_check_added (bkp_cut_apoint.mesg, bkp_start, bkp_cut_apoint.state);
|
||||
|
26
src/args.c
26
src/args.c
@ -209,7 +209,7 @@ print_notefile (FILE *out, char *filename, int nbtab)
|
||||
else
|
||||
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");
|
||||
if (notefile)
|
||||
{
|
||||
@ -319,8 +319,8 @@ next_arg (void)
|
||||
hours_left = (time_left / HOURINSEC);
|
||||
min_left = (time_left - hours_left * HOURINSEC) / MININSEC;
|
||||
fputs (_("next appointment:\n"), stdout);
|
||||
(void)snprintf (mesg, BUFSIZ, " [%02d:%02d] %s\n", hours_left, min_left,
|
||||
next_app.txt);
|
||||
snprintf (mesg, BUFSIZ, " [%02d:%02d] %s\n", hours_left, min_left,
|
||||
next_app.txt);
|
||||
fputs (mesg, stdout);
|
||||
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)
|
||||
add_line = 1;
|
||||
t->tm_mday++;
|
||||
(void)mktime (t);
|
||||
mktime (t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,15 +596,15 @@ date_arg (char *ddate, int add_line, int print_note, struct conf *conf,
|
||||
if (parse_date (ddate, conf->input_datefmt, (int *)&day.yyyy,
|
||||
(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
|
||||
{
|
||||
char outstr[BUFSIZ];
|
||||
fputs (_("Argument to the '-d' flag is not valid\n"), stderr);
|
||||
(void)snprintf (outstr, BUFSIZ,
|
||||
"Possible argument format are: '%s' or 'n'\n",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ,
|
||||
"Possible argument format are: '%s' or 'n'\n",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
fputs (_(outstr), stdout);
|
||||
more_info ();
|
||||
}
|
||||
@ -650,7 +650,7 @@ date_arg_extended (char *startday, char *range, int add_line, int print_note,
|
||||
{
|
||||
t.tm_year -= 1900;
|
||||
t.tm_mon--;
|
||||
(void)mktime (&t);
|
||||
mktime (&t);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -665,9 +665,9 @@ date_arg_extended (char *startday, char *range, int add_line, int print_note,
|
||||
{
|
||||
char outstr[BUFSIZ];
|
||||
fputs (_("Argument is not valid\n"), stderr);
|
||||
(void)snprintf (outstr, BUFSIZ,
|
||||
"Argument format for -s and --startday is: '%s'\n",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ,
|
||||
"Argument format for -s and --startday is: '%s'\n",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
fputs (_(outstr), stdout);
|
||||
fputs (_("Argument format for -r and --range is: 'n'\n"), stdout);
|
||||
more_info ();
|
||||
@ -983,7 +983,7 @@ parse_args (int argc, char **argv, struct conf *conf)
|
||||
custom_load_conf (conf); /* To get output date format. */
|
||||
io_load_app ();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -161,21 +161,21 @@
|
||||
int len; \
|
||||
\
|
||||
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) \
|
||||
fatalbox (msg); \
|
||||
else \
|
||||
(void)fprintf (stderr, "%s\n", msg); \
|
||||
fprintf (stderr, "%s\n", msg); \
|
||||
} while (0)
|
||||
|
||||
#define WARN_MSG(...) do { \
|
||||
char msg[BUFSIZ]; \
|
||||
\
|
||||
(void)snprintf (msg, BUFSIZ, __VA_ARGS__); \
|
||||
snprintf (msg, BUFSIZ, __VA_ARGS__); \
|
||||
if (ui_mode == UI_CURSES) \
|
||||
warnbox (msg); \
|
||||
else \
|
||||
(void)fprintf (stderr, "%s\n", msg); \
|
||||
fprintf (stderr, "%s\n", msg); \
|
||||
} while (0)
|
||||
|
||||
#define EXIT(...) do { \
|
||||
|
@ -124,7 +124,7 @@ calendar_date_thread (void *arg)
|
||||
tomorrow = (time_t) (get_today () + DAYINSEC);
|
||||
|
||||
while ((actual = time (NULL)) < tomorrow)
|
||||
(void)sleep (tomorrow - actual);
|
||||
sleep (tomorrow - actual);
|
||||
|
||||
calendar_set_current_date ();
|
||||
calendar_update_panel (&win[CAL]);
|
||||
@ -233,12 +233,12 @@ calendar_get_wday (struct date *date)
|
||||
{
|
||||
struct tm t;
|
||||
|
||||
(void)memset (&t, 0, sizeof (struct tm));
|
||||
memset (&t, 0, sizeof (struct tm));
|
||||
t.tm_mday = date->dd;
|
||||
t.tm_mon = date->mm - 1;
|
||||
t.tm_year = date->yyyy - 1900;
|
||||
|
||||
(void)mktime (&t);
|
||||
mktime (&t);
|
||||
|
||||
return t.tm_wday;
|
||||
}
|
||||
@ -492,12 +492,12 @@ draw_weekly_view (struct window *cwin, struct date *current_day,
|
||||
else
|
||||
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_mon = slctd_day.mm - 1;
|
||||
t.tm_year = slctd_day.yyyy - 1900;
|
||||
(void)mktime (&t);
|
||||
(void)date_change (&t, 0, -days_to_remove);
|
||||
mktime (&t);
|
||||
date_change (&t, 0, -days_to_remove);
|
||||
|
||||
/* Print the week number. */
|
||||
weeknum = ISO8601weeknum (&t);
|
||||
@ -569,7 +569,7 @@ draw_weekly_view (struct window *cwin, struct date *current_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. */
|
||||
@ -633,7 +633,7 @@ calendar_change_day (int datefmt)
|
||||
|
||||
while (wrong_day)
|
||||
{
|
||||
(void)snprintf (outstr, BUFSIZ, request_date, DATEFMT_DESC (datefmt));
|
||||
snprintf (outstr, BUFSIZ, request_date, DATEFMT_DESC (datefmt));
|
||||
status_mesg (_(outstr), "");
|
||||
if (getstring (win[STA].p, selected_day, LDAY, 0, 1) == GETSTRING_ESC)
|
||||
return;
|
||||
@ -656,7 +656,7 @@ calendar_change_day (int datefmt)
|
||||
if (wrong_day)
|
||||
{
|
||||
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;
|
||||
struct tm t;
|
||||
|
||||
(void)memset (&t, 0, sizeof (struct tm));
|
||||
memset (&t, 0, sizeof (struct tm));
|
||||
t.tm_mday = slctd_day.dd;
|
||||
t.tm_mon = slctd_day.mm - 1;
|
||||
t.tm_year = slctd_day.yyyy - 1900;
|
||||
@ -703,7 +703,7 @@ calendar_move (enum move move, int count)
|
||||
break;
|
||||
case WEEK_START:
|
||||
/* Normalize struct tm to get week day number. */
|
||||
(void)mktime (&t);
|
||||
mktime (&t);
|
||||
if (calendar_week_begins_on_monday ())
|
||||
days_to_remove = ((t.tm_wday == 0) ? WEEKINDAYS - 1 : t.tm_wday - 1);
|
||||
else
|
||||
@ -712,7 +712,7 @@ calendar_move (enum move move, int count)
|
||||
ret = date_change (&t, 0, -days_to_remove);
|
||||
break;
|
||||
case WEEK_END:
|
||||
(void)mktime (&t);
|
||||
mktime (&t);
|
||||
if (calendar_week_begins_on_monday ())
|
||||
days_to_add = ((t.tm_wday == 0) ? 0 : WEEKINDAYS - t.tm_wday);
|
||||
else
|
||||
|
33
src/custom.c
33
src/custom.c
@ -334,23 +334,23 @@ custom_set_conf (struct conf *conf, enum conf_var var, char *val)
|
||||
return conf_parse_bool (&nbar.show, val);
|
||||
break;
|
||||
case CUSTOM_CONF_NOTIFYBARDATE:
|
||||
(void)strncpy (nbar.datefmt, val, strlen (val) + 1);
|
||||
strncpy (nbar.datefmt, val, strlen (val) + 1);
|
||||
break;
|
||||
case CUSTOM_CONF_NOTIFYBARCLOCK:
|
||||
(void)strncpy (nbar.timefmt, val, strlen (val) + 1);
|
||||
strncpy (nbar.timefmt, val, strlen (val) + 1);
|
||||
break;
|
||||
case CUSTOM_CONF_NOTIFYBARWARNING:
|
||||
return conf_parse_int (&nbar.cntdwn, val);
|
||||
break;
|
||||
case CUSTOM_CONF_NOTIFYBARCOMMAND:
|
||||
(void)strncpy (nbar.cmd, val, strlen (val) + 1);
|
||||
strncpy (nbar.cmd, val, strlen (val) + 1);
|
||||
break;
|
||||
case CUSTOM_CONF_NOTIFYALL:
|
||||
return conf_parse_bool (&nbar.notify_all, val);
|
||||
break;
|
||||
case CUSTOM_CONF_OUTPUTDATEFMT:
|
||||
if (val[0] != '\0')
|
||||
(void)strncpy (conf->output_datefmt, val, strlen (val) + 1);
|
||||
strncpy (conf->output_datefmt, val, strlen (val) + 1);
|
||||
break;
|
||||
case CUSTOM_CONF_INPUTDATEFMT:
|
||||
return conf_parse_int (&conf->input_datefmt, val);
|
||||
@ -390,7 +390,7 @@ custom_load_conf (struct conf *conf)
|
||||
status_mesg (mesg_line1, mesg_line2);
|
||||
wnoutrefresh (win[STA].p);
|
||||
wins_doupdate ();
|
||||
(void)keys_getch (win[STA].p, NULL);
|
||||
keys_getch (win[STA].p, NULL);
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&nbar.mutex);
|
||||
@ -573,7 +573,7 @@ custom_layout_config (void)
|
||||
" 't' -> todo panel\n\n");
|
||||
|
||||
conf_win.p = (WINDOW *)0;
|
||||
(void)strncpy (label, _("layout configuration"), BUFSIZ);
|
||||
strncpy (label, _("layout configuration"), BUFSIZ);
|
||||
custom_confwin_init (&conf_win, label);
|
||||
cursor = mark = wins_layout () - 1;
|
||||
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,
|
||||
confwin->x + confwin->w, confwin->y + confwin->h);
|
||||
(void)delwin (confwin->p);
|
||||
delwin (confwin->p);
|
||||
}
|
||||
|
||||
wins_get_config ();
|
||||
@ -893,7 +893,7 @@ custom_color_config (void)
|
||||
char label[BUFSIZ];
|
||||
|
||||
conf_win.p = 0;
|
||||
(void)strncpy (label, _("color theme"), BUFSIZ);
|
||||
strncpy (label, _("color theme"), BUFSIZ);
|
||||
custom_confwin_init (&conf_win, label);
|
||||
mark_fore = NBUSERCOLORS;
|
||||
mark_back = SIZE - 1;
|
||||
@ -995,7 +995,7 @@ custom_color_theme_name (char *theme_name)
|
||||
};
|
||||
|
||||
if (!colorize)
|
||||
(void)strncpy (theme_name, "0", BUFSIZ);
|
||||
strncpy (theme_name, "0", BUFSIZ);
|
||||
else
|
||||
{
|
||||
pair_content (COLR_CUSTOM, &color[0], &color[1]);
|
||||
@ -1011,8 +1011,7 @@ custom_color_theme_name (char *theme_name)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
(void)snprintf (theme_name, BUFSIZ, "%s on %s", color_name[0],
|
||||
color_name[1]);
|
||||
snprintf (theme_name, BUFSIZ, "%s on %s", color_name[0], color_name[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1160,7 +1159,7 @@ custom_general_config (struct conf *conf)
|
||||
|
||||
clear ();
|
||||
custom_set_swsiz (&cwin);
|
||||
(void)strncpy (cwin.label, _("general options"), BUFSIZ);
|
||||
strncpy (cwin.label, _("general options"), BUFSIZ);
|
||||
wins_scrollwin_init (&cwin);
|
||||
wins_show (cwin.win.p, cwin.label);
|
||||
status_mesg (number_str, keys);
|
||||
@ -1217,11 +1216,11 @@ custom_general_config (struct conf *conf)
|
||||
break;
|
||||
case '9':
|
||||
status_mesg (output_datefmt_str, "");
|
||||
(void)strncpy (buf, conf->output_datefmt,
|
||||
strlen (conf->output_datefmt) + 1);
|
||||
strncpy (buf, conf->output_datefmt,
|
||||
strlen (conf->output_datefmt) + 1);
|
||||
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);
|
||||
break;
|
||||
@ -1293,7 +1292,7 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff)
|
||||
int nbkeys;
|
||||
|
||||
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)
|
||||
custom_apply_attr (win, ATTR_HIGHEST);
|
||||
mvwprintw (win, y, XPOS, "%s ", actionstr);
|
||||
@ -1365,7 +1364,7 @@ custom_keys_config (void)
|
||||
clear ();
|
||||
custom_set_swsiz (&kwin);
|
||||
nbdisplayed = (kwin.win.h - LABELLINES) / LINESPERKEY;
|
||||
(void)strncpy (kwin.label, _("keys configuration"), BUFSIZ);
|
||||
strncpy (kwin.label, _("keys configuration"), BUFSIZ);
|
||||
wins_scrollwin_init (&kwin);
|
||||
wins_show (kwin.win.p, kwin.label);
|
||||
custom_keys_config_bar ();
|
||||
|
37
src/day.c
37
src/day.c
@ -151,7 +151,7 @@ day_store_events (long date)
|
||||
LLIST_FIND_FOREACH_CONT (&eventlist, date, event_inday, 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++;
|
||||
}
|
||||
|
||||
@ -174,8 +174,7 @@ day_store_recur_events (long date)
|
||||
LLIST_FIND_FOREACH (&recur_elist, date, recur_event_inday, i)
|
||||
{
|
||||
struct recur_event *rev = LLIST_TS_GET_DATA (i);
|
||||
(void)day_add_event (RECUR_EVNT, rev->mesg, rev->note, rev->day,
|
||||
rev->id);
|
||||
day_add_event (RECUR_EVNT, rev->mesg, rev->note, rev->day, rev->id);
|
||||
e_nb++;
|
||||
}
|
||||
|
||||
@ -199,8 +198,8 @@ day_store_apoints (long date)
|
||||
LLIST_TS_FIND_FOREACH_CONT (&alist_p, date, apoint_inday, i)
|
||||
{
|
||||
struct apoint *apt = LLIST_TS_GET_DATA (i);
|
||||
(void)day_add_apoint (APPT, apt->mesg, apt->note, apt->start, apt->dur,
|
||||
apt->state, 0);
|
||||
day_add_apoint (APPT, apt->mesg, apt->note, apt->start, apt->dur,
|
||||
apt->state, 0);
|
||||
a_nb++;
|
||||
}
|
||||
LLIST_TS_UNLOCK (&alist_p);
|
||||
@ -228,8 +227,8 @@ day_store_recur_apoints (long date)
|
||||
unsigned real_start;
|
||||
if (recur_apoint_find_occurrence (rapt, date, &real_start))
|
||||
{
|
||||
(void)day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start,
|
||||
rapt->dur, rapt->state, a_nb);
|
||||
day_add_apoint (RECUR_APPT, rapt->mesg, rapt->note, real_start,
|
||||
rapt->dur, rapt->state, a_nb);
|
||||
a_nb++;
|
||||
}
|
||||
}
|
||||
@ -591,7 +590,7 @@ day_edit_time (int time, unsigned *new_hour, unsigned *new_minute)
|
||||
else
|
||||
{
|
||||
status_mesg (fmt_msg, enter_str);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -631,7 +630,7 @@ day_edit_duration (int start, int dur, unsigned *new_duration)
|
||||
else
|
||||
{
|
||||
status_mesg (fmt_msg, enter_str);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -665,7 +664,7 @@ update_start_time (long *start, long *dur)
|
||||
else
|
||||
{
|
||||
status_mesg (msg_wrong_time, msg_enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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:"), "");
|
||||
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)
|
||||
{
|
||||
newfreq = atoi (freqstr);
|
||||
@ -736,7 +735,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
|
||||
if (newfreq == 0)
|
||||
{
|
||||
status_mesg (msg_wrong_freq, msg_enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -749,8 +748,8 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
|
||||
|
||||
do
|
||||
{
|
||||
(void)snprintf (outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'",
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
status_mesg (_(outstr), "");
|
||||
timstr =
|
||||
date_sec2date_str ((*rpt)->until, DATEFMT (conf->input_datefmt));
|
||||
@ -783,7 +782,7 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
|
||||
if (newuntil < start)
|
||||
{
|
||||
status_mesg (msg_wrong_time, msg_enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
date_entered = 0;
|
||||
}
|
||||
else
|
||||
@ -791,10 +790,10 @@ update_rept (struct rpt **rpt, const long start, struct conf *conf)
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)snprintf (outstr, BUFSIZ, msg_fmts,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ, msg_fmts,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
status_mesg (msg_wrong_date, _(outstr));
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
date_entered = 0;
|
||||
}
|
||||
}
|
||||
|
12
src/dmon.c
12
src/dmon.c
@ -49,7 +49,7 @@
|
||||
|
||||
#define DMON_LOG(...) do { \
|
||||
if (dmon.log) \
|
||||
(void)io_fprintln (path_dmon_log, __VA_ARGS__); \
|
||||
io_fprintln (path_dmon_log, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define DMON_ABRT(...) do { \
|
||||
@ -131,15 +131,15 @@ daemonize (int status)
|
||||
/* Redirect standard file descriptors to /dev/null. */
|
||||
if ((fd = open (_PATH_DEVNULL, O_RDWR, 0)) != -1)
|
||||
{
|
||||
(void)dup2 (fd, STDIN_FILENO);
|
||||
(void)dup2 (fd, STDOUT_FILENO);
|
||||
(void)dup2 (fd, STDERR_FILENO);
|
||||
dup2 (fd, STDIN_FILENO);
|
||||
dup2 (fd, STDOUT_FILENO);
|
||||
dup2 (fd, STDERR_FILENO);
|
||||
if (fd > 2)
|
||||
(void)close (fd);
|
||||
close (fd);
|
||||
}
|
||||
|
||||
/* Write access for the owner only. */
|
||||
(void)umask (0022);
|
||||
umask (0022);
|
||||
|
||||
if (!sigs_set_hdlr (SIGINT, dmon_sigs_hdlr)
|
||||
|| !sigs_set_hdlr (SIGTERM, dmon_sigs_hdlr)
|
||||
|
17
src/event.c
17
src/event.c
@ -131,11 +131,11 @@ event_write (struct event *o, FILE *f)
|
||||
|
||||
t = o->day;
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, "%02u/%02u/%04u [%d] ", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, o->id);
|
||||
fprintf (f, "%02u/%02u/%04u [%d] ", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, o->id);
|
||||
if (o->note != NULL)
|
||||
(void)fprintf (f, ">%s ", o->note);
|
||||
(void)fprintf (f, "%s\n", o->mesg);
|
||||
fprintf (f, ">%s ", o->note);
|
||||
fprintf (f, "%s\n", o->mesg);
|
||||
}
|
||||
|
||||
/* Load the events from file */
|
||||
@ -146,10 +146,10 @@ event_scan (FILE *f, struct tm start, int id, char *note)
|
||||
time_t tstart, t;
|
||||
|
||||
t = time (NULL);
|
||||
(void)localtime (&t);
|
||||
localtime (&t);
|
||||
|
||||
/* Read the event description */
|
||||
(void)fgets (buf, sizeof buf, f);
|
||||
fgets (buf, sizeof buf, f);
|
||||
nl = strchr (buf, '\n');
|
||||
if (nl)
|
||||
{
|
||||
@ -212,8 +212,7 @@ event_delete_bynum (long start, unsigned num, enum eraseflg flag)
|
||||
void
|
||||
event_paste_item (void)
|
||||
{
|
||||
(void)event_new (bkp_cut_event.mesg, bkp_cut_event.note,
|
||||
date2sec (*calendar_get_slctd_day (), 0, 0),
|
||||
bkp_cut_event.id);
|
||||
event_new (bkp_cut_event.mesg, bkp_cut_event.note,
|
||||
date2sec (*calendar_get_slctd_day (), 0, 0), bkp_cut_event.id);
|
||||
event_free_bkp ();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ updatestring (WINDOW *win, char **str, int x, int y)
|
||||
EXIT_IF (len + 1 > BUFSIZ, _("Internal error: line too long"));
|
||||
|
||||
buf = mem_malloc (BUFSIZ);
|
||||
(void)memcpy (buf, *str, len + 1);
|
||||
memcpy (buf, *str, len + 1);
|
||||
|
||||
ret = getstring (win, buf, BUFSIZ, x, y);
|
||||
|
||||
@ -291,7 +291,7 @@ updatestring (WINDOW *win, char **str, int x, int y)
|
||||
len = strlen (buf);
|
||||
*str = mem_realloc (*str, len + 1, 1);
|
||||
EXIT_IF (*str == NULL, _("out of memory"));
|
||||
(void)memcpy (*str, buf, len + 1);
|
||||
memcpy (*str, buf, len + 1);
|
||||
}
|
||||
|
||||
mem_free (buf);
|
||||
|
54
src/help.c
54
src/help.c
@ -168,7 +168,7 @@ help_wins_init (struct scrollwin *hwin, int x, int y, int h, int w)
|
||||
hwin->pad.h = BUFSIZ;
|
||||
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_show (hwin->win.p, hwin->label);
|
||||
}
|
||||
@ -342,7 +342,7 @@ help_screen (void)
|
||||
|
||||
hscr[HELP_MAIN].title =
|
||||
_(" 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"
|
||||
" inside help screens, if necessary.\n\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));
|
||||
|
||||
hscr[HELP_SAVE].title = _("Save\n");
|
||||
(void)snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
|
||||
snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
|
||||
_("Save calcurse data.\n"
|
||||
"Data are splitted into four different files which contain :"
|
||||
"\n\n"
|
||||
@ -376,7 +376,7 @@ help_screen (void)
|
||||
"automatically before quitting."));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -394,7 +394,7 @@ help_screen (void)
|
||||
"the item could not be imported.\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"
|
||||
"This leads to the export submenu, from which you can choose between\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"
|
||||
" events, appointments, todos.\n"));
|
||||
|
||||
(void)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_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ);
|
||||
strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN),
|
||||
BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT),
|
||||
strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT),
|
||||
BUFSIZ);
|
||||
(void)strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT),
|
||||
strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT),
|
||||
BUFSIZ);
|
||||
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"
|
||||
"The following scheme summarizes how to get around:\n\n"
|
||||
" move up\n"
|
||||
@ -444,7 +444,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_END_OF_WEEK));
|
||||
|
||||
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"
|
||||
"\nThis is usefull when an event description is longer than the "
|
||||
"available\nspace to display it. "
|
||||
@ -457,7 +457,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_VIEW_ITEM));
|
||||
|
||||
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"
|
||||
"\nPress the '%s' key to pipe the currently selected appointment or\n"
|
||||
"todo entry to an external program.\n"
|
||||
@ -465,7 +465,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_PIPE_ITEM));
|
||||
|
||||
hscr[HELP_TAB].title = _("Tab\n");
|
||||
(void)snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
|
||||
snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
|
||||
_("Switch between panels.\n"
|
||||
"The panel currently in use has its border colorized.\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));
|
||||
|
||||
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"
|
||||
"\nUsing this command, you do not need to travel to that day using\n"
|
||||
"the displacement keys inside the calendar panel.\n"
|
||||
@ -491,7 +491,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
|
||||
|
||||
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"
|
||||
"\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"
|
||||
@ -505,7 +505,7 @@ help_screen (void)
|
||||
"next time you launch Calcurse."));
|
||||
|
||||
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"
|
||||
"panel is selected when you press '%s'.\n"
|
||||
"\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));
|
||||
|
||||
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"
|
||||
"move an item from one date to another.\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));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -575,7 +575,7 @@ help_screen (void)
|
||||
" modified properties next time you launch Calcurse."));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -596,7 +596,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_EDIT_NOTE));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -615,7 +615,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_VIEW_NOTE));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -633,7 +633,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_LOWER_PRIORITY));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -660,7 +660,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_REPEAT_ITEM));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -674,7 +674,7 @@ help_screen (void)
|
||||
"\nand how long before it he gets notified."));
|
||||
|
||||
hscr[HELP_CONFIG].title = _("Config\n");
|
||||
(void)snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
|
||||
snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
|
||||
_("Open the configuration submenu.\n"
|
||||
"From this submenu, you can select between color, layout, notification\n"
|
||||
"and general options, and you can also configure your keybindings.\n"
|
||||
@ -689,7 +689,7 @@ help_screen (void)
|
||||
"\nnext time you launch Calcurse."));
|
||||
|
||||
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"
|
||||
"called generic keybinding.\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));
|
||||
|
||||
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"
|
||||
"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"
|
||||
@ -731,7 +731,7 @@ help_screen (void)
|
||||
keys_action_firstkey (KEY_GENERIC_OTHER_CMD));
|
||||
|
||||
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"
|
||||
"All rights reserved.\n"
|
||||
"\n"
|
||||
|
492
src/io.c
492
src/io.c
@ -215,11 +215,10 @@ get_export_stream (enum export_type type)
|
||||
stream = NULL;
|
||||
stream_name = (char *) mem_malloc (BUFSIZ);
|
||||
if ((home = getenv ("HOME")) != NULL)
|
||||
(void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", home,
|
||||
file_ext[type]);
|
||||
snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", home, file_ext[type]);
|
||||
else
|
||||
(void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", get_tempdir (),
|
||||
file_ext[type]);
|
||||
snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", get_tempdir (),
|
||||
file_ext[type]);
|
||||
|
||||
while (stream == NULL)
|
||||
{
|
||||
@ -234,7 +233,7 @@ get_export_stream (enum export_type type)
|
||||
if (stream == NULL)
|
||||
{
|
||||
status_mesg (wrong_name, press_enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
mem_free (stream_name);
|
||||
@ -295,41 +294,40 @@ foreach_date_dump (const long date_end, struct rpt *rpt, llist_t *exc,
|
||||
static void
|
||||
ical_export_valarm (FILE *stream)
|
||||
{
|
||||
(void)fputs ("BEGIN:VALARM\n", stream);
|
||||
fputs ("BEGIN:VALARM\n", stream);
|
||||
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);
|
||||
(void)fputs ("ACTION:DISPLAY\n", stream);
|
||||
(void)fputs ("END:VALARM\n", stream);
|
||||
fputs ("ACTION:DISPLAY\n", stream);
|
||||
fputs ("END:VALARM\n", stream);
|
||||
}
|
||||
|
||||
/* Export header. */
|
||||
static void
|
||||
ical_export_header (FILE *stream)
|
||||
{
|
||||
(void)fputs ("BEGIN:VCALENDAR\n", stream);
|
||||
(void)fprintf (stream, "PRODID:-//calcurse//NONSGML v%s//EN\n", VERSION);
|
||||
(void)fputs ("VERSION:2.0\n", stream);
|
||||
fputs ("BEGIN:VCALENDAR\n", stream);
|
||||
fprintf (stream, "PRODID:-//calcurse//NONSGML v%s//EN\n", VERSION);
|
||||
fputs ("VERSION:2.0\n", stream);
|
||||
}
|
||||
|
||||
static void
|
||||
pcal_export_header (FILE *stream)
|
||||
{
|
||||
(void)fputs ("# calcurse pcal export\n", stream);
|
||||
(void)fputs ("\n# =======\n# options\n# =======\n", stream);
|
||||
(void)fprintf (stream, "opt -A -K -l -m -F %s\n",
|
||||
calendar_week_begins_on_monday () ?
|
||||
"Monday" : "Sunday");
|
||||
(void)fputs ("# Display week number (i.e. 1-52) on every Monday\n", stream);
|
||||
(void)fprintf (stream, "all monday in all %s %%w\n", _("Week"));
|
||||
(void)fputc ('\n', stream);
|
||||
fputs ("# calcurse pcal export\n", stream);
|
||||
fputs ("\n# =======\n# options\n# =======\n", stream);
|
||||
fprintf (stream, "opt -A -K -l -m -F %s\n",
|
||||
calendar_week_begins_on_monday () ? "Monday" : "Sunday");
|
||||
fputs ("# Display week number (i.e. 1-52) on every Monday\n", stream);
|
||||
fprintf (stream, "all monday in all %s %%w\n", _("Week"));
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
|
||||
/* Export footer. */
|
||||
static void
|
||||
ical_export_footer (FILE *stream)
|
||||
{
|
||||
(void)fputs ("END:VCALENDAR\n", stream);
|
||||
fputs ("END:VCALENDAR\n", stream);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -348,36 +346,36 @@ ical_export_recur_events (FILE *stream)
|
||||
{
|
||||
struct recur_event *rev = LLIST_GET_DATA (i);
|
||||
date_sec2date_fmt (rev->day, ICALDATEFMT, ical_date);
|
||||
(void)fputs ("BEGIN:VEVENT\n", stream);
|
||||
(void)fprintf (stream, "DTSTART:%s\n", ical_date);
|
||||
(void)fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
|
||||
ical_recur_type[rev->rpt->type], rev->rpt->freq);
|
||||
fputs ("BEGIN:VEVENT\n", stream);
|
||||
fprintf (stream, "DTSTART:%s\n", ical_date);
|
||||
fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
|
||||
ical_recur_type[rev->rpt->type], rev->rpt->freq);
|
||||
|
||||
if (rev->rpt->until != 0)
|
||||
{
|
||||
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
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
|
||||
if (LLIST_FIRST (&rev->exc))
|
||||
{
|
||||
(void)fputs ("EXDATE:", stream);
|
||||
fputs ("EXDATE:", stream);
|
||||
LLIST_FOREACH (&rev->exc, j)
|
||||
{
|
||||
struct excp *exc = LLIST_GET_DATA (j);
|
||||
date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date);
|
||||
(void)fprintf (stream, "%s", ical_date);
|
||||
fprintf (stream, "%s", ical_date);
|
||||
if (LLIST_NEXT (j))
|
||||
(void)fputc (',', stream);
|
||||
fputc (',', stream);
|
||||
else
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
}
|
||||
|
||||
(void)fprintf (stream, "SUMMARY:%s\n", rev->mesg);
|
||||
(void)fputs ("END:VEVENT\n", stream);
|
||||
fprintf (stream, "SUMMARY:%s\n", rev->mesg);
|
||||
fputs ("END:VEVENT\n", stream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,7 +387,7 @@ pcal_dump_event (FILE *stream, long event_date, long event_dur,
|
||||
char pcal_date[BUFSIZ];
|
||||
|
||||
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. */
|
||||
@ -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, "%R", pcal_beg);
|
||||
date_sec2date_fmt (apoint_date + apoint_dur, "%R", pcal_end);
|
||||
(void)fprintf (stream, "%s ", pcal_date);
|
||||
(void)fprintf (stream, "(%s -> %s) %s\n", pcal_beg, pcal_end, apoint_mesg);
|
||||
fprintf (stream, "%s ", pcal_date);
|
||||
fprintf (stream, "(%s -> %s) %s\n", pcal_beg, pcal_end, apoint_mesg);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -412,11 +410,10 @@ pcal_export_recur_events (FILE *stream)
|
||||
llist_item_t *i;
|
||||
char pcal_date[BUFSIZ];
|
||||
|
||||
(void)fputs ("\n# =============", stream);
|
||||
(void)fputs ("\n# Recur. Events", stream);
|
||||
(void)fputs ("\n# =============\n", stream);
|
||||
(void)fputs ("# (pcal does not support from..until dates specification\n",
|
||||
stream);
|
||||
fputs ("\n# =============", stream);
|
||||
fputs ("\n# Recur. Events", stream);
|
||||
fputs ("\n# =============\n", stream);
|
||||
fputs ("# (pcal does not support from..until dates specification\n", stream);
|
||||
|
||||
LLIST_FOREACH (&recur_elist, i)
|
||||
{
|
||||
@ -427,23 +424,22 @@ pcal_export_recur_events (FILE *stream)
|
||||
{
|
||||
case RECUR_DAILY:
|
||||
date_sec2date_fmt (rev->day, "%b %d", pcal_date);
|
||||
(void)fprintf (stream, "all day on_or_after %s %s\n",
|
||||
pcal_date, rev->mesg);
|
||||
fprintf (stream, "all day on_or_after %s %s\n", pcal_date,
|
||||
rev->mesg);
|
||||
break;
|
||||
case RECUR_WEEKLY:
|
||||
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);
|
||||
(void)fprintf (stream, "%s %s\n", pcal_date, rev->mesg);
|
||||
fprintf (stream, "%s %s\n", pcal_date, rev->mesg);
|
||||
break;
|
||||
case RECUR_MONTHLY:
|
||||
date_sec2date_fmt (rev->day, "%d", pcal_date);
|
||||
(void)fprintf (stream, "day on all %s %s\n", pcal_date,
|
||||
rev->mesg);
|
||||
fprintf (stream, "day on all %s %s\n", pcal_date, rev->mesg);
|
||||
break;
|
||||
case RECUR_YEARLY:
|
||||
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;
|
||||
default:
|
||||
EXIT (_("incoherent repetition type"));
|
||||
@ -472,10 +468,10 @@ ical_export_events (FILE *stream)
|
||||
{
|
||||
struct event *ev = LLIST_TS_GET_DATA (i);
|
||||
date_sec2date_fmt (ev->day, ICALDATEFMT, ical_date);
|
||||
(void)fputs ("BEGIN:VEVENT\n", stream);
|
||||
(void)fprintf (stream, "DTSTART:%s\n", ical_date);
|
||||
(void)fprintf (stream, "SUMMARY:%s\n", ev->mesg);
|
||||
(void)fputs ("END:VEVENT\n", stream);
|
||||
fputs ("BEGIN:VEVENT\n", stream);
|
||||
fprintf (stream, "DTSTART:%s\n", ical_date);
|
||||
fprintf (stream, "SUMMARY:%s\n", ev->mesg);
|
||||
fputs ("END:VEVENT\n", stream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,13 +480,13 @@ pcal_export_events (FILE *stream)
|
||||
{
|
||||
llist_item_t *i;
|
||||
|
||||
(void)fputs ("\n# ======\n# Events\n# ======\n", stream);
|
||||
fputs ("\n# ======\n# Events\n# ======\n", stream);
|
||||
LLIST_FOREACH (&eventlist, i)
|
||||
{
|
||||
struct event *ev = LLIST_TS_GET_DATA (i);
|
||||
pcal_dump_event (stream, ev->day, 0, ev->mesg);
|
||||
}
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
|
||||
/* Export recurrent appointments. */
|
||||
@ -507,40 +503,40 @@ ical_export_recur_apoints (FILE *stream)
|
||||
struct recur_apoint *rapt = LLIST_TS_GET_DATA (i);
|
||||
|
||||
date_sec2date_fmt (rapt->start, ICALDATETIMEFMT, ical_datetime);
|
||||
(void)fputs ("BEGIN:VEVENT\n", stream);
|
||||
(void)fprintf (stream, "DTSTART:%s\n", ical_datetime);
|
||||
(void)fprintf (stream, "DURATION:PT0H0M%ldS\n", rapt->dur);
|
||||
(void)fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
|
||||
ical_recur_type[rapt->rpt->type], rapt->rpt->freq);
|
||||
fputs ("BEGIN:VEVENT\n", stream);
|
||||
fprintf (stream, "DTSTART:%s\n", ical_datetime);
|
||||
fprintf (stream, "DURATION:PT0H0M%ldS\n", rapt->dur);
|
||||
fprintf (stream, "RRULE:FREQ=%s;INTERVAL=%d",
|
||||
ical_recur_type[rapt->rpt->type], rapt->rpt->freq);
|
||||
|
||||
if (rapt->rpt->until != 0)
|
||||
{
|
||||
date_sec2date_fmt (rapt->rpt->until + HOURINSEC, ICALDATEFMT,
|
||||
ical_date);
|
||||
(void)fprintf (stream, ";UNTIL=%s\n", ical_date);
|
||||
fprintf (stream, ";UNTIL=%s\n", ical_date);
|
||||
}
|
||||
else
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
|
||||
if (LLIST_FIRST (&rapt->exc))
|
||||
{
|
||||
(void)fputs ("EXDATE:", stream);
|
||||
fputs ("EXDATE:", stream);
|
||||
LLIST_FOREACH (&rapt->exc, j)
|
||||
{
|
||||
struct excp *exc = LLIST_GET_DATA (j);
|
||||
date_sec2date_fmt (exc->st, ICALDATEFMT, ical_date);
|
||||
(void)fprintf (stream, "%s", ical_date);
|
||||
fprintf (stream, "%s", ical_date);
|
||||
if (LLIST_NEXT (j))
|
||||
(void)fputc (',', stream);
|
||||
fputc (',', stream);
|
||||
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)
|
||||
ical_export_valarm (stream);
|
||||
(void)fputs ("END:VEVENT\n", stream);
|
||||
fputs ("END:VEVENT\n", stream);
|
||||
}
|
||||
LLIST_TS_UNLOCK (&recur_alist_p);
|
||||
}
|
||||
@ -551,11 +547,10 @@ pcal_export_recur_apoints (FILE *stream)
|
||||
llist_item_t *i;
|
||||
char pcal_date[BUFSIZ], pcal_beg[BUFSIZ], pcal_end[BUFSIZ];
|
||||
|
||||
(void)fputs ("\n# ==============", stream);
|
||||
(void)fputs ("\n# Recur. Apoints", stream);
|
||||
(void)fputs ("\n# ==============\n", stream);
|
||||
(void)fputs ("# (pcal does not support from..until dates specification\n",
|
||||
stream);
|
||||
fputs ("\n# ==============", stream);
|
||||
fputs ("\n# Recur. Apoints", stream);
|
||||
fputs ("\n# ==============\n", stream);
|
||||
fputs ("# (pcal does not support from..until dates specification\n", stream);
|
||||
|
||||
LLIST_TS_FOREACH (&recur_alist_p, i)
|
||||
{
|
||||
@ -569,25 +564,25 @@ pcal_export_recur_apoints (FILE *stream)
|
||||
{
|
||||
case RECUR_DAILY:
|
||||
date_sec2date_fmt (rapt->start, "%b %d", pcal_date);
|
||||
(void)fprintf (stream, "all day on_or_after %s (%s -> %s) %s\n",
|
||||
pcal_date, pcal_beg, pcal_end, rapt->mesg);
|
||||
fprintf (stream, "all day on_or_after %s (%s -> %s) %s\n",
|
||||
pcal_date, pcal_beg, pcal_end, rapt->mesg);
|
||||
break;
|
||||
case RECUR_WEEKLY:
|
||||
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);
|
||||
(void)fprintf (stream, "%s (%s -> %s) %s\n", pcal_date,
|
||||
pcal_beg, pcal_end, rapt->mesg);
|
||||
fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, pcal_beg,
|
||||
pcal_end, rapt->mesg);
|
||||
break;
|
||||
case RECUR_MONTHLY:
|
||||
date_sec2date_fmt (rapt->start, "%d", pcal_date);
|
||||
(void)fprintf (stream, "day on all %s (%s -> %s) %s\n",
|
||||
pcal_date, pcal_beg, pcal_end, rapt->mesg);
|
||||
fprintf (stream, "day on all %s (%s -> %s) %s\n", pcal_date,
|
||||
pcal_beg, pcal_end, rapt->mesg);
|
||||
break;
|
||||
case RECUR_YEARLY:
|
||||
date_sec2date_fmt (rapt->start, "%b %d", pcal_date);
|
||||
(void)fprintf (stream, "%s (%s -> %s) %s\n", pcal_date,
|
||||
pcal_beg, pcal_end, rapt->mesg);
|
||||
fprintf (stream, "%s (%s -> %s) %s\n", pcal_date, pcal_beg,
|
||||
pcal_end, rapt->mesg);
|
||||
break;
|
||||
default:
|
||||
EXIT (_("incoherent repetition type"));
|
||||
@ -618,13 +613,13 @@ ical_export_apoints (FILE *stream)
|
||||
{
|
||||
struct apoint *apt = LLIST_TS_GET_DATA (i);
|
||||
date_sec2date_fmt (apt->start, ICALDATETIMEFMT, ical_datetime);
|
||||
(void)fputs ("BEGIN:VEVENT\n", stream);
|
||||
(void)fprintf (stream, "DTSTART:%s\n", ical_datetime);
|
||||
(void)fprintf (stream, "DURATION:PT0H0M%ldS\n", apt->dur);
|
||||
(void)fprintf (stream, "SUMMARY:%s\n", apt->mesg);
|
||||
fputs ("BEGIN:VEVENT\n", stream);
|
||||
fprintf (stream, "DTSTART:%s\n", ical_datetime);
|
||||
fprintf (stream, "DURATION:PT0H0M%ldS\n", apt->dur);
|
||||
fprintf (stream, "SUMMARY:%s\n", apt->mesg);
|
||||
if (apt->state & APOINT_NOTIFY)
|
||||
ical_export_valarm (stream);
|
||||
(void)fputs ("END:VEVENT\n", stream);
|
||||
fputs ("END:VEVENT\n", stream);
|
||||
}
|
||||
LLIST_TS_UNLOCK (&alist_p);
|
||||
}
|
||||
@ -634,7 +629,7 @@ pcal_export_apoints (FILE *stream)
|
||||
{
|
||||
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_FOREACH (&alist_p, i)
|
||||
{
|
||||
@ -642,7 +637,7 @@ pcal_export_apoints (FILE *stream)
|
||||
pcal_dump_apoint (stream, apt->start, apt->dur, apt->mesg);
|
||||
}
|
||||
LLIST_TS_UNLOCK (&alist_p);
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
|
||||
/* Export todo items. */
|
||||
@ -657,10 +652,10 @@ ical_export_todo (FILE *stream)
|
||||
if (todo->id < 0) /* completed items */
|
||||
continue;
|
||||
|
||||
(void)fputs ("BEGIN:VTODO\n", stream);
|
||||
(void)fprintf (stream, "PRIORITY:%d\n", todo->id);
|
||||
(void)fprintf (stream, "SUMMARY:%s\n", todo->mesg);
|
||||
(void)fputs ("END:VTODO\n", stream);
|
||||
fputs ("BEGIN:VTODO\n", stream);
|
||||
fprintf (stream, "PRIORITY:%d\n", todo->id);
|
||||
fprintf (stream, "SUMMARY:%s\n", todo->mesg);
|
||||
fputs ("END:VTODO\n", stream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,17 +664,17 @@ pcal_export_todo (FILE *stream)
|
||||
{
|
||||
llist_item_t *i;
|
||||
|
||||
(void)fputs ("#\n# Todos\n#\n", stream);
|
||||
fputs ("#\n# Todos\n#\n", stream);
|
||||
LLIST_FOREACH (&todolist, i)
|
||||
{
|
||||
struct todo *todo = LLIST_TS_GET_DATA (i);
|
||||
if (todo->id < 0) /* completed items */
|
||||
continue;
|
||||
|
||||
(void)fputs ("note all ", stream);
|
||||
(void)fprintf (stream, "%d. %s\n", todo->id, todo->mesg);
|
||||
fputs ("note all ", stream);
|
||||
fprintf (stream, "%d. %s\n", todo->id, todo->mesg);
|
||||
}
|
||||
(void)fputc ('\n', stream);
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
|
||||
/* Append a line to a file. */
|
||||
@ -728,15 +723,15 @@ io_init (char *cfile, char *datadir)
|
||||
if (datadir != NULL)
|
||||
{
|
||||
home = datadir;
|
||||
(void)snprintf (path_dir, BUFSIZ, "%s", home);
|
||||
(void)snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH_NAME, home);
|
||||
(void)snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH_NAME, home);
|
||||
(void)snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR_NAME, home);
|
||||
(void)snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH_NAME, home);
|
||||
(void)snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH_NAME, home);
|
||||
(void)snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH_NAME, home);
|
||||
(void)snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH_NAME, home);
|
||||
(void)snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH_NAME, home);
|
||||
snprintf (path_dir, BUFSIZ, "%s", home);
|
||||
snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH_NAME, home);
|
||||
snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH_NAME, home);
|
||||
snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR_NAME, home);
|
||||
snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH_NAME, home);
|
||||
snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH_NAME, home);
|
||||
snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH_NAME, home);
|
||||
snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH_NAME, home);
|
||||
snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH_NAME, home);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,22 +740,22 @@ io_init (char *cfile, char *datadir)
|
||||
{
|
||||
home = ".";
|
||||
}
|
||||
(void)snprintf (path_dir, BUFSIZ, "%s/" DIR_NAME, home);
|
||||
(void)snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH, home);
|
||||
(void)snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH, home);
|
||||
(void)snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH, home);
|
||||
(void)snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH, home);
|
||||
(void)snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH, home);
|
||||
(void)snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH, home);
|
||||
(void)snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR, home);
|
||||
snprintf (path_dir, BUFSIZ, "%s/" DIR_NAME, home);
|
||||
snprintf (path_todo, BUFSIZ, "%s/" TODO_PATH, home);
|
||||
snprintf (path_conf, BUFSIZ, "%s/" CONF_PATH, home);
|
||||
snprintf (path_keys, BUFSIZ, "%s/" KEYS_PATH, home);
|
||||
snprintf (path_cpid, BUFSIZ, "%s/" CPID_PATH, home);
|
||||
snprintf (path_dpid, BUFSIZ, "%s/" DPID_PATH, home);
|
||||
snprintf (path_dmon_log, BUFSIZ, "%s/" DLOG_PATH, home);
|
||||
snprintf (path_notes, BUFSIZ, "%s/" NOTES_DIR, home);
|
||||
if (cfile == NULL)
|
||||
{
|
||||
(void)snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH, home);
|
||||
snprintf (path_apts, BUFSIZ, "%s/" APTS_PATH, home);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)snprintf (apts_file, BUFSIZ, "%s", cfile);
|
||||
(void)strncpy (path_apts, apts_file, BUFSIZ);
|
||||
snprintf (apts_file, BUFSIZ, "%s", cfile);
|
||||
strncpy (path_apts, apts_file, BUFSIZ);
|
||||
/* check if the file exists, otherwise create it */
|
||||
data_file = fopen (path_apts, "r");
|
||||
if (data_file == NULL)
|
||||
@ -860,119 +855,118 @@ io_save_conf (struct conf *conf)
|
||||
|
||||
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, "
|
||||
"automatic save is done when quitting\n", fp);
|
||||
(void)fputs ("auto_save=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->auto_save) ? "yes" : "no");
|
||||
fputs ("# If this option is set to yes, "
|
||||
"automatic save is done when quitting\n", fp);
|
||||
fputs ("auto_save=", fp);
|
||||
fprintf (fp, "%s\n", (conf->auto_save) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"the GC is run automatically when quitting\n", fp);
|
||||
(void)fputs ("auto_gc=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->auto_gc) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"the GC is run automatically when quitting\n", fp);
|
||||
fputs ("auto_gc=", fp);
|
||||
fprintf (fp, "%s\n", (conf->auto_gc) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If not null, perform automatic saves every "
|
||||
"'periodic_save' minutes\n", fp);
|
||||
(void)fputs ("periodic_save=", fp);
|
||||
(void)fprintf (fp, "%d\n", conf->periodic_save);
|
||||
fputs ("\n# If not null, perform automatic saves every "
|
||||
"'periodic_save' minutes\n", fp);
|
||||
fputs ("periodic_save=", fp);
|
||||
fprintf (fp, "%d\n", conf->periodic_save);
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"confirmation is required before quitting\n", fp);
|
||||
(void)fputs ("confirm_quit=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->confirm_quit) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"confirmation is required before quitting\n", fp);
|
||||
fputs ("confirm_quit=", fp);
|
||||
fprintf (fp, "%s\n", (conf->confirm_quit) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"confirmation is required before deleting an event\n", fp);
|
||||
(void)fputs ("confirm_delete=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->confirm_delete) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"confirmation is required before deleting an event\n", fp);
|
||||
fputs ("confirm_delete=", fp);
|
||||
fprintf (fp, "%s\n", (conf->confirm_delete) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, messages about loaded and "
|
||||
"saved data will not be displayed\n", fp);
|
||||
(void)fputs ("skip_system_dialogs=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->skip_system_dialogs) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, messages about loaded and "
|
||||
"saved data will not be displayed\n", fp);
|
||||
fputs ("skip_system_dialogs=", fp);
|
||||
fprintf (fp, "%s\n", (conf->skip_system_dialogs) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, progress bar appearing "
|
||||
"when saving data will not be displayed\n", fp);
|
||||
(void)fputs ("skip_progress_bar=", fp);
|
||||
(void)fprintf (fp, "%s\n", (conf->skip_progress_bar) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, progress bar appearing "
|
||||
"when saving data will not be displayed\n", fp);
|
||||
fputs ("skip_progress_bar=", fp);
|
||||
fprintf (fp, "%s\n", (conf->skip_progress_bar) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# Default calendar view (0)monthly (1)weekly:\n", fp);
|
||||
(void)fputs ("calendar_default_view=", fp);
|
||||
(void)fprintf (fp, "%d\n", calendar_get_view ());
|
||||
fputs ("\n# Default calendar view (0)monthly (1)weekly:\n", fp);
|
||||
fputs ("calendar_default_view=", fp);
|
||||
fprintf (fp, "%d\n", calendar_get_view ());
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"monday is the first day of the week, else it is sunday\n", fp);
|
||||
(void)fputs ("week_begins_on_monday=", fp);
|
||||
(void)fprintf (fp, "%s\n",
|
||||
(calendar_week_begins_on_monday ())? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"monday is the first day of the week, else it is sunday\n", fp);
|
||||
fputs ("week_begins_on_monday=", fp);
|
||||
fprintf (fp, "%s\n", (calendar_week_begins_on_monday ())? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# This is the color theme used for menus :\n", fp);
|
||||
(void)fputs ("color-theme=", fp);
|
||||
(void)fprintf (fp, "%s\n", theme_name);
|
||||
fputs ("\n# This is the color theme used for menus :\n", fp);
|
||||
fputs ("color-theme=", fp);
|
||||
fprintf (fp, "%s\n", theme_name);
|
||||
|
||||
(void)fputs ("\n# This is the layout of the calendar :\n", fp);
|
||||
(void)fputs ("layout=", fp);
|
||||
(void)fprintf (fp, "%d\n", wins_layout ());
|
||||
fputs ("\n# This is the layout of the calendar :\n", fp);
|
||||
fputs ("layout=", fp);
|
||||
fprintf (fp, "%d\n", wins_layout ());
|
||||
|
||||
(void)fputs ("\n# Width ( percentage, 0 being minimun width, fp) "
|
||||
"of the side bar :\n", fp);
|
||||
(void)fputs ("side-bar_width=", fp);
|
||||
(void)fprintf (fp, "%d\n", wins_sbar_wperc ());
|
||||
fputs ("\n# Width ( percentage, 0 being minimun width, fp) "
|
||||
"of the side bar :\n", fp);
|
||||
fputs ("side-bar_width=", fp);
|
||||
fprintf (fp, "%d\n", wins_sbar_wperc ());
|
||||
|
||||
if (ui_mode == UI_CURSES)
|
||||
pthread_mutex_lock (&nbar.mutex);
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"notify-bar will be displayed :\n", fp);
|
||||
(void)fputs ("notify-bar_show=", fp);
|
||||
(void)fprintf (fp, "%s\n", (nbar.show) ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"notify-bar will be displayed :\n", fp);
|
||||
fputs ("notify-bar_show=", fp);
|
||||
fprintf (fp, "%s\n", (nbar.show) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# Format of the date to be displayed inside notify-bar :\n", fp);
|
||||
(void)fputs ("notify-bar_date=", fp);
|
||||
(void)fprintf (fp, "%s\n", nbar.datefmt);
|
||||
fputs ("\n# Format of the date to be displayed inside notify-bar :\n", fp);
|
||||
fputs ("notify-bar_date=", fp);
|
||||
fprintf (fp, "%s\n", nbar.datefmt);
|
||||
|
||||
(void)fputs ("\n# Format of the time to be displayed inside notify-bar :\n", fp);
|
||||
(void)fputs ("notify-bar_clock=", fp);
|
||||
(void)fprintf (fp, "%s\n", nbar.timefmt);
|
||||
fputs ("\n# Format of the time to be displayed inside notify-bar :\n", fp);
|
||||
fputs ("notify-bar_clock=", fp);
|
||||
fprintf (fp, "%s\n", nbar.timefmt);
|
||||
|
||||
(void)fputs ("\n# Warn user if he has an appointment within next "
|
||||
"'notify-bar_warning' seconds :\n", fp);
|
||||
(void)fputs ("notify-bar_warning=", fp);
|
||||
(void)fprintf (fp, "%d\n", nbar.cntdwn);
|
||||
fputs ("\n# Warn user if he has an appointment within next "
|
||||
"'notify-bar_warning' seconds :\n", fp);
|
||||
fputs ("notify-bar_warning=", fp);
|
||||
fprintf (fp, "%d\n", nbar.cntdwn);
|
||||
|
||||
(void)fputs ("\n# Command used to notify user of "
|
||||
"an upcoming appointment :\n", fp);
|
||||
(void)fputs ("notify-bar_command=", fp);
|
||||
(void)fprintf (fp, "%s\n", nbar.cmd);
|
||||
fputs ("\n# Command used to notify user of "
|
||||
"an upcoming appointment :\n", fp);
|
||||
fputs ("notify-bar_command=", fp);
|
||||
fprintf (fp, "%s\n", nbar.cmd);
|
||||
|
||||
(void)fputs ("\n# Notify all appointments instead of flagged ones only\n", fp);
|
||||
(void)fputs ("notify-all=", fp);
|
||||
(void)fprintf (fp, "%s\n", (nbar.notify_all) ? "yes" : "no");
|
||||
fputs ("\n# Notify all appointments instead of flagged ones only\n", fp);
|
||||
fputs ("notify-all=", fp);
|
||||
fprintf (fp, "%s\n", (nbar.notify_all) ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# Format of the date to be displayed "
|
||||
"in non-interactive mode :\n", fp);
|
||||
(void)fputs ("output_datefmt=", fp);
|
||||
(void)fprintf (fp, "%s\n", conf->output_datefmt);
|
||||
fputs ("\n# Format of the date to be displayed "
|
||||
"in non-interactive mode :\n", fp);
|
||||
fputs ("output_datefmt=", fp);
|
||||
fprintf (fp, "%s\n", conf->output_datefmt);
|
||||
|
||||
(void)fputs ("\n# Format to be used when entering a date "
|
||||
"(1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd) "
|
||||
"(4)yyyy-mm-dd:\n", fp);
|
||||
(void)fputs ("input_datefmt=", fp);
|
||||
(void)fprintf (fp, "%d\n", conf->input_datefmt);
|
||||
fputs ("\n# Format to be used when entering a date "
|
||||
"(1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd) "
|
||||
"(4)yyyy-mm-dd:\n", fp);
|
||||
fputs ("input_datefmt=", fp);
|
||||
fprintf (fp, "%d\n", conf->input_datefmt);
|
||||
|
||||
if (ui_mode == UI_CURSES)
|
||||
pthread_mutex_unlock (&nbar.mutex);
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"calcurse will run in background to get notifications "
|
||||
"after exiting\n", fp);
|
||||
(void)fputs ("notify-daemon_enable=", fp);
|
||||
(void)fprintf (fp, "%s\n", dmon.enable ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"calcurse will run in background to get notifications "
|
||||
"after exiting\n", fp);
|
||||
fputs ("notify-daemon_enable=", fp);
|
||||
fprintf (fp, "%s\n", dmon.enable ? "yes" : "no");
|
||||
|
||||
(void)fputs ("\n# If this option is set to yes, "
|
||||
"activity will be logged when running in background\n", fp);
|
||||
(void)fputs ("notify-daemon_log=", fp);
|
||||
(void)fprintf (fp, "%s\n", dmon.log ? "yes" : "no");
|
||||
fputs ("\n# If this option is set to yes, "
|
||||
"activity will be logged when running in background\n", fp);
|
||||
fputs ("notify-daemon_log=", fp);
|
||||
fprintf (fp, "%s\n", dmon.log ? "yes" : "no");
|
||||
|
||||
file_close (fp, __FILE_POS__);
|
||||
|
||||
@ -1093,7 +1087,7 @@ io_save_cal (struct conf *conf, enum save_display display)
|
||||
&& display != IO_SAVE_DISPLAY_MARK)
|
||||
{
|
||||
status_mesg (save_success, enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock (&io_save_mutex);
|
||||
@ -1129,7 +1123,7 @@ io_load_app (void)
|
||||
c = getc (data_file);
|
||||
if (c == EOF)
|
||||
break;
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
|
||||
/* Read the date first: it is common to both events
|
||||
* and appointments.
|
||||
@ -1153,7 +1147,7 @@ io_load_app (void)
|
||||
{
|
||||
EXIT (_("no event nor appointment found"));
|
||||
}
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
|
||||
/* Read the remaining informations. */
|
||||
if (is_appointment)
|
||||
@ -1178,38 +1172,38 @@ io_load_app (void)
|
||||
|
||||
if (c == '{')
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
is_recursive = 1;
|
||||
fscanf (data_file, "{ %d%c ", &freq, &type);
|
||||
|
||||
c = getc (data_file);
|
||||
if (c == '}')
|
||||
{ /* endless recurrent item */
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
fscanf (data_file, "} ");
|
||||
until.tm_year = 0;
|
||||
}
|
||||
else if (c == '-')
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
fscanf (data_file, " -> %u / %u / %u ",
|
||||
&until.tm_mon, &until.tm_mday, &until.tm_year);
|
||||
c = getc (data_file);
|
||||
if (c == '!')
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
recur_exc_scan (&exc, data_file);
|
||||
c = getc (data_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
fscanf (data_file, "} ");
|
||||
}
|
||||
}
|
||||
else if (c == '!')
|
||||
{ // endless item with exceptions
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
recur_exc_scan (&exc, data_file);
|
||||
c = getc (data_file);
|
||||
until.tm_year = 0;
|
||||
@ -1221,7 +1215,7 @@ io_load_app (void)
|
||||
}
|
||||
}
|
||||
else
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
|
||||
/* Check if a note is attached to the item. */
|
||||
c = getc (data_file);
|
||||
@ -1233,7 +1227,7 @@ io_load_app (void)
|
||||
else
|
||||
{
|
||||
notep = NULL;
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1245,13 +1239,13 @@ io_load_app (void)
|
||||
c = getc (data_file);
|
||||
if (c == '!')
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
fscanf (data_file, " ! ");
|
||||
state |= APOINT_NOTIFY;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
fscanf (data_file, " | ");
|
||||
state = 0L;
|
||||
}
|
||||
@ -1302,7 +1296,7 @@ io_load_todo (void)
|
||||
if (data_file == NULL)
|
||||
{
|
||||
status_mesg (mesg_line1, mesg_line2);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
@ -1318,7 +1312,7 @@ io_load_todo (void)
|
||||
else
|
||||
{
|
||||
id = 9;
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
}
|
||||
/* Now read the attached note, if any. */
|
||||
c = getc (data_file);
|
||||
@ -1327,7 +1321,7 @@ io_load_todo (void)
|
||||
else
|
||||
note[0] = '\0';
|
||||
/* Then read todo description. */
|
||||
(void)fgets (buf, sizeof buf, data_file);
|
||||
fgets (buf, sizeof buf, data_file);
|
||||
newline = strchr (buf, '\n');
|
||||
if (newline)
|
||||
*newline = '\0';
|
||||
@ -1521,8 +1515,8 @@ io_check_dir (char *dir, int *missing)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
(void)fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"),
|
||||
dir, strerror (errno));
|
||||
fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), dir,
|
||||
strerror (errno));
|
||||
exit_calcurse (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -1544,7 +1538,7 @@ io_file_exist (char *file)
|
||||
if ((fd = fopen (file, "r")) == NULL)
|
||||
return 0;
|
||||
|
||||
(void)fclose (fd);
|
||||
fclose (fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1561,8 +1555,8 @@ io_check_file (char *file, int *missing)
|
||||
(*missing)++;
|
||||
if ((fd = fopen (file, "w")) == NULL)
|
||||
{
|
||||
(void)fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"),
|
||||
file, strerror (errno));
|
||||
fprintf (stderr, _("FATAL ERROR: could not create %s: %s\n"), file,
|
||||
strerror (errno));
|
||||
exit_calcurse (EXIT_FAILURE);
|
||||
}
|
||||
file_close (fd, __FILE_POS__);
|
||||
@ -1615,12 +1609,12 @@ io_startup_screen (unsigned skip_dialogs, int no_data_file)
|
||||
if (no_data_file != 0)
|
||||
{
|
||||
status_mesg (welcome_mesg, enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
else if (!skip_dialogs)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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";
|
||||
|
||||
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"));
|
||||
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
|
||||
@ -2287,7 +2281,7 @@ ical_read_exdate (llist_t *exc, FILE *log, char *exstr, unsigned *noskipped,
|
||||
char buf[BUFSIZ];
|
||||
const int buflen = q - p;
|
||||
|
||||
(void)strncpy (buf, p, buflen);
|
||||
strncpy (buf, p, buflen);
|
||||
buf[buflen] = '\0';
|
||||
date = ical_datetime2long (buf, NULL);
|
||||
ical_add_exc (exc, date);
|
||||
@ -2332,11 +2326,11 @@ ical_read_note (char *line, unsigned *noskipped, ical_vevent_e item_type,
|
||||
else
|
||||
{
|
||||
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");
|
||||
EXIT_IF (fdo == NULL, _("Warning: could not open %s, Aborting..."),
|
||||
fullnotename);
|
||||
(void)fprintf (fdo, "%s", notestr);
|
||||
fprintf (fdo, "%s", notestr);
|
||||
file_close (fdo, __FILE_POS__);
|
||||
mem_free (notestr);
|
||||
return sha1;
|
||||
@ -2683,7 +2677,7 @@ get_import_stream (enum export_type type)
|
||||
if (stream == NULL)
|
||||
{
|
||||
status_mesg (wrong_file, press_enter);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
}
|
||||
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];
|
||||
|
||||
(void)snprintf (read, BUFSIZ, proc_report, stats.lines);
|
||||
(void)snprintf (stat, BUFSIZ, "%s / %s / %s / %s (%s)", stats_str[0],
|
||||
stats_str[1], stats_str[2], stats_str[3],
|
||||
_("Press [ENTER] to continue"));
|
||||
snprintf (read, BUFSIZ, proc_report, stats.lines);
|
||||
snprintf (stat, BUFSIZ, "%s / %s / %s / %s (%s)", stats_str[0],
|
||||
stats_str[1], stats_str[2], stats_str[3],
|
||||
_("Press [ENTER] to continue"));
|
||||
status_mesg (read, stat);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
else if (ui_mode == UI_CMDLINE)
|
||||
{
|
||||
@ -2819,7 +2813,7 @@ io_log_init (void)
|
||||
log = mem_malloc (sizeof (struct io_file));
|
||||
RETVAL_IF (log == NULL, 0,
|
||||
_("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);
|
||||
log->fd = fopen (log->name, "w");
|
||||
if (log->fd == NULL)
|
||||
@ -2836,7 +2830,7 @@ void
|
||||
io_log_print (struct io_file *log, int line, char *msg)
|
||||
{
|
||||
if (log && log->fd)
|
||||
(void)fprintf (log->fd, "line %d: %s\n", line, msg);
|
||||
fprintf (log->fd, "line %d: %s\n", line, msg);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2854,8 +2848,8 @@ io_log_display (struct io_file *log, char *msg, char *pager)
|
||||
{
|
||||
char cmd[BUFSIZ];
|
||||
|
||||
(void)snprintf (cmd, BUFSIZ, "%s %s", pager, log->name);
|
||||
(void)system (cmd);
|
||||
snprintf (cmd, BUFSIZ, "%s %s", pager, log->name);
|
||||
system (cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2900,7 +2894,7 @@ io_psave_thread (void *arg)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
(void)sleep (delay * MININSEC);
|
||||
sleep (delay * MININSEC);
|
||||
io_save_cal (config, IO_SAVE_DISPLAY_MARK);
|
||||
}
|
||||
}
|
||||
@ -2952,12 +2946,12 @@ io_set_lock (void)
|
||||
|
||||
if (lock != NULL)
|
||||
{
|
||||
(void)fprintf (stderr,
|
||||
_("\nWARNING: it seems that another calcurse instance is "
|
||||
"already running.\n"
|
||||
"If this is not the case, please remove the following "
|
||||
"lock file: \n\"%s\"\n"
|
||||
"and restart calcurse.\n"), path_cpid);
|
||||
fprintf (stderr,
|
||||
_("\nWARNING: it seems that another calcurse instance is "
|
||||
"already running.\n"
|
||||
"If this is not the case, please remove the following "
|
||||
"lock file: \n\"%s\"\n"
|
||||
"and restart calcurse.\n"), path_cpid);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
@ -3010,7 +3004,7 @@ io_get_pid (char *file)
|
||||
if (fscanf (fp, "%u", &pid) != 1)
|
||||
return 0;
|
||||
|
||||
(void)fclose (fp);
|
||||
fclose (fp);
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
29
src/keys.c
29
src/keys.c
@ -125,7 +125,7 @@ dump_intro (FILE *fd)
|
||||
"# A description of what each ACTION keyword is used for is available\n"
|
||||
"# from calcurse online configuration menu.\n");
|
||||
|
||||
(void)fprintf (fd, "%s\n", intro);
|
||||
fprintf (fd, "%s\n", intro);
|
||||
}
|
||||
|
||||
void
|
||||
@ -171,7 +171,7 @@ keys_dump_defaults (char *file)
|
||||
|
||||
dump_intro (fd);
|
||||
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__);
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ del_key_str (enum key action, int key)
|
||||
if (action < 0 || action > NBKEYS)
|
||||
return;
|
||||
|
||||
(void)strncpy (oldstr, keys_int2str (key), BUFSIZ);
|
||||
strncpy (oldstr, keys_int2str (key), BUFSIZ);
|
||||
for (i = &keys[action]; *i; i = &(*i)->next)
|
||||
{
|
||||
if (!strcmp ((*i)->str, oldstr))
|
||||
@ -423,8 +423,8 @@ keys_action_allkeys (enum key action)
|
||||
for (i = keys[action]; i; i = i->next)
|
||||
{
|
||||
const int MAXLEN = sizeof (keystr) - 1 - strlen (keystr);
|
||||
(void)strncat (keystr, i->str, MAXLEN - 1);
|
||||
(void)strncat (keystr, CHAR_SPACE, 1);
|
||||
strncat (keystr, i->str, MAXLEN - 1);
|
||||
strncat (keystr, CHAR_SPACE, 1);
|
||||
}
|
||||
|
||||
return keystr;
|
||||
@ -444,18 +444,18 @@ keys_format_label (char *key, int keylen)
|
||||
|
||||
bzero (fmtkey, sizeof (fmtkey));
|
||||
if (len == 0)
|
||||
(void)strncpy (fmtkey, "?", sizeof (fmtkey));
|
||||
strncpy (fmtkey, "?", sizeof (fmtkey));
|
||||
else if (len <= keylen)
|
||||
{
|
||||
for (i = 0; i < keylen - len; i++)
|
||||
fmtkey[i] = ' ';
|
||||
(void)strncat (fmtkey, key, keylen);
|
||||
strncat (fmtkey, key, keylen);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < keylen - 1; i++)
|
||||
fmtkey[i] = key[i];
|
||||
(void)strncat (fmtkey, dot, strlen (dot));
|
||||
strncat (fmtkey, dot, strlen (dot));
|
||||
}
|
||||
return fmtkey;
|
||||
}
|
||||
@ -479,15 +479,14 @@ keys_display_bindings_bar (WINDOW *win, struct binding **binding, int first_key,
|
||||
const int KEY_POS = j * cmdlen;
|
||||
const int LABEL_POS = j * cmdlen + KEYS_KEYLEN + 1;
|
||||
|
||||
(void)strncpy (key, keys_action_firstkey (binding[i]->action),
|
||||
KEYS_KEYLEN);
|
||||
strncpy (key, keys_action_firstkey (binding[i]->action), KEYS_KEYLEN);
|
||||
fmtkey = keys_format_label (key, KEYS_KEYLEN);
|
||||
custom_apply_attr (win, ATTR_HIGHEST);
|
||||
mvwprintw (win, 0, KEY_POS, fmtkey);
|
||||
if (i + 1 != last_key)
|
||||
{
|
||||
(void)strncpy (key, keys_action_firstkey (binding[i + 1]->action),
|
||||
KEYS_KEYLEN);
|
||||
strncpy (key, keys_action_firstkey (binding[i + 1]->action),
|
||||
KEYS_KEYLEN);
|
||||
key[KEYS_KEYLEN] = 0;
|
||||
fmtkey = keys_format_label (key, KEYS_KEYLEN);
|
||||
mvwprintw (win, 1, KEY_POS, fmtkey);
|
||||
@ -601,7 +600,7 @@ keys_popup_info (enum key key)
|
||||
#define WINCOL (col - 4)
|
||||
infowin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2,
|
||||
keydef[key].label, info[key], 1);
|
||||
(void)keys_getch (infowin, NULL);
|
||||
keys_getch (infowin, NULL);
|
||||
delwin (infowin);
|
||||
#undef WINROW
|
||||
#undef WINCOL
|
||||
@ -615,7 +614,7 @@ keys_save_bindings (FILE *fd)
|
||||
EXIT_IF (fd == NULL, _("FATAL ERROR: null file pointer."));
|
||||
dump_intro (fd);
|
||||
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
|
||||
@ -642,7 +641,7 @@ keys_fill_missing (void)
|
||||
{
|
||||
char *p, tmpbuf[BUFSIZ];
|
||||
|
||||
(void)strncpy (tmpbuf, keydef[i].binding, BUFSIZ);
|
||||
strncpy (tmpbuf, keydef[i].binding, BUFSIZ);
|
||||
p = tmpbuf;
|
||||
for (;;)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ view_note (char *note, char *pager)
|
||||
|
||||
if (note == NULL)
|
||||
return;
|
||||
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, note);
|
||||
snprintf (fullname, BUFSIZ, "%s%s", path_notes, note);
|
||||
wins_launch_external (fullname, pager);
|
||||
}
|
||||
|
||||
|
43
src/notify.c
43
src/notify.c
@ -126,18 +126,17 @@ notify_init_vars (void)
|
||||
pthread_mutex_init (&nbar.mutex, NULL);
|
||||
nbar.show = 1;
|
||||
nbar.cntdwn = 300;
|
||||
(void)strncpy (nbar.datefmt, date_format, strlen (date_format) + 1);
|
||||
(void)strncpy (nbar.timefmt, time_format, strlen (time_format) + 1);
|
||||
(void)strncpy (nbar.cmd, cmd, strlen (cmd) + 1);
|
||||
strncpy (nbar.datefmt, date_format, strlen (date_format) + 1);
|
||||
strncpy (nbar.timefmt, time_format, strlen (time_format) + 1);
|
||||
strncpy (nbar.cmd, cmd, strlen (cmd) + 1);
|
||||
|
||||
if ((nbar.shell = getenv ("SHELL")) == NULL)
|
||||
nbar.shell = "/bin/sh";
|
||||
|
||||
nbar.notify_all = 0;
|
||||
|
||||
(void)pthread_attr_init (&detached_thread_attr);
|
||||
(void)pthread_attr_setdetachstate (&detached_thread_attr,
|
||||
PTHREAD_CREATE_DETACHED);
|
||||
pthread_attr_init (&detached_thread_attr);
|
||||
pthread_attr_setdetachstate (&detached_thread_attr, PTHREAD_CREATE_DETACHED);
|
||||
}
|
||||
|
||||
/* Extract the appointment file name from the complete file path. */
|
||||
@ -272,7 +271,7 @@ notify_update_bar (void)
|
||||
|
||||
too_long = 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';
|
||||
}
|
||||
time_left = notify_time_left ();
|
||||
@ -303,7 +302,7 @@ notify_update_bar (void)
|
||||
wattroff (notify.win, A_BLINK);
|
||||
|
||||
if (blinking)
|
||||
(void)notify_launch_cmd ();
|
||||
notify_launch_cmd ();
|
||||
pthread_mutex_unlock (&nbar.mutex);
|
||||
}
|
||||
else
|
||||
@ -379,8 +378,8 @@ notify_get_next (struct notify_app *a)
|
||||
a->got_app = 0;
|
||||
a->state = 0;
|
||||
a->txt = (char *)0;
|
||||
(void)recur_apoint_check_next (a, current_time, get_today ());
|
||||
(void)apoint_check_next (a, current_time);
|
||||
recur_apoint_check_next (a, current_time, get_today ());
|
||||
apoint_check_next (a, current_time);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -605,7 +604,7 @@ print_option (WINDOW *win, unsigned x, unsigned y, char *name,
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
||||
(void)strncpy (buf, valstr, maxlen - 1);
|
||||
strncpy (buf, valstr, maxlen - 1);
|
||||
buf[maxlen - 1] = '\0';
|
||||
mvwprintw (win, y, x_opt, "%s...", buf);
|
||||
}
|
||||
@ -665,10 +664,10 @@ print_config_options (WINDOW *optwin)
|
||||
pthread_mutex_lock (&nbar.mutex);
|
||||
|
||||
/* String value options */
|
||||
(void)strncpy (opt[DATE].valstr, nbar.datefmt, BUFSIZ);
|
||||
(void)strncpy (opt[CLOCK].valstr, nbar.timefmt, BUFSIZ);
|
||||
(void)snprintf (opt[WARN].valstr, BUFSIZ, "%d", nbar.cntdwn);
|
||||
(void)strncpy (opt[CMD].valstr, nbar.cmd, BUFSIZ);
|
||||
strncpy (opt[DATE].valstr, nbar.datefmt, BUFSIZ);
|
||||
strncpy (opt[CLOCK].valstr, nbar.timefmt, BUFSIZ);
|
||||
snprintf (opt[WARN].valstr, BUFSIZ, "%d", nbar.cntdwn);
|
||||
strncpy (opt[CMD].valstr, nbar.cmd, BUFSIZ);
|
||||
|
||||
/* Boolean options */
|
||||
opt[SHOW].valnum = nbar.show;
|
||||
@ -727,7 +726,7 @@ notify_config_bar (void)
|
||||
|
||||
clear ();
|
||||
custom_set_swsiz (&cwin);
|
||||
(void)strncpy (cwin.label, _("notification options"), BUFSIZ);
|
||||
strncpy (cwin.label, _("notification options"), BUFSIZ);
|
||||
wins_scrollwin_init (&cwin);
|
||||
wins_show (cwin.win.p, cwin.label);
|
||||
status_mesg (number_str, keys);
|
||||
@ -761,24 +760,24 @@ notify_config_bar (void)
|
||||
case '2':
|
||||
status_mesg (date_str, "");
|
||||
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);
|
||||
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
break;
|
||||
case '3':
|
||||
status_mesg (time_str, "");
|
||||
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);
|
||||
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
break;
|
||||
@ -798,12 +797,12 @@ notify_config_bar (void)
|
||||
case '5':
|
||||
status_mesg (cmd_str, "");
|
||||
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);
|
||||
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
98
src/recur.c
98
src/recur.c
@ -360,7 +360,7 @@ recur_write_exc (llist_t *lexc, FILE *f)
|
||||
st_mon = lt->tm_mon + 1;
|
||||
st_day = lt->tm_mday;
|
||||
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;
|
||||
|
||||
/* Read the appointment description */
|
||||
(void)fgets (buf, sizeof buf, f);
|
||||
fgets (buf, sizeof buf, f);
|
||||
nl = strchr (buf, '\n');
|
||||
if (nl)
|
||||
{
|
||||
@ -419,7 +419,7 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
|
||||
time_t tstart, tuntil;
|
||||
|
||||
/* Read the event description */
|
||||
(void)fgets (buf, sizeof buf, f);
|
||||
fgets (buf, sizeof buf, f);
|
||||
nl = strchr (buf, '\n');
|
||||
if (nl)
|
||||
{
|
||||
@ -458,37 +458,35 @@ recur_apoint_write (struct recur_apoint *o, FILE *f)
|
||||
|
||||
t = o->start;
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, "%02u/%02u/%04u @ %02u:%02u",
|
||||
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year,
|
||||
lt->tm_hour, lt->tm_min);
|
||||
fprintf (f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
|
||||
|
||||
t = o->start + o->dur;
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u",
|
||||
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year,
|
||||
lt->tm_hour, lt->tm_min);
|
||||
fprintf (f, " -> %02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year, lt->tm_hour, lt->tm_min);
|
||||
|
||||
t = o->rpt->until;
|
||||
if (t == 0)
|
||||
{ /* 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
|
||||
{
|
||||
lt = localtime (&t);
|
||||
(void)fprintf (f, " {%d%c -> %02u/%02u/%04u",
|
||||
o->rpt->freq, recur_def2char (o->rpt->type),
|
||||
lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year);
|
||||
fprintf (f, " {%d%c -> %02u/%02u/%04u", o->rpt->freq,
|
||||
recur_def2char (o->rpt->type), lt->tm_mon + 1, lt->tm_mday,
|
||||
1900 + lt->tm_year);
|
||||
}
|
||||
recur_write_exc (&o->exc, f);
|
||||
(void)fputs ("} ", f);
|
||||
fputs ("} ", f);
|
||||
if (o->note != NULL)
|
||||
(void)fprintf (f, ">%s ", o->note);
|
||||
fprintf (f, ">%s ", o->note);
|
||||
if (o->state & APOINT_NOTIFY)
|
||||
(void)fputc ('!', f);
|
||||
fputc ('!', f);
|
||||
else
|
||||
(void)fputc ('|', f);
|
||||
(void)fprintf (f, "%s\n", o->mesg);
|
||||
fputc ('|', f);
|
||||
fprintf (f, "%s\n", o->mesg);
|
||||
}
|
||||
|
||||
/* Writting of a recursive event into file. */
|
||||
@ -508,9 +506,8 @@ recur_event_write (struct recur_event *o, FILE *f)
|
||||
t = o->rpt->until;
|
||||
if (t == 0)
|
||||
{ /* We have an endless recurrent event. */
|
||||
(void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c",
|
||||
st_mon, st_day, st_year, o->id, o->rpt->freq,
|
||||
recur_def2char (o->rpt->type));
|
||||
fprintf (f, "%02u/%02u/%04u [%d] {%d%c", st_mon, st_day, st_year, o->id,
|
||||
o->rpt->freq, recur_def2char (o->rpt->type));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -518,16 +515,15 @@ recur_event_write (struct recur_event *o, FILE *f)
|
||||
end_mon = lt->tm_mon + 1;
|
||||
end_day = lt->tm_mday;
|
||||
end_year = lt->tm_year + 1900;
|
||||
(void)fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u",
|
||||
st_mon, st_day, st_year, o->id,
|
||||
o->rpt->freq, recur_def2char (o->rpt->type),
|
||||
end_mon, end_day, end_year);
|
||||
fprintf (f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u", st_mon,
|
||||
st_day, st_year, o->id, o->rpt->freq,
|
||||
recur_def2char (o->rpt->type), end_mon, end_day, end_year);
|
||||
}
|
||||
recur_write_exc (&o->exc, f);
|
||||
(void)fputs ("} ", f);
|
||||
fputs ("} ", f);
|
||||
if (o->note != NULL)
|
||||
(void)fprintf (f, ">%s ", o->note);
|
||||
(void)fprintf (f, "%s\n", o->mesg);
|
||||
fprintf (f, ">%s ", o->note);
|
||||
fprintf (f, "%s\n", o->mesg);
|
||||
}
|
||||
|
||||
/* Write recursive items to file. */
|
||||
@ -899,7 +895,7 @@ recur_repeat_item (struct conf *conf)
|
||||
if (p->type != APPT && p->type != EVNT)
|
||||
{
|
||||
status_mesg (wrong_type_1, wrong_type_2);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -928,7 +924,7 @@ recur_repeat_item (struct conf *conf)
|
||||
if (freq == 0)
|
||||
{
|
||||
status_mesg (mesg_wrong_freq, wrong_type_2);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
}
|
||||
user_input[0] = '\0';
|
||||
}
|
||||
@ -938,8 +934,8 @@ recur_repeat_item (struct conf *conf)
|
||||
|
||||
while (!date_entered)
|
||||
{
|
||||
(void)snprintf (outstr, BUFSIZ, mesg_until_1,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ, mesg_until_1,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
status_mesg (_(outstr), "");
|
||||
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)
|
||||
{
|
||||
status_mesg (mesg_older, wrong_type_2);
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
date_entered = 0;
|
||||
}
|
||||
else
|
||||
@ -972,10 +968,10 @@ recur_repeat_item (struct conf *conf)
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)snprintf (outstr, BUFSIZ, mesg_wrong_2,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
snprintf (outstr, BUFSIZ, mesg_wrong_2,
|
||||
DATEFMT_DESC (conf->input_datefmt));
|
||||
status_mesg (mesg_wrong_1, _(outstr));
|
||||
(void)wgetch (win[STA].p);
|
||||
wgetch (win[STA].p);
|
||||
date_entered = 0;
|
||||
}
|
||||
}
|
||||
@ -987,8 +983,8 @@ recur_repeat_item (struct conf *conf)
|
||||
date = calendar_get_slctd_day_sec ();
|
||||
if (p->type == EVNT)
|
||||
{
|
||||
(void)recur_event_new (p->mesg, p->note, p->start, p->evnt_id,
|
||||
type, freq, until, NULL);
|
||||
recur_event_new (p->mesg, p->note, p->start, p->evnt_id, type, freq,
|
||||
until, NULL);
|
||||
}
|
||||
else if (p->type == APPT)
|
||||
{
|
||||
@ -1018,7 +1014,7 @@ recur_exc_scan (llist_t *lexc, FILE *data_file)
|
||||
LLIST_INIT (lexc);
|
||||
while ((c = getc (data_file)) == '!')
|
||||
{
|
||||
(void)ungetc (c, data_file);
|
||||
ungetc (c, data_file);
|
||||
if (fscanf (data_file, "!%u / %u / %u ",
|
||||
&day.tm_mon, &day.tm_mday, &day.tm_year) != 3)
|
||||
{
|
||||
@ -1137,12 +1133,11 @@ recur_event_paste_item (void)
|
||||
exc->st += time_shift;
|
||||
}
|
||||
|
||||
(void)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.rpt->type,
|
||||
bkp_cut_recur_event.rpt->freq,
|
||||
bkp_cut_recur_event.rpt->until,
|
||||
&bkp_cut_recur_event.exc);
|
||||
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.rpt->type,
|
||||
bkp_cut_recur_event.rpt->freq,
|
||||
bkp_cut_recur_event.rpt->until, &bkp_cut_recur_event.exc);
|
||||
recur_event_free_bkp ();
|
||||
}
|
||||
|
||||
@ -1166,13 +1161,12 @@ recur_apoint_paste_item (void)
|
||||
exc->st += time_shift;
|
||||
}
|
||||
|
||||
(void)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.state,
|
||||
bkp_cut_recur_apoint.rpt->type,
|
||||
bkp_cut_recur_apoint.rpt->freq,
|
||||
bkp_cut_recur_apoint.rpt->until,
|
||||
&bkp_cut_recur_apoint.exc);
|
||||
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.state, bkp_cut_recur_apoint.rpt->type,
|
||||
bkp_cut_recur_apoint.rpt->freq,
|
||||
bkp_cut_recur_apoint.rpt->until,
|
||||
&bkp_cut_recur_apoint.exc);
|
||||
|
||||
if (notify_bar ())
|
||||
notify_check_repeated (&bkp_cut_recur_apoint);
|
||||
|
@ -61,7 +61,7 @@ generic_hdlr (int sig)
|
||||
case SIGWINCH:
|
||||
resize = 1;
|
||||
clearok (curscr, TRUE);
|
||||
(void)ungetch (KEY_RESIZE);
|
||||
ungetch (KEY_RESIZE);
|
||||
break;
|
||||
case SIGTERM:
|
||||
if (unlink (path_cpid) != 0)
|
||||
|
@ -187,9 +187,9 @@ void
|
||||
todo_write (struct todo *todo, FILE *f)
|
||||
{
|
||||
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
|
||||
(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. */
|
||||
@ -338,10 +338,10 @@ todo_chg_priority (int action)
|
||||
int do_chg = 1;
|
||||
|
||||
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;
|
||||
if (backup->note)
|
||||
(void)strncpy (backup_note, backup->note, MAX_NOTESIZ + 1);
|
||||
strncpy (backup_note, backup->note, MAX_NOTESIZ + 1);
|
||||
else
|
||||
backup_note[0] = '\0';
|
||||
switch (action)
|
||||
|
18
src/utils.c
18
src/utils.c
@ -115,7 +115,7 @@ fatalbox (const char *errmsg)
|
||||
if (errmsg == NULL)
|
||||
return;
|
||||
|
||||
(void)strncpy (msg, errmsg, MSGLEN);
|
||||
strncpy (msg, errmsg, MSGLEN);
|
||||
errwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2);
|
||||
custom_apply_attr (errwin, ATTR_HIGHEST);
|
||||
box (errwin, 0, 0);
|
||||
@ -124,7 +124,7 @@ fatalbox (const char *errmsg)
|
||||
mvwprintw (errwin, 5, (WINCOL - strlen (msg)) / 2, "%s", msg);
|
||||
custom_remove_attr (errwin, ATTR_HIGHEST);
|
||||
wins_wrefresh (errwin);
|
||||
(void)wgetch (errwin);
|
||||
wgetch (errwin);
|
||||
delwin (errwin);
|
||||
wins_doupdate ();
|
||||
}
|
||||
@ -142,7 +142,7 @@ warnbox (const char *msg)
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
||||
(void)strncpy (displmsg, msg, MSGLEN);
|
||||
strncpy (displmsg, msg, MSGLEN);
|
||||
warnwin = newwin (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2);
|
||||
custom_apply_attr (warnwin, ATTR_HIGHEST);
|
||||
box (warnwin, 0, 0);
|
||||
@ -150,7 +150,7 @@ warnbox (const char *msg)
|
||||
mvwprintw (warnwin, 5, (WINCOL - strlen (displmsg)) / 2, "%s", displmsg);
|
||||
custom_remove_attr (warnwin, ATTR_HIGHEST);
|
||||
wins_wrefresh (warnwin);
|
||||
(void)wgetch (warnwin);
|
||||
wgetch (warnwin);
|
||||
delwin (warnwin);
|
||||
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);
|
||||
custom_apply_attr (popup_win, ATTR_HIGHEST);
|
||||
box (popup_win, 0, 0);
|
||||
(void)snprintf (label, BUFSIZ, "%s", title);
|
||||
snprintf (label, BUFSIZ, "%s", title);
|
||||
wins_show (popup_win, label);
|
||||
if (hint)
|
||||
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));
|
||||
|
||||
if (sec == 0)
|
||||
(void)strncpy (datestr, "0", BUFSIZ);
|
||||
strncpy (datestr, "0", BUFSIZ);
|
||||
else
|
||||
{
|
||||
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);
|
||||
pnoutrefresh (pad, 0, 0, margin_top + 2, margin_left, padl, winw);
|
||||
wins_doupdate ();
|
||||
(void)wgetch (popup_win);
|
||||
wgetch (popup_win);
|
||||
delwin (pad);
|
||||
delwin (popup_win);
|
||||
}
|
||||
@ -466,7 +466,7 @@ nowstr (void)
|
||||
static char buf[BUFSIZ];
|
||||
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;
|
||||
}
|
||||
@ -547,7 +547,7 @@ new_tempfile (const char *prefix, int trailing_len)
|
||||
if (prefix_len + trailing_len >= BUFSIZ)
|
||||
return (NULL);
|
||||
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';
|
||||
if ((fd = mkstemp (fullname)) == -1 || (file = fdopen (fd, "w+")) == NULL)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ vars_init (struct conf *conf)
|
||||
conf->periodic_save = 0;
|
||||
conf->skip_system_dialogs = 0;
|
||||
conf->skip_progress_bar = 0;
|
||||
(void)strncpy (conf->output_datefmt, "%D", 3);
|
||||
strncpy (conf->output_datefmt, "%D", 3);
|
||||
conf->input_datefmt = 1;
|
||||
|
||||
/* Default external editor and pager */
|
||||
|
@ -75,7 +75,7 @@ screen_acquire (void)
|
||||
static void
|
||||
screen_release (void)
|
||||
{
|
||||
(void)pthread_mutex_unlock (&screen_mutex);
|
||||
pthread_mutex_unlock (&screen_mutex);
|
||||
}
|
||||
|
||||
int
|
||||
@ -227,17 +227,17 @@ wins_init_panels (void)
|
||||
char label[BUFSIZ];
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
apad.width = win[APP].w - 3;
|
||||
apad.ptrwin = newpad (apad.length, apad.width);
|
||||
|
||||
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);
|
||||
|
||||
/* Enable function keys (i.e. arrow keys) in those windows */
|
||||
|
Loading…
x
Reference in New Issue
Block a user