1
diff -ruN newt-0.51.6-old/dialogboxes.c newt-0.51.6/dialogboxes.c
2
--- newt-0.51.6-old/dialogboxes.c 2004-03-09 12:17:26.000000000 +0000
3
+++ newt-0.51.6/dialogboxes.c 2004-03-09 12:17:26.000000000 +0000
7
int listBox(const char * text, int height, int width, poptContext optCon,
8
- int flags, const char ** result) {
9
+ int flags, const char *default_item, const char ** result) {
10
newtComponent form, okay, tb, answer, listBox;
11
newtComponent cancel = NULL;
14
char buf[MAXBUF], format[MAXFOTMAT];
24
itemInfo[numItems].tag = arg;
25
+ if (default_item && (strcmp(default_item, arg) == 0)) {
28
if (!(arg = poptGetArg(optCon))) return DLG_ERROR;
30
if (!(flags & FLAG_NOITEM)) {
32
newtListboxAddEntry(listBox, buf, (void *) i);
36
+ newtListboxSetCurrent (listBox, defItem);
38
newtFormAddComponents(form, tb, listBox, NULL);
40
addButtons(height, width, form, &okay, &cancel, flags);
46
- if (flags & FLAG_NOTAGS) {
50
form = newtForm(NULL, NULL, 0);
52
tb = textbox(height - 3 - buttonHeight - listHeight, width - 2,
53
diff -ruN newt-0.51.6-old/dialogboxes.h newt-0.51.6/dialogboxes.h
54
--- newt-0.51.6-old/dialogboxes.h 2004-03-09 12:17:26.000000000 +0000
55
+++ newt-0.51.6/dialogboxes.h 2004-03-09 12:17:26.000000000 +0000
57
int checkList(const char * text, int height, int width, poptContext optCon,
58
int useRadio, int flags, const char *** selections);
59
int listBox(const char * text, int height, int width, poptContext optCon,
60
- int flags, const char ** result);
61
+ int flags, const char *default_item, const char ** result);
62
int inputBox(const char * text, int height, int width, poptContext optCon,
63
int flags, const char ** result);
64
int gauge(const char * text, int height, int width, poptContext optCon, int fd,
65
diff -ruN newt-0.51.6-old/whiptail.c newt-0.51.6/whiptail.c
66
--- newt-0.51.6-old/whiptail.c 2004-03-09 12:17:26.000000000 +0000
67
+++ newt-0.51.6/whiptail.c 2004-03-09 12:17:26.000000000 +0000
70
const char ** selections, ** next;
72
+ char *default_item = NULL;
73
char * backtitle = NULL;
74
struct poptOption optionsTable[] = {
75
{ "backtitle", '\0', POPT_ARG_STRING, &backtitle, 0 },
77
{ "msgbox", '\0', 0, 0, OPT_MSGBOX },
78
{ "nocancel", '\0', 0, &noCancel, 0 },
79
{ "noitem", '\0', 0, &noItem, 0 },
80
+ { "default-item", '\0', POPT_ARG_STRING, &default_item, 0},
81
{ "notags", '\0', 0, &noTags, 0 },
82
{ "radiolist", '\0', 0, 0, OPT_RADIOLIST },
83
{ "scrolltext", '\0', 0, &scrollText, 0 },
88
- rc = listBox(text, height, width, optCon, flags, &result);
89
+ rc = listBox(text, height, width, optCon, flags, default_item, &result);
90
if (rc == DLG_OKAY) fprintf(output, "%s", result);
93
diff -ruN newt-0.51.6-old/whiptcl.c newt-0.51.6/whiptcl.c
94
--- newt-0.51.6-old/whiptcl.c 2004-03-09 12:17:26.000000000 +0000
95
+++ newt-0.51.6/whiptcl.c 2004-03-09 12:17:26.000000000 +0000
98
const char ** selections, ** next;
100
+ char *default_item = NULL;
101
struct poptOption optionsTable[] = {
102
{ "checklist", '\0', 0, 0, OPT_CHECKLIST },
103
{ "defaultno", '\0', 0, &defaultNo, 0 },
105
{ "radiolist", '\0', 0, 0, OPT_RADIOLIST },
106
{ "scrolltext", '\0', 0, &scrollText, 0 },
107
{ "title", '\0', POPT_ARG_STRING, &title, 0 },
108
+ { "default-item", '\0', POPT_ARG_STRING, &default_item, 0 },
109
{ "yesno", '\0', 0, 0, OPT_YESNO },
116
- rc = listBox(text, height, width, optCon, flags, &result);
117
+ rc = listBox(text, height, width, optCon, flags, default_item, &result);
119
interp->result = strdup(result);
120
interp->freeProc = TCL_DYNAMIC;