From ec8c425866a164c3e73144751a5071aaf6660664 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 16 Oct 2016 17:11:33 -0400 Subject: Check for errors in -print and friends. --- color.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'color.h') diff --git a/color.h b/color.h index 1fd8e19..2ddc838 100644 --- a/color.h +++ b/color.h @@ -35,8 +35,9 @@ struct colors *parse_colors(const char *ls_colors); * The color table to use. * @param ftwbuf * The bftw() data for the current path. + * @return 0 on success, -1 on failure. */ -void pretty_print(const struct colors *colors, const struct BFTW *ftwbuf); +int pretty_print(const struct colors *colors, const struct BFTW *ftwbuf); #if __GNUC__ # define BFS_PRINTF_ATTRIBUTE(f, v) __attribute__((format(printf, f, v))) @@ -53,8 +54,9 @@ void pretty_print(const struct colors *colors, const struct BFTW *ftwbuf); * The format string. * @param ... * The format string's arguments. + * @return 0 on success, -1 on failure. */ -void pretty_warning(const struct colors *colors, const char *format, ...) BFS_PRINTF_ATTRIBUTE(2, 3); +int pretty_warning(const struct colors *colors, const char *format, ...) BFS_PRINTF_ATTRIBUTE(2, 3); /** * Pretty-print an error message. @@ -65,8 +67,9 @@ void pretty_warning(const struct colors *colors, const char *format, ...) BFS_PR * The format string. * @param ... * The format string's arguments. + * @return 0 on success, -1 on failure. */ -void pretty_error(const struct colors *colors, const char *format, ...) BFS_PRINTF_ATTRIBUTE(2, 3); +int pretty_error(const struct colors *colors, const char *format, ...) BFS_PRINTF_ATTRIBUTE(2, 3); /** * Free a color table. -- cgit v1.2.3