Move the code to parse color strings into the CP_Parse() function and use it.
This commit is contained in:
@@ -504,14 +504,11 @@ static void OptBinIncludeDir (const char* Opt attribute ((unused)), const char*
|
||||
static void OptColor(const char* Opt, const char* Arg)
|
||||
/* Handle the --color option */
|
||||
{
|
||||
if (strcmp (Arg, "off") == 0 || strcmp (Arg, "false") == 0) {
|
||||
CP_SetColorMode (CM_OFF);
|
||||
} else if (strcmp (Arg, "auto") == 0) {
|
||||
CP_SetColorMode (CM_AUTO);
|
||||
} else if (strcmp (Arg, "on") == 0 || strcmp (Arg, "true") == 0) {
|
||||
CP_SetColorMode (CM_ON);
|
||||
} else {
|
||||
ColorMode Mode = CP_Parse (Arg);
|
||||
if (Mode == CM_INVALID) {
|
||||
AbEnd ("Invalid argument to %s: %s", Opt, Arg);
|
||||
} else {
|
||||
CP_SetColorMode (Mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user