[pacman-dev] [PATCH] Color output from pm_vfprintf

Allan McRae allan at archlinux.org
Wed Nov 20 21:59:54 EST 2013


It is pm_vasprintf that is changed...   Commit messaged fixed on working
branch.

On 21/11/13 12:57, Allan McRae wrote:
> This makes sure warning and error messages from _alpm_log are colored.
> Fixes FS#35160.
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  src/pacman/util.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index 23eea98..05135d7 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -1593,10 +1593,12 @@ int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_li
>  	/* print a prefix to the message */
>  	switch(level) {
>  		case ALPM_LOG_ERROR:
> -			pm_asprintf(string, _("error: %s"), msg);
> +			pm_asprintf(string, "%s%s%s%s", config->colstr.err, _("error: "),
> +								config->colstr.nocolor, msg);
>  			break;
>  		case ALPM_LOG_WARNING:
> -			pm_asprintf(string, _("warning: %s"), msg);
> +			pm_asprintf(string, "%s%s%s%s", config->colstr.warn, _("warning: "),
> +								config->colstr.nocolor, msg);
>  			break;
>  		case ALPM_LOG_DEBUG:
>  			pm_asprintf(string, "debug: %s", msg);
> 



More information about the pacman-dev mailing list