summaryrefslogtreecommitdiffstats
path: root/parse.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 /parse.c
parent05aa323fabcd5353b90075335736e14d9144cedb (diff)
downloadbfs-2a45ad01e211d0b36056c21d5211be46195b273d.tar.xz
color: Implement %m for cfprintf()
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/parse.c b/parse.c
index 1fc4832..e173d10 100644
--- a/parse.c
+++ b/parse.c
@@ -254,7 +254,7 @@ int free_cmdline(struct cmdline *cmdline) {
if (cfclose(ofile->cfile) != 0) {
if (cerr) {
- cfprintf(cerr, "%{er}error: '%s': %s%{rs}\n", ofile->path, strerror(errno));
+ cfprintf(cerr, "%{er}error: '%s': %m%{rs}\n", ofile->path);
}
ret = -1;
}
@@ -265,7 +265,7 @@ int free_cmdline(struct cmdline *cmdline) {
if (cout && fflush(cout->file) != 0) {
if (cerr) {
- cfprintf(cerr, "%{er}error: standard output: %s%{rs}\n", strerror(errno));
+ cfprintf(cerr, "%{er}error: standard output: %m%{rs}\n");
}
ret = -1;
}
@@ -375,13 +375,13 @@ static int expr_open(struct parser_state *state, struct expr *expr, const char *
CFILE *cfile = cfopen(path, state->use_color ? cmdline->colors : NULL);
if (!cfile) {
- cfprintf(cmdline->cerr, "%{er}error: '%s': %s%{rs}\n", path, strerror(errno));
+ cfprintf(cmdline->cerr, "%{er}error: '%s': %m%{rs}\n", path);
goto out;
}
struct stat sb;
if (fstat(fileno(cfile->file), &sb) != 0) {
- cfprintf(cmdline->cerr, "%{er}error: '%s': %s%{rs}\n", path, strerror(errno));
+ cfprintf(cmdline->cerr, "%{er}error: '%s': %m%{rs}\n", path);
goto out_close;
}
@@ -428,7 +428,7 @@ static int stat_arg(const struct parser_state *state, struct expr *expr, struct
int ret = xfstatat(AT_FDCWD, expr->sdata, sb, flags);
if (ret != 0) {
- cfprintf(cmdline->cerr, "%{er}error: '%s': %s%{rs}\n", expr->sdata, strerror(errno));
+ cfprintf(cmdline->cerr, "%{er}error: '%s': %m%{rs}\n", expr->sdata);
}
return ret;
}
@@ -1269,7 +1269,7 @@ static struct expr *parse_fstype(struct parser_state *state, int arg1, int arg2)
if (!cmdline->mtab) {
cmdline->mtab = parse_bfs_mtab();
if (!cmdline->mtab) {
- cfprintf(cmdline->cerr, "%{er}error: Couldn't parse the mount table: %s.%{rs}\n\n", strerror(errno));
+ cfprintf(cmdline->cerr, "%{er}error: Couldn't parse the mount table: %m%{rs}\n");
return NULL;
}
}