diff options
author | jkh <jkh@FreeBSD.org> | 1996-07-11 11:15:28 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-07-11 11:15:28 +0000 |
commit | eef290ac5fcb42cac4a669993e6af1ea6d4ce8b9 (patch) | |
tree | 58068d99aae64c68afbee74f6c0a2128ca3518ef /gnu/lib/libdialog | |
parent | 3ab37d58db45703d615450a0108d82c3b097a329 (diff) | |
download | FreeBSD-src-eef290ac5fcb42cac4a669993e6af1ea6d4ce8b9.zip FreeBSD-src-eef290ac5fcb42cac4a669993e6af1ea6d4ce8b9.tar.gz |
Fix a couple of whoopers which somehow went undetected until now.
Diffstat (limited to 'gnu/lib/libdialog')
-rw-r--r-- | gnu/lib/libdialog/checklist.c | 24 | ||||
-rw-r--r-- | gnu/lib/libdialog/menubox.c | 56 | ||||
-rw-r--r-- | gnu/lib/libdialog/radiolist.c | 42 |
3 files changed, 66 insertions, 56 deletions
diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c index cdc7114..c2c8a8b 100644 --- a/gnu/lib/libdialog/checklist.c +++ b/gnu/lib/libdialog/checklist.c @@ -202,17 +202,19 @@ draw: /* Shortcut to OK? */ if (toupper(key) == okButton) { - if (ditems && result && ditems[OK_BUTTON].fire) { - int st; - WINDOW *save; + if (ditems) { + if (result && ditems[OK_BUTTON].fire) { + int st; + WINDOW *save; - save = dupwin(newscr); - st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); + save = dupwin(newscr); + st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); + if (st & DITEM_RESTORE) { + touchwin(save); + wrefresh(save); + } + delwin(save); } - delwin(save); } else if (result) { *result = '\0'; @@ -457,8 +459,8 @@ draw: /* Select either the OK or Cancel button */ case '\n': case '\r': - if (ditems && result) { - if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { + if (ditems) { + if (result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { int st; WINDOW *save = dupwin(newscr); diff --git a/gnu/lib/libdialog/menubox.c b/gnu/lib/libdialog/menubox.c index 97b6bf7..41cc3c8 100644 --- a/gnu/lib/libdialog/menubox.c +++ b/gnu/lib/libdialog/menubox.c @@ -191,17 +191,19 @@ draw: /* Shortcut to OK? */ if (toupper(key) == okButton) { - if (ditems && result && ditems[OK_BUTTON].fire) { - int status; - WINDOW *save; + if (ditems) { + if (result && ditems[OK_BUTTON].fire) { + int status; + WINDOW *save; - save = dupwin(newscr); - status = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (status & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); + save = dupwin(newscr); + status = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); + if (status & DITEM_RESTORE) { + touchwin(save); + wrefresh(save); + } + delwin(save); } - delwin(save); } else if (result) strcpy(result, items[(scroll + choice) * 2]); @@ -379,24 +381,26 @@ draw: if (!button) { /* A fire routine can do just about anything to the screen, so be prepared to accept some hints as to what to do in the aftermath. */ - if (ditems && ditems[scroll + choice].fire) { - int status; - WINDOW *save; + if (ditems) { + if (ditems[scroll + choice].fire) { + int status; + WINDOW *save; - save = dupwin(newscr); - status = ditems[scroll + choice].fire(&ditems[scroll + choice]); - if (status & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - if (status & DITEM_CONTINUE) - continue; - else if (status & DITEM_RECREATE && !(status & DITEM_LEAVE_MENU)) { - delwin(menu); - delwin(dialog); - dialog_clear(); - goto draw; + save = dupwin(newscr); + status = ditems[scroll + choice].fire(&ditems[scroll + choice]); + if (status & DITEM_RESTORE) { + touchwin(save); + wrefresh(save); + } + delwin(save); + if (status & DITEM_CONTINUE) + continue; + else if (status & DITEM_RECREATE && !(status & DITEM_LEAVE_MENU)) { + delwin(menu); + delwin(dialog); + dialog_clear(); + goto draw; + } } } else if (result) diff --git a/gnu/lib/libdialog/radiolist.c b/gnu/lib/libdialog/radiolist.c index f1c2197..1f546fb 100644 --- a/gnu/lib/libdialog/radiolist.c +++ b/gnu/lib/libdialog/radiolist.c @@ -210,17 +210,19 @@ draw: /* See if its the short-cut to "OK" */ if (toupper(key) == okButton) { - if (ditems && result && ditems[OK_BUTTON].fire) { - int st; - WINDOW *save; + if (ditems) { + if (result && ditems[OK_BUTTON].fire) { + int st; + WINDOW *save; - save = dupwin(newscr); - st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); + save = dupwin(newscr); + st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); + if (st & DITEM_RESTORE) { + touchwin(save); + wrefresh(save); + } + delwin(save); } - delwin(save); } else if (result) { *result = '\0'; @@ -453,19 +455,21 @@ draw: case '\r': case '\n': - if (ditems && result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { - int st; - WINDOW *save; + if (ditems) { + if (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); + 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); } - delwin(save); } - else if (!ditems && result) { + else if (result) { *result = '\0'; for (i = 0; i < item_no; i++) { if (status[i]) { |