/[smeserver]/rpms/whiptail/sme10/newt-0.51.5.patch.2004082000
ViewVC logotype

Annotation of /rpms/whiptail/sme10/newt-0.51.5.patch.2004082000

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Feb 4 18:15:59 2016 UTC (8 years, 10 months ago) by vip-ire
Branch: MAIN
CVS Tags: whiptail-0_51_5-9_el7_sme, HEAD
sme10 branch

1 vip-ire 1.1 diff -Nur -x '*.orig' -x '*.rej' newt-0.51.5/dialogboxes.c mezzanine_patched_newt-0.51.5/dialogboxes.c
2     --- newt-0.51.5/dialogboxes.c 2003-01-03 15:54:45.000000000 -0500
3     +++ mezzanine_patched_newt-0.51.5/dialogboxes.c 2004-08-20 20:13:20.000000000 -0400
4     @@ -18,15 +18,18 @@
5    
6     static void addButtons(int height, int width, newtComponent form,
7     newtComponent * okay, newtComponent * cancel,
8     + char * left,
9     + char * right,
10     int flags) {
11     if (flags & FLAG_NOCANCEL) {
12     - *okay = makeButton((width - 8) / 2, height - buttonHeight - 1, "Ok");
13     + *okay = makeButton(((width - 18) / 3) * 2 + 9,
14     + height - buttonHeight - 1, right);
15     *cancel = NULL;
16     newtFormAddComponent(form, *okay);
17     } else {
18     - *okay = makeButton((width - 18) / 3, height - buttonHeight - 1, "Ok");
19     - *cancel = makeButton(((width - 18) / 3) * 2 + 9,
20     - height - buttonHeight - 1, "Cancel");
21     + *cancel = makeButton((width - 18) / 3, height - buttonHeight - 1, left);
22     + *okay = makeButton(((width - 18) / 3) * 2 + 9,
23     + height - buttonHeight - 1, right);
24     newtFormAddComponents(form, *okay, *cancel, NULL);
25     }
26     }
27     @@ -129,10 +132,11 @@
28     }
29    
30     int inputBox(const char * text, int height, int width, poptContext optCon,
31     - int flags, const char ** result) {
32     + char * left, char * right, int flags, const char ** result) {
33     newtComponent form, entry, okay, cancel, answer, tb;
34     const char * val;
35     int rc = DLG_OKAY;
36     + int eFlag = (flags & (NEWT_FLAG_HIDDEN|NEWT_FLAG_PASSWORD));
37     int top;
38    
39     val = poptGetArg(optCon);
40     @@ -141,11 +145,11 @@
41    
42     form = newtForm(NULL, NULL, 0);
43     entry = newtEntry(1, top + 1, val, width - 2, &val,
44     - NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
45     + NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT | eFlag);
46    
47     newtFormAddComponents(form, tb, entry, NULL);
48    
49     - addButtons(height, width, form, &okay, &cancel, flags);
50     + addButtons(height, width, form, &okay, &cancel, left, right, flags);
51    
52     answer = newtRunForm(form);
53     if (answer == cancel)
54     @@ -157,7 +161,7 @@
55     }
56    
57     int listBox(const char * text, int height, int width, poptContext optCon,
58     - int flags, const char ** result) {
59     + char * left, char * right, int flags, const char ** result) {
60     newtComponent form, okay, tb, answer, listBox;
61     newtComponent cancel = NULL;
62     const char * arg;
63     @@ -228,7 +232,7 @@
64    
65     newtFormAddComponents(form, tb, listBox, NULL);
66    
67     - addButtons(height, width, form, &okay, &cancel, flags);
68     + addButtons(height, width, form, &okay, &cancel, left, right, flags);
69    
70     answer = newtRunForm(form);
71     if (answer == cancel)
72     @@ -241,7 +245,8 @@
73     }
74    
75     int checkList(const char * text, int height, int width, poptContext optCon,
76     - int useRadio, int flags, const char *** selections) {
77     + int useRadio, char * left, char * right, int flags,
78     + const char *** selections) {
79     newtComponent form, okay, tb, subform, answer;
80     newtComponent sb = NULL, cancel = NULL;
81     const char * arg;
82     @@ -329,7 +334,7 @@
83    
84     newtFormAddComponents(form, tb, subform, NULL);
85    
86     - addButtons(height, width, form, &okay, &cancel, flags);
87     + addButtons(height, width, form, &okay, &cancel, left, right, flags);
88    
89     answer = newtRunForm(form);
90     if (answer == cancel)
91     @@ -364,7 +369,8 @@
92     return rc;
93     }
94    
95     -int messageBox(const char * text, int height, int width, int type, int flags) {
96     +int messageBox(const char * text, int height, int width, char *left,
97     + char *right, int type, int flags) {
98     newtComponent form, yes, tb, answer;
99     newtComponent no = NULL;
100     int tFlag = (flags & FLAG_SCROLL_TEXT) ? NEWT_FLAG_SCROLL : 0;
101     @@ -376,7 +382,17 @@
102     newtTextboxSetText(tb, text);
103    
104     newtFormAddComponent(form, tb);
105     -
106     +
107     + /* If left=Cancel and right=Ok, we probably didn't get any --left and
108     + * --right arguments passed. Assume we want Yes and No instead. This has
109     + * the side effect of not being able to pass in "Cancel" and "Ok" but
110     + * I can live with that.
111     + */
112     + if (!strcmp(left,"Cancel") && !strcmp(right,"Ok")) {
113     + left = "Yes";
114     + right = "No";
115     + }
116     +
117     switch ( type ) {
118     case MSGBOX_INFO:
119     break;
120     @@ -385,9 +401,9 @@
121     newtFormAddComponent(form, yes);
122     break;
123     default:
124     - yes = makeButton((width - 16) / 3, height - 1 - buttonHeight, "Yes");
125     - no = makeButton(((width - 16) / 3) * 2 + 9, height - 1 - buttonHeight,
126     - "No");
127     + yes = makeButton((width - 18) / 3, height - 1 - buttonHeight, left);
128     + no = makeButton(((width - 18) / 3) * 2 + 9, height - 1 - buttonHeight,
129     + right);
130     newtFormAddComponents(form, yes, no, NULL);
131    
132     if (flags & FLAG_DEFAULT_NO)
133     diff -Nur -x '*.orig' -x '*.rej' newt-0.51.5/dialogboxes.h mezzanine_patched_newt-0.51.5/dialogboxes.h
134     --- newt-0.51.5/dialogboxes.h 2003-01-03 15:54:45.000000000 -0500
135     +++ mezzanine_patched_newt-0.51.5/dialogboxes.h 2004-08-20 20:13:12.000000000 -0400
136     @@ -16,13 +16,15 @@
137     #define DLG_OKAY 0
138     #define DLG_CANCEL 1
139    
140     -int messageBox(const char * text, int height, int width, int type, int flags);
141     +int messageBox(const char * text, int height, int width, char *left,
142     + char *right, int type, int flags);
143     int checkList(const char * text, int height, int width, poptContext optCon,
144     - int useRadio, int flags, const char *** selections);
145     + int useRadio, char * left, char * right,
146     + int flags, const char *** selections);
147     int listBox(const char * text, int height, int width, poptContext optCon,
148     - int flags, const char ** result);
149     + char * left, char * right, int flags, const char ** result);
150     int inputBox(const char * text, int height, int width, poptContext optCon,
151     - int flags, const char ** result);
152     + char * left, char * right, int flags, const char ** result);
153     int gauge(const char * text, int height, int width, poptContext optCon, int fd,
154     int flags);
155     void useFullButtons(int state);
156     diff -Nur -x '*.orig' -x '*.rej' newt-0.51.5/test.c mezzanine_patched_newt-0.51.5/test.c
157     --- newt-0.51.5/test.c 2003-01-04 14:15:25.000000000 -0500
158     +++ mezzanine_patched_newt-0.51.5/test.c 2004-08-20 20:11:39.000000000 -0400
159     @@ -33,13 +33,13 @@
160     }
161    
162     int main(void) {
163     - newtComponent b1, b2, r1, r2, r3, e2, e3, l1, l2, l3, scale;
164     + newtComponent b1, b2, r1, r2, r3, e2, e3, e4, l1, l2, l3, l4, scale;
165     newtComponent lb, t, rsf, answer, timeLabel;
166     newtComponent cs[10];
167     newtComponent f, chklist, e1;
168     struct callbackInfo cbis[3];
169     char results[10];
170     - const char * enr2, * enr3, *scaleVal;
171     + const char * enr2, * enr3, * scaleVal, * enr4;
172     void ** selectedList;
173     int i, numsel;
174     char buf[20];
175     @@ -81,10 +81,11 @@
176     l1 = newtLabel(3, 6, "Scale:");
177     l2 = newtLabel(3, 7, "Scrolls:");
178     l3 = newtLabel(3, 8, "Hidden:");
179     + l4 = newtLabel(3, 9, "Password:");
180     e1 = newtEntry(12, 6, "", 20, &scaleVal, 0);
181     e2 = newtEntry(12, 7, "Default", 20, &enr2, NEWT_FLAG_SCROLL);
182     -/* e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_HIDDEN); */
183     - e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_PASSWORD);
184     + e3 = newtEntry(12, 8, NULL, 20, &enr3, NEWT_FLAG_HIDDEN);
185     + e4 = newtEntry(12, 9, NULL, 20, &enr4, NEWT_FLAG_PASSWORD);
186    
187     cbis[0].state = &results[0];
188     cbis[0].en = e1;
189     @@ -94,7 +95,7 @@
190    
191     newtFormSetHeight(chklist, 3);
192    
193     - newtFormAddComponents(f, b1, b2, l1, l2, l3, e1, e2, e3, chklist, NULL);
194     + newtFormAddComponents(f, b1, b2, l1, l2, l3, l4, e1, e2, e3, e4, chklist, NULL);
195     newtFormAddComponents(f, rsf, scale, NULL);
196    
197     lb = newtListbox(45, 1, 6, NEWT_FLAG_MULTIPLE | NEWT_FLAG_BORDER |
198     @@ -141,6 +142,7 @@
199     scaleVal = strdup(scaleVal);
200     enr2 = strdup(enr2);
201     enr3 = strdup(enr3);
202     + enr4 = strdup(enr4);
203    
204     selectedList = newtListboxGetSelection(lb, &numsel);
205    
206     @@ -153,6 +155,7 @@
207     printf("got string 1: %s\n", scaleVal);
208     printf("got string 2: %s\n", enr2);
209     printf("got string 3: %s\n", enr3);
210     + printf("got string 4: %s\n", enr4);
211    
212     printf("\nSelected listbox items (%d):\n", numsel);
213     if(selectedList) {
214     diff -Nur -x '*.orig' -x '*.rej' newt-0.51.5/whiptail.c mezzanine_patched_newt-0.51.5/whiptail.c
215     --- newt-0.51.5/whiptail.c 2003-01-03 15:54:45.000000000 -0500
216     +++ mezzanine_patched_newt-0.51.5/whiptail.c 2004-08-20 20:13:12.000000000 -0400
217     @@ -47,16 +47,22 @@
218     int rc = 1;
219     int flags = 0;
220     int defaultNo = 0;
221     + int hidden = 0;
222     + int password = 0;
223     int separateOutput = 0;
224     const char * result;
225     const char ** selections, ** next;
226     char * title = NULL;
227     char * backtitle = NULL;
228     + char * left = "Cancel";
229     + char * right = "Ok";
230     struct poptOption optionsTable[] = {
231     { "backtitle", '\0', POPT_ARG_STRING, &backtitle, 0 },
232     { "checklist", '\0', 0, 0, OPT_CHECKLIST },
233     { "clear", '\0', 0, &clear, 0 },
234     { "defaultno", '\0', 0, &defaultNo, 0 },
235     + { "hidden", '\0', 0, &hidden, 0 },
236     + { "password", '\0', 0, &password, 0 },
237     { "inputbox", '\0', 0, 0, OPT_INPUTBOX },
238     { "fb", '\0', 0, 0, OPT_FULLBUTTONS },
239     { "fullbuttons", '\0', 0, 0, OPT_FULLBUTTONS },
240     @@ -70,6 +76,8 @@
241     { "scrolltext", '\0', 0, &scrollText, 0 },
242     { "separate-output", '\0', 0, &separateOutput, 0 },
243     { "title", '\0', POPT_ARG_STRING, &title, 0 },
244     + { "left", '\0', POPT_ARG_STRING, &left, 0 },
245     + { "right", '\0', POPT_ARG_STRING, &right, 0 },
246     { "yesno", '\0', 0, 0, OPT_YESNO },
247     { 0, 0, 0, 0, 0 }
248     };
249     @@ -164,32 +172,35 @@
250     if (noItem) flags |= FLAG_NOITEM;
251     if (scrollText) flags |= FLAG_SCROLL_TEXT;
252     if (defaultNo) flags |= FLAG_DEFAULT_NO;
253     + if (hidden) flags |= NEWT_FLAG_HIDDEN;
254     + if (password) flags |= NEWT_FLAG_PASSWORD;
255    
256     switch (mode) {
257     - case MODE_MSGBOX:
258     - rc = messageBox(text, height, width, MSGBOX_MSG, flags);
259     + case MODE_MSGBOX:
260     + rc = messageBox(text, height, width, left, right, MSGBOX_MSG, flags);
261     break;
262    
263     case MODE_INFOBOX:
264     - rc = messageBox(text, height, width, MSGBOX_INFO, flags);
265     + rc = messageBox(text, height, width, left, right, MSGBOX_INFO, flags);
266     break;
267    
268     case MODE_YESNO:
269     - rc = messageBox(text, height, width, MSGBOX_YESNO, flags);
270     + rc = messageBox(text, height, width, left, right, MSGBOX_YESNO, flags);
271     break;
272    
273     case MODE_INPUTBOX:
274     - rc = inputBox(text, height, width, optCon, flags, &result);
275     + rc = inputBox(text, height, width, optCon, left, right, flags, &result);
276     if (!rc) fprintf(stderr, "%s", result);
277     break;
278    
279     case MODE_MENU:
280     - rc = listBox(text, height, width, optCon, flags, &result);
281     + rc = listBox(text, height, width, optCon, left, right, flags, &result);
282     if (!rc) fprintf(stderr, "%s", result);
283     break;
284    
285     case MODE_RADIOLIST:
286     - rc = checkList(text, height, width, optCon, 1, flags, &selections);
287     + rc = checkList(text, height, width, optCon, 1, left, right,
288     + flags, &selections);
289     if (!rc) {
290     fprintf(stderr, "%s", selections[0]);
291     free(selections);
292     @@ -197,7 +208,8 @@
293     break;
294    
295     case MODE_CHECKLIST:
296     - rc = checkList(text, height, width, optCon, 0, flags, &selections);
297     + rc = checkList(text, height, width, optCon, 0, left, right, flags,
298     + &selections);
299    
300     if (!rc) {
301     for (next = selections; *next; next++) {
302     diff -Nur -x '*.orig' -x '*.rej' newt-0.51.5/whiptcl.c mezzanine_patched_newt-0.51.5/whiptcl.c
303     --- newt-0.51.5/whiptcl.c 2000-02-16 06:34:40.000000000 -0500
304     +++ mezzanine_patched_newt-0.51.5/whiptcl.c 2004-08-20 20:13:12.000000000 -0400
305     @@ -72,6 +72,8 @@
306     char * result;
307     char ** selections, ** next;
308     char * title = NULL;
309     + char * right = "Ok";
310     + char * left = "Cancel";
311     struct poptOption optionsTable[] = {
312     { "checklist", '\0', 0, 0, OPT_CHECKLIST },
313     { "defaultno", '\0', 0, &defaultNo, 0 },
314     @@ -83,6 +85,8 @@
315     { "radiolist", '\0', 0, 0, OPT_RADIOLIST },
316     { "scrolltext", '\0', 0, &scrollText, 0 },
317     { "title", '\0', POPT_ARG_STRING, &title, 0 },
318     + { "left", '\0', POPT_ARG_STRING, &left, 0 },
319     + { "right", '\0', POPT_ARG_STRING, &right, 0 },
320     { "yesno", '\0', 0, 0, OPT_YESNO },
321     { 0, 0, 0, 0, 0 }
322     };
323     @@ -180,11 +184,11 @@
324    
325     switch (mode) {
326     case MODE_MSGBOX:
327     - rc = messageBox(text, height, width, MSGBOX_MSG, flags);
328     + rc = messageBox(text, height, width, left, right, MSGBOX_MSG, flags);
329     break;
330    
331     case MODE_YESNO:
332     - rc = messageBox(text, height, width, MSGBOX_YESNO, flags);
333     + rc = messageBox(text, height, width, left, right, MSGBOX_YESNO, flags);
334     if (rc == DLG_OKAY)
335     interp->result = "yes";
336     else
337     @@ -193,7 +197,7 @@
338     break;
339    
340     case MODE_INPUTBOX:
341     - rc = inputBox(text, height, width, optCon, flags, &result);
342     + rc = inputBox(text, height, width, optCon, left, right, flags, &result);
343     if (!rc) {
344     interp->result = strdup(result);
345     interp->freeProc = TCL_DYNAMIC;
346     @@ -201,7 +205,7 @@
347     break;
348    
349     case MODE_MENU:
350     - rc = listBox(text, height, width, optCon, flags, &result);
351     + rc = listBox(text, height, width, optCon, left, right, flags, &result);
352     if (!rc) {
353     interp->result = strdup(result);
354     interp->freeProc = TCL_DYNAMIC;
355     @@ -209,7 +213,8 @@
356     break;
357    
358     case MODE_RADIOLIST:
359     - rc = checkList(text, height, width, optCon, 1, flags, &selections);
360     + rc = checkList(text, height, width, optCon, 1, left, right,
361     + flags, &selections);
362     if (!rc) {
363     interp->result = strdup(selections[0]);
364     interp->freeProc = TCL_DYNAMIC;
365     @@ -217,7 +222,8 @@
366     break;
367    
368     case MODE_CHECKLIST:
369     - rc = checkList(text, height, width, optCon, 0, flags, &selections);
370     + rc = checkList(text, height, width, optCon, 0, left, right,
371     + flags, &selections);
372    
373     if (!rc) {
374     for (next = selections; *next; next++)

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed