aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2012-05-28 04:50:37 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-31 20:30:46 +0200
commit72995601e791ba0c2e990a601752482f3e45aa74 (patch)
tree33f09bb7abce2c872e517bd56e9276d029ac9cca
parent4b58b0938f0bd7139cc51720c74e1149c338187e (diff)
downloadcalcurse-72995601e791ba0c2e990a601752482f3e45aa74.tar.gz
calcurse-72995601e791ba0c2e990a601752482f3e45aa74.zip
Directly use fprintf() where applicable
For some reasons, we were using snprintf() to format a string into a buffer, and then displaying this buffer to stdout using fputs(). That's exactly what fprintf() is here for, so use it. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/args.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/args.c b/src/args.c
index a569e2a..36401bc 100644
--- a/src/args.c
+++ b/src/args.c
@@ -238,7 +238,6 @@ static void next_arg(void)
struct notify_app next_app;
const long current_time = now();
int time_left, hours_left, min_left;
- char mesg[BUFSIZ];
next_app.time = current_time + DAYINSEC;
next_app.got_app = 0;
@@ -252,9 +251,8 @@ static void next_arg(void)
hours_left = (time_left / HOURINSEC);
min_left = (time_left - hours_left * HOURINSEC) / MININSEC;
fputs(_("next appointment:\n"), stdout);
- snprintf(mesg, BUFSIZ, " [%02d:%02d] %s\n", hours_left, min_left,
- next_app.txt);
- fputs(mesg, stdout);
+ fprintf(stdout, " [%02d:%02d] %s\n", hours_left, min_left,
+ next_app.txt);
mem_free(next_app.txt);
}
}
@@ -480,12 +478,9 @@ date_arg(const char *ddate, int add_line, const char *fmt_apt,
(int *)&day.mm, (int *)&day.dd, NULL)) {
app_arg(add_line, &day, 0, fmt_apt, fmt_rapt, fmt_ev, fmt_rev, regex);
} else {
- char outstr[BUFSIZ];
fputs(_("Argument to the '-d' flag is not valid\n"), stderr);
- snprintf(outstr, BUFSIZ,
- _("Possible argument format are: '%s' or 'n'\n"),
+ fprintf(stdout, _("Possible argument format are: '%s' or 'n'\n"),
DATEFMT_DESC(conf.input_datefmt));
- fputs(outstr, stdout);
more_info();
}
}
@@ -536,12 +531,9 @@ date_arg_extended(const char *startday, const char *range, int add_line,
display_app(&t, numdays, add_line, fmt_apt, fmt_rapt, fmt_ev, fmt_rev,
regex);
} else {
- char outstr[BUFSIZ];
fputs(_("Argument is not valid\n"), stderr);
- snprintf(outstr, BUFSIZ,
- _("Argument format for -s and --startday is: '%s'\n"),
+ fprintf(stdout, _("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();
}