summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-07-11 11:15:28 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-07-11 11:15:28 +0000
commit1cca2899470d24941e0fca848780b7037470cb6e (patch)
tree58068d99aae64c68afbee74f6c0a2128ca3518ef
parent9e35b336a3683177bd6de62979d2a6659edce4d3 (diff)
Notes
-rw-r--r--gnu/lib/libdialog/checklist.c24
-rw-r--r--gnu/lib/libdialog/menubox.c56
-rw-r--r--gnu/lib/libdialog/radiolist.c42
3 files changed, 66 insertions, 56 deletions
diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c
index cdc7114b5587..c2c8a8b16ce1 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 97b6bf71e17a..41cc3c86cfb0 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 f1c21973d770..1f546fb1305e 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]) {