diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-03-16 23:01:00 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-03-16 23:02:33 -0400 |
commit | c85f569daf3e0e99c9e8941d0234711afdb58cd7 (patch) | |
tree | 347db11ddb49f1f256d7d0f3f24dc15059318e8c /color.h | |
parent | a7c51baacf0867b1089f683b05811744f01a70af (diff) | |
download | bfs-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.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |