Streamline the compatibility flag generation

This commit is contained in:
Holger Vogt 2020-07-25 23:46:26 +02:00
parent f03a32287f
commit ebb1e953fe
1 changed files with 5 additions and 18 deletions

View File

@ -527,35 +527,22 @@ struct compat newcompat;
static void new_compat_mode(void)
{
char behaviour[80];
newcompat.hs = FALSE;
newcompat.ps = FALSE;
newcompat.lt = FALSE;
newcompat.ki = FALSE;
newcompat.a = FALSE;
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
if (strstr(behaviour, "hs"))
newcompat.hs = TRUE;
else
newcompat.hs = FALSE;
}
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
if (strstr(behaviour, "ps"))
newcompat.ps = TRUE;
else
newcompat.ps = FALSE;
}
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
if (strstr(behaviour, "lt"))
newcompat.lt = TRUE;
else
newcompat.lt = FALSE;
}
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
if (strstr(behaviour, "ki"))
newcompat.ki = TRUE;
else
newcompat.ki = FALSE;
}
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
if (strstr(behaviour, "a"))
newcompat.a = TRUE;
else
newcompat.a = FALSE;
}
if (newcompat.hs && newcompat.ps) {
fprintf(stderr, "Warning: hs and ps compatibility are mutually exclusive, switch to ps!\n");