From 4846e61080c575a67ebe9805a2332d8dd2b90555 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 26 Mar 2022 19:42:55 -0400 Subject: diag: New functions for highlighting command line arguments --- diag.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'diag.h') diff --git a/diag.h b/diag.h index aa5e1c7..39129cc 100644 --- a/diag.h +++ b/diag.h @@ -1,6 +1,6 @@ /**************************************************************************** * bfs * - * Copyright (C) 2019 Tavian Barnes * + * Copyright (C) 2019-2022 Tavian Barnes * * * * Permission to use, copy, modify, and/or distribute this software for any * * purpose with or without fee is hereby granted. * @@ -26,6 +26,8 @@ #include #include +struct bfs_expr; + /** * Like perror(), but decorated like bfs_error(). */ @@ -83,4 +85,24 @@ bool bfs_warning_prefix(const struct bfs_ctx *ctx); */ bool bfs_debug_prefix(const struct bfs_ctx *ctx, enum debug_flags flag); +/** + * Highlight parts of the command line in an error message. + */ +void bfs_argv_error(const struct bfs_ctx *ctx, const bool *args); + +/** + * Highlight parts of an expression in an error message. + */ +void bfs_expr_error(const struct bfs_ctx *ctx, const struct bfs_expr *expr); + +/** + * Highlight parts of the command line in a warning message. + */ +bool bfs_argv_warning(const struct bfs_ctx *ctx, const bool *args); + +/** + * Highlight parts of an expression in a warning message. + */ +bool bfs_expr_warning(const struct bfs_ctx *ctx, const struct bfs_expr *expr); + #endif // BFS_DIAG_H -- cgit v1.2.3