diff options
author | jkh <jkh@FreeBSD.org> | 1996-04-27 01:52:15 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-04-27 01:52:15 +0000 |
commit | 96b3d4b6053f06f9a138c9f5972f9248c2b0921e (patch) | |
tree | ccdbf4ed215a57430d4c440e5d5acd1d69ba4cb0 /gnu/lib/libdialog | |
parent | ae6fe2880b1e1925526f110ae6b66b885bf3a289 (diff) | |
download | FreeBSD-src-96b3d4b6053f06f9a138c9f5972f9248c2b0921e.zip FreeBSD-src-96b3d4b6053f06f9a138c9f5972f9248c2b0921e.tar.gz |
Fix a bogon with ok/cancel callback usage.
Diffstat (limited to 'gnu/lib/libdialog')
-rw-r--r-- | gnu/lib/libdialog/checklist.c | 16 | ||||
-rw-r--r-- | gnu/lib/libdialog/radiolist.c | 34 |
2 files changed, 24 insertions, 26 deletions
diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c index bd88057..0e8e419 100644 --- a/gnu/lib/libdialog/checklist.c +++ b/gnu/lib/libdialog/checklist.c @@ -456,7 +456,7 @@ draw: /* Select either the OK or Cancel button */ case '\n': case '\r': - if (!button && result) { + if (ditems && result) { if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { int st; WINDOW *save = dupwin(newscr); @@ -470,13 +470,13 @@ draw: if (st == DITEM_FAILURE) continue; } - else { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcat(result, items[i*3]); - strcat(result, "\n"); - } + } + else if (result) { + *result = '\0'; + for (i = 0; i < item_no; i++) { + if (status[i]) { + strcat(result, items[i*3]); + strcat(result, "\n"); } } } diff --git a/gnu/lib/libdialog/radiolist.c b/gnu/lib/libdialog/radiolist.c index c40e851..d368944 100644 --- a/gnu/lib/libdialog/radiolist.c +++ b/gnu/lib/libdialog/radiolist.c @@ -452,26 +452,24 @@ draw: case '\r': case '\n': - if (!button && result) { - if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { - int st; - WINDOW *save; + if (ditems && result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { + int st; + WINDOW *save; - save = dupwin(newscr); - st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); + save = dupwin(newscr); + st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]); + if (st & DITEM_RESTORE) { + touchwin(save); + wrefresh(save); } - else { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcpy(result, items[i*3]); - break; - } + delwin(save); + } + else if (!ditems && result) { + *result = '\0'; + for (i = 0; i < item_no; i++) { + if (status[i]) { + strcpy(result, items[i*3]); + break; } } } |