summaryrefslogtreecommitdiffstats
path: root/color.h
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 /color.h
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 'color.h')
-rw-r--r--color.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/color.h b/color.h
index a68378e..78db64a 100644
--- a/color.h
+++ b/color.h
@@ -18,6 +18,7 @@
#define BFS_COLOR_H
#include "bftw.h"
+#include "util.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -95,18 +96,20 @@ int cfclose(CFILE *cfile);
* @param format
* A printf()-style format string, supporting these format specifiers:
*
- * %%: A literal '%'
* %c: A single character
* %d: An integer
* %g: A double
* %s: A string
* %zu: A size_t
* %m: strerror(errno)
- * %P: A colored file path, from a const struct BFTW * argument
- * %L: A colored link target, from a const struct BFTW * argument
- * %{cc}: Change the color to 'cc'
+ * %pP: A colored file path, from a const struct BFTW * argument
+ * %pL: A colored link target, from a const struct BFTW * argument
+ * %%: A literal '%'
+ * ${cc}: Change the color to 'cc'
+ * $$: A literal '$'
* @return 0 on success, -1 on failure.
*/
+BFS_FORMATTER(2, 3)
int cfprintf(CFILE *cfile, const char *format, ...);
/**