From 29a49f5d150911428a35943be8d9fc226865eb1b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 2 Jan 2019 17:00:40 -0500 Subject: 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. --- eval.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'eval.c') 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); } -- cgit v1.2.3