summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-01-02 17:00:40 -0500
committerTavian Barnes <tavianator@tavianator.com>2019-01-02 17:01:06 -0500
commit29a49f5d150911428a35943be8d9fc226865eb1b (patch)
tree35ca4aa4fd793e6398c7943cee0b1732f29419c0 /eval.c
parent7fc7e98df2ea9c34dd1e0cb188554bed933a16df (diff)
downloadbfs-29a49f5d150911428a35943be8d9fc226865eb1b.tar.xz
color: Check format strings + args for cfprintf()
%{cc} is now ${cc} to avoid warnings about an unrecognized format specifier, and %P and %L are now %pP and %pL to make them look more like standard format strings.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index f7632d8..5b55b8d 100644
--- a/eval.c
+++ b/eval.c
@@ -62,11 +62,12 @@ struct eval_state {
/**
* Print an error message.
*/
+BFS_FORMATTER(2, 3)
static void eval_error(const struct eval_state *state, const char *format, ...) {
int error = errno;
const struct cmdline *cmdline = state->cmdline;
- bfs_error(cmdline, "%P: ", state->ftwbuf);
+ bfs_error(cmdline, "%pP: ", state->ftwbuf);
va_list args;
va_start(args, format);
@@ -721,12 +722,12 @@ bool eval_fls(const struct expr *expr, struct eval_state *state) {
goto error;
}
- if (cfprintf(cfile, " %P", ftwbuf) < 0) {
+ if (cfprintf(cfile, " %pP", ftwbuf) < 0) {
goto error;
}
if (ftwbuf->typeflag == BFTW_LNK) {
- if (cfprintf(cfile, " -> %L", ftwbuf) < 0) {
+ if (cfprintf(cfile, " -> %pL", ftwbuf) < 0) {
goto error;
}
}
@@ -752,7 +753,7 @@ bool eval_fprint(const struct expr *expr, struct eval_state *state) {
eval_stat(state);
}
- if (cfprintf(cfile, "%P\n", state->ftwbuf) < 0) {
+ if (cfprintf(cfile, "%pP\n", state->ftwbuf) < 0) {
eval_report_error(state);
}