summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-11-13 18:04:46 -0500
committerTavian Barnes <tavianator@tavianator.com>2017-11-13 18:04:46 -0500
commit2a45ad01e211d0b36056c21d5211be46195b273d (patch)
tree087d19624803cdd8299ccb4184afceb769caba99 /eval.c
parent05aa323fabcd5353b90075335736e14d9144cedb (diff)
downloadbfs-2a45ad01e211d0b36056c21d5211be46195b273d.tar.xz
color: Implement %m for cfprintf()
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index be73adc..d13b548 100644
--- a/eval.c
+++ b/eval.c
@@ -68,7 +68,7 @@ static bool eval_should_ignore(const struct eval_state *state, int error) {
*/
static void eval_error(struct eval_state *state) {
if (!eval_should_ignore(state, errno)) {
- cfprintf(state->cmdline->cerr, "%{er}error: '%s': %s%{rs}\n", state->ftwbuf->path, strerror(errno));
+ cfprintf(state->cmdline->cerr, "%{er}error: '%s': %m%{rs}\n", state->ftwbuf->path);
*state->ret = EXIT_FAILURE;
}
}
@@ -306,7 +306,7 @@ static int eval_exec_finish(const struct expr *expr, const struct cmdline *cmdli
int ret = 0;
if (expr->execbuf && bfs_exec_finish(expr->execbuf) != 0) {
if (errno != 0) {
- cfprintf(cmdline->cerr, "%{er}error: %s %s: %s.%{rs}\n", expr->argv[0], expr->argv[1], strerror(errno));
+ cfprintf(cmdline->cerr, "%{er}error: %s %s: %m%{rs}\n", expr->argv[0], expr->argv[1]);
}
ret = -1;
}
@@ -325,7 +325,7 @@ static int eval_exec_finish(const struct expr *expr, const struct cmdline *cmdli
bool eval_exec(const struct expr *expr, struct eval_state *state) {
bool ret = bfs_exec(expr->execbuf, state->ftwbuf) == 0;
if (errno != 0) {
- cfprintf(state->cmdline->cerr, "%{er}error: %s %s: %s.%{rs}\n", expr->argv[0], expr->argv[1], strerror(errno));
+ cfprintf(state->cmdline->cerr, "%{er}error: %s %s: %m%{rs}\n", expr->argv[0], expr->argv[1]);
*state->ret = EXIT_FAILURE;
}
return ret;
@@ -1100,7 +1100,7 @@ static enum bftw_action cmdline_callback(struct BFTW *ftwbuf, void *ptr) {
if (ftwbuf->typeflag == BFTW_ERROR) {
if (!eval_should_ignore(&state, ftwbuf->error)) {
args->ret = EXIT_FAILURE;
- cfprintf(cmdline->cerr, "%{er}error: '%s': %s%{rs}\n", ftwbuf->path, strerror(ftwbuf->error));
+ cfprintf(cmdline->cerr, "%{er}error: '%s': %m%{rs}\n", ftwbuf->path);
}
state.action = BFTW_SKIP_SUBTREE;
goto done;