summaryrefslogtreecommitdiffstats
path: root/color.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-03-16 23:01:00 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-03-16 23:02:33 -0400
commitc85f569daf3e0e99c9e8941d0234711afdb58cd7 (patch)
tree347db11ddb49f1f256d7d0f3f24dc15059318e8c /color.h
parenta7c51baacf0867b1089f683b05811744f01a70af (diff)
downloadbfs-c85f569daf3e0e99c9e8941d0234711afdb58cd7.tar.xz
Give struct expr a CFILE* instead of just a FILE*
This unifies the behaviour of -print and -fprint /dev/stdout.
Diffstat (limited to 'color.h')
-rw-r--r--color.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/color.h b/color.h
index c3b3e41..6ba6fb0 100644
--- a/color.h
+++ b/color.h
@@ -13,6 +13,7 @@
#define BFS_COLOR_H
#include "bftw.h"
+#include <stdbool.h>
#include <stdio.h>
/**
@@ -45,9 +46,22 @@ typedef struct CFILE {
FILE *file;
/** The color table to use, if any. */
const struct colors *colors;
+ /** Whether to close the underlying stream. */
+ bool close;
} CFILE;
/**
+ * Open a file for colored output.
+ *
+ * @param path
+ * The path to the file to open.
+ * @param colors
+ * The color table to use if file is a TTY.
+ * @return A colored file stream.
+ */
+CFILE *cfopen(const char *path, const struct colors *colors);
+
+/**
* Make a colored copy of an open file.
*
* @param file