summaryrefslogtreecommitdiffstats
path: root/color.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 /color.c
parent05aa323fabcd5353b90075335736e14d9144cedb (diff)
downloadbfs-2a45ad01e211d0b36056c21d5211be46195b273d.tar.xz
color: Implement %m for cfprintf()
Diffstat (limited to 'color.c')
-rw-r--r--color.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/color.c b/color.c
index 8df6a1f..429df2d 100644
--- a/color.c
+++ b/color.c
@@ -473,6 +473,7 @@ int cfprintf(CFILE *cfile, const char *format, ...) {
FILE *file = cfile->file;
int ret = -1;
+ int error = errno;
va_list args;
va_start(args, format);
@@ -517,6 +518,12 @@ int cfprintf(CFILE *cfile, const char *format, ...) {
}
break;
+ case 'm':
+ if (fputs(strerror(error), file) == EOF) {
+ goto done;
+ }
+ break;
+
case 'P':
if (print_path(cfile, va_arg(args, const struct BFTW *)) != 0) {
goto done;