Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: Remove support for lxdialog --checklist

Remove support for lxdialog --checklist

The checklist lxdialog functionality is not used by menuconfig
(only the radiolist variant is used) and supporting it would
significantly complicate the forthcoming liblxdialog API.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

authored by

Petr Baudis and committed by
00213b17 352dd1df

+17 -51
+14 -33
scripts/kconfig/lxdialog/checklist.c
··· 23 23 24 24 #include "dialog.h" 25 25 26 - static int list_width, check_x, item_x, checkflag; 26 + static int list_width, check_x, item_x; 27 27 28 28 /* 29 29 * Print list item ··· 41 41 42 42 wmove(win, choice, check_x); 43 43 wattrset(win, selected ? check_selected_attr : check_attr); 44 - if (checkflag == FLAG_CHECK) 45 - wprintw(win, "[%c]", status ? 'X' : ' '); 46 - else 47 - wprintw(win, "(%c)", status ? 'X' : ' '); 44 + wprintw(win, "(%c)", status ? 'X' : ' '); 48 45 49 46 wattrset(win, selected ? tag_selected_attr : tag_attr); 50 47 mvwaddch(win, choice, item_x, item[0]); ··· 106 109 107 110 /* 108 111 * Display a dialog box with a list of options that can be turned on or off 109 - * The `flag' parameter is used to select between radiolist and checklist. 112 + * in the style of radiolist (only one option turned on at a time). 110 113 */ 111 114 int dialog_checklist(const char *title, const char *prompt, int height, 112 115 int width, int list_height, int item_no, 113 - const char *const *items, int flag) 116 + const char *const *items) 114 117 { 115 118 int i, x, y, box_x, box_y; 116 119 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; 117 120 WINDOW *dialog, *list; 118 - 119 - checkflag = flag; 120 121 121 122 /* Allocate space for storing item on/off status */ 122 123 if ((status = malloc(sizeof(int) * item_no)) == NULL) { ··· 298 303 case ' ': 299 304 case '\n': 300 305 if (!button) { 301 - if (flag == FLAG_CHECK) { 302 - status[scroll + choice] = !status[scroll + choice]; 303 - wmove(list, choice, check_x); 304 - wattrset(list, check_selected_attr); 305 - wprintw(list, "[%c]", status[scroll + choice] ? 'X' : ' '); 306 - } else { 307 - if (!status[scroll + choice]) { 308 - for (i = 0; i < item_no; i++) 309 - status[i] = 0; 310 - status[scroll + choice] = 1; 311 - for (i = 0; i < max_choice; i++) 312 - print_item(list, items[(scroll + i) * 3 + 1], 313 - status[scroll + i], i, i == choice); 314 - } 306 + if (!status[scroll + choice]) { 307 + for (i = 0; i < item_no; i++) 308 + status[i] = 0; 309 + status[scroll + choice] = 1; 310 + for (i = 0; i < max_choice; i++) 311 + print_item(list, items[(scroll + i) * 3 + 1], 312 + status[scroll + i], i, i == choice); 315 313 } 316 314 wnoutrefresh(list); 317 315 wrefresh(dialog); 318 316 319 - for (i = 0; i < item_no; i++) { 320 - if (status[i]) { 321 - if (flag == FLAG_CHECK) { 322 - fprintf(stderr, "\"%s\" ", items[i * 3]); 323 - } else { 324 - fprintf(stderr, "%s", items[i * 3]); 325 - } 326 - 327 - } 328 - } 317 + for (i = 0; i < item_no; i++) 318 + if (status[i]) 319 + fprintf(stderr, "%s", items[i * 3]); 329 320 } else 330 321 fprintf(stderr, "%s", items[(scroll + choice) * 3]); 331 322 delwin(dialog);
+1 -8
scripts/kconfig/lxdialog/dialog.h
··· 160 160 const char *const *items); 161 161 int dialog_checklist(const char *title, const char *prompt, int height, 162 162 int width, int list_height, int item_no, 163 - const char *const *items, int flag); 163 + const char *const *items); 164 164 extern char dialog_input_result[]; 165 165 int dialog_inputbox(const char *title, const char *prompt, int height, 166 166 int width, const char *init); ··· 175 175 * -- uppercase chars are used to invoke the button (M_EVENT + 'O') 176 176 */ 177 177 #define M_EVENT (KEY_MAX+1) 178 - 179 - /* 180 - * The `flag' parameter in checklist is used to select between 181 - * radiolist and checklist 182 - */ 183 - #define FLAG_CHECK 1 184 - #define FLAG_RADIO 0
+2 -10
scripts/kconfig/lxdialog/lxdialog.c
··· 31 31 jumperFn *jumper; 32 32 }; 33 33 34 - jumperFn j_menu, j_checklist, j_radiolist, j_yesno, j_textbox, j_inputbox; 34 + jumperFn j_menu, j_radiolist, j_yesno, j_textbox, j_inputbox; 35 35 jumperFn j_msgbox, j_infobox; 36 36 37 37 static struct Mode modes[] = { 38 38 {"--menu", 9, 0, 3, j_menu}, 39 - {"--checklist", 9, 0, 3, j_checklist}, 40 39 {"--radiolist", 9, 0, 3, j_radiolist}, 41 40 {"--yesno", 5, 5, 1, j_yesno}, 42 41 {"--textbox", 5, 5, 1, j_textbox}, ··· 150 151 \nBox options:\ 151 152 \n\ 152 153 \n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ 153 - \n --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ 154 154 \n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ 155 155 \n --textbox <file> <height> <width>\ 156 156 \n --inputbox <text> <height> <width> [<init>]\ ··· 168 170 atoi(av[5]), av[6], (ac - 6) / 2, av + 7); 169 171 } 170 172 171 - int j_checklist(const char *t, int ac, const char *const *av) 172 - { 173 - return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]), 174 - atoi(av[5]), (ac - 6) / 3, av + 6, FLAG_CHECK); 175 - } 176 - 177 173 int j_radiolist(const char *t, int ac, const char *const *av) 178 174 { 179 175 return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]), 180 - atoi(av[5]), (ac - 6) / 3, av + 6, FLAG_RADIO); 176 + atoi(av[5]), (ac - 6) / 3, av + 6); 181 177 } 182 178 183 179 int j_textbox(const char *t, int ac, const char *const *av)