Whoops - really make the "fix" I did to the dmenuToggleVariable logic

work.
This commit is contained in:
jkh 2000-03-08 14:20:26 +00:00
parent f1c5a02a22
commit 67f03191ad
3 changed files with 24 additions and 6 deletions

View File

@ -132,15 +132,21 @@ dmenuSetKmapVariable(dialogMenuItem *tmp)
int
dmenuToggleVariable(dialogMenuItem *tmp)
{
char *var;
char *var, *cp;
int status;
if (!(var = (char *)tmp->data)) {
if (!(var = strdup((char *)tmp->data))) {
msgConfirm("Incorrect data field for `%s'!", tmp->title);
return DITEM_FAILURE;
}
if (!(cp = index(var, '='))) {
msgConfirm("Data field for %s is not in var=value format!", tmp->title);
return DITEM_FAILURE;
}
status = variable_check(var);
*cp = '\0';
variable_set2(var, status ? "NO" : "YES", *var != '_');
free(var);
return DITEM_SUCCESS;
}

View File

@ -132,15 +132,21 @@ dmenuSetKmapVariable(dialogMenuItem *tmp)
int
dmenuToggleVariable(dialogMenuItem *tmp)
{
char *var;
char *var, *cp;
int status;
if (!(var = (char *)tmp->data)) {
if (!(var = strdup((char *)tmp->data))) {
msgConfirm("Incorrect data field for `%s'!", tmp->title);
return DITEM_FAILURE;
}
if (!(cp = index(var, '='))) {
msgConfirm("Data field for %s is not in var=value format!", tmp->title);
return DITEM_FAILURE;
}
status = variable_check(var);
*cp = '\0';
variable_set2(var, status ? "NO" : "YES", *var != '_');
free(var);
return DITEM_SUCCESS;
}

View File

@ -132,15 +132,21 @@ dmenuSetKmapVariable(dialogMenuItem *tmp)
int
dmenuToggleVariable(dialogMenuItem *tmp)
{
char *var;
char *var, *cp;
int status;
if (!(var = (char *)tmp->data)) {
if (!(var = strdup((char *)tmp->data))) {
msgConfirm("Incorrect data field for `%s'!", tmp->title);
return DITEM_FAILURE;
}
if (!(cp = index(var, '='))) {
msgConfirm("Data field for %s is not in var=value format!", tmp->title);
return DITEM_FAILURE;
}
status = variable_check(var);
*cp = '\0';
variable_set2(var, status ? "NO" : "YES", *var != '_');
free(var);
return DITEM_SUCCESS;
}