From 94e44434642f7f0e03cf285d51ca74f8853cfb6e Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Thu, 27 May 2021 14:56:31 +0200 Subject: [PATCH] fix --color option --- src/fastfetch.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fastfetch.c b/src/fastfetch.c index d342af3a1..1e23cef68 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -794,7 +794,16 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con else if(strcasecmp(key, "-s") == 0 || strcasecmp(key, "--separator") == 0) optionParseString(key, value, &instance->config.separator); else if(strcasecmp(key, "-c") == 0 || strcasecmp(key, "--color") == 0) - optionParseString(key, value, &instance->config.color); + { + if(value == NULL) + { + fprintf(stderr, "Error: usage: %s \n", key); + exit(477); + } + ffStrbufSetS(&instance->config.color, "\033["); + ffStrbufAppendS(&instance->config.color, value); + ffStrbufAppendC(&instance->config.color, 'm'); + } else if(strcasecmp(key, "--os-format") == 0) optionParseString(key, value, &instance->config.osFormat); else if(strcasecmp(key, "--os-key") == 0)