char * end;
int height;
int width;
+ int listHeight;
int noCancel = 0;
int noItem = 0;
int scrollText = 0;
int rc = 0;
int flags = 0;
int defaultNo = 0;
- const char * result;
- const char ** selections, ** next;
+ char * result;
+ char ** selections, ** next;
char * title = NULL;
char *default_item = NULL;
struct poptOption optionsTable[] = {
return TCL_ERROR;
}
+ switch (mode) {
+ case MODE_MENU:
+ case MODE_RADIOLIST:
+ case MODE_CHECKLIST:
+ if (!(nextArg = poptGetArg(optCon))) {
+ interp->result = "list-height missing";
+ return TCL_ERROR;
+ }
+ listHeight = strtoul(nextArg, &end, 10);
+ if (*end) {
+ interp->result = "list-height is not a number";
+ return TCL_ERROR;
+ }
+ break;
+ }
+
width -= 2;
height -= 2;
newtOpenWindow((80 - width) / 2, (24 - height) / 2, width, height, title);
case MODE_INPUTBOX:
rc = inputBox(text, height, width, optCon, flags, &result);
if (rc ==DLG_OKAY) {
- interp->result = strdup(result);
+ interp->result = result;
interp->freeProc = TCL_DYNAMIC;
}
break;
case MODE_MENU:
- rc = listBox(text, height, width, optCon, flags, default_item, &result);
+ rc = listBox(text, height, width, listHeight, optCon, flags, default_item,
+ &result);
if (rc==DLG_OKAY) {
- interp->result = strdup(result);
+ interp->result = result;
interp->freeProc = TCL_DYNAMIC;
}
break;
case MODE_RADIOLIST:
- rc = checkList(text, height, width, optCon, 1, flags, &selections);
+ rc = checkList(text, height, width, listHeight, optCon, 1, flags,
+ &selections);
if (rc==DLG_OKAY) {
- interp->result = strdup(selections[0]);
+ interp->result = selections[0];
interp->freeProc = TCL_DYNAMIC;
+
+ free(selections);
}
break;
case MODE_CHECKLIST:
- rc = checkList(text, height, width, optCon, 0, flags, &selections);
+ rc = checkList(text, height, width, listHeight, optCon, 0, flags,
+ &selections);
if (rc==DLG_OKAY) {
for (next = selections; *next; next++)