History

kconfig: fixup after Lindent

Readability are more important then the 80 coloumn limit, so fold several lines to greatly improve readability. Also keep return type on same line as function definition.

Sam Ravnborg committed 20 years ago

Commit dec69da1 parent b1c5f1c8 files · +108 −229Browse files

Showing the changes to scripts (8 of 8 files). Show all

Unified · Split

8 files
  1. scripts/lxdialog/checklist.c +30 −69
  2. scripts/lxdialog/dialog.h +1 −2
  3. scripts/lxdialog/inputbox.c +15 −34
  4. scripts/lxdialog/menubox.c +26 −57
  5. scripts/lxdialog/msgbox.c +2 −3
  6. scripts/lxdialog/textbox.c +32 −61
  7. scripts/lxdialog/util.c +1 −1
  8. scripts/lxdialog/yesno.c +1 −2
scripts/lxdialog/checklist.c+30−69
@@ -28,8 +28,8 @@ static int list_width, check_x, item_x, checkflag; · 27 unmodified lines
2828 /*
2929 * Print list item
3030 */
31−static void
32−print_item(WINDOW * win, const char *item, int status, int choice, int selected)
31+static void print_item(WINDOW * win, const char *item, int status, int choice,
32+ int selected)
3333 {
3434 int i;
3535
@@ -59,8 +59,7 @@ print_item(WINDOW * win, const char *item, int status, int choice, int selected) · 23 unmodified lines
5959 /*
6060 * Print the scroll indicators.
6161 */
62−static void
63−print_arrows(WINDOW * win, int choice, int item_no, int scroll,
62+static void print_arrows(WINDOW * win, int choice, int item_no, int scroll,
6463 int y, int x, int height)
6564 {
6665 wmove(win, y, x);
@@ -112,10 +111,9 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) · 45 unmodified lines
112111 * Display a dialog box with a list of options that can be turned on or off
113112 * The `flag' parameter is used to select between radiolist and checklist.
114113 */
115−int
116−dialog_checklist(const char *title, const char *prompt, int height, int width,
117− int list_height, int item_no, const char *const *items,
118− int flag)
114+int dialog_checklist(const char *title, const char *prompt, int height,
115+ int width, int list_height, int item_no,
116+ const char *const *items, int flag)
119117 {
120118 int i, x, y, box_x, box_y;
121119 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status;
@@ -183,15 +181,14 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 61 unmodified lines
183181 box_x = (width - list_width) / 2 - 1;
184182
185183 /* create new window for the list */
186− list =
187− subwin(dialog, list_height, list_width, y + box_y + 1,
188− x + box_x + 1);
184+ list = subwin(dialog, list_height, list_width, y + box_y + 1,
185+ x + box_x + 1);
189186
190187 keypad(list, TRUE);
191188
192189 /* draw a box around the list items */
193190 draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2,
194− menubox_border_attr, menubox_attr);
191+ menubox_border_attr, menubox_attr);
195192
196193 /* Find length of longest item in order to center checklist */
197194 check_x = 0;
@@ -238,24 +235,18 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 40 unmodified lines
238235 /* Scroll list down */
239236 if (list_height > 1) {
240237 /* De-highlight current first item */
241− print_item(list,
242− items[scroll * 3 +
243− 1],
244− status[scroll], 0,
245− FALSE);
238+ print_item(list, items[scroll * 3 + 1],
239+ status[scroll], 0, FALSE);
246240 scrollok(list, TRUE);
247241 wscrl(list, -1);
248242 scrollok(list, FALSE);
249243 }
250244 scroll--;
251− print_item(list, items[scroll * 3 + 1],
252− status[scroll], 0, TRUE);
245+ print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE);
253246 wnoutrefresh(list);
254247
255248 print_arrows(dialog, choice, item_no,
256− scroll, box_y,
257− box_x + check_x + 5,
258− list_height);
249+ scroll, box_y, box_x + check_x + 5, list_height);
259250
260251 wrefresh(dialog);
261252
@@ -269,32 +260,20 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 7 unmodified lines
269260 /* Scroll list up */
270261 if (list_height > 1) {
271262 /* De-highlight current last item before scrolling up */
272− print_item(list,
273− items[(scroll +
274− max_choice -
275− 1) * 3 + 1],
276− status[scroll +
277− max_choice -
278− 1],
279− max_choice - 1,
280− FALSE);
263+ print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
264+ status[scroll + max_choice - 1],
265+ max_choice - 1, FALSE);
281266 scrollok(list, TRUE);
282267 wscrl(list, 1);
283268 scrollok(list, FALSE);
284269 }
285270 scroll++;
286− print_item(list,
287− items[(scroll + max_choice -
288− 1) * 3 + 1],
289− status[scroll + max_choice -
290− 1], max_choice - 1,
291− TRUE);
271+ print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
272+ status[scroll + max_choice - 1], max_choice - 1, TRUE);
292273 wnoutrefresh(list);
293274
294275 print_arrows(dialog, choice, item_no,
295− scroll, box_y,
296− box_x + check_x + 5,
297− list_height);
276+ scroll, box_y, box_x + check_x + 5, list_height);
298277
299278 wrefresh(dialog);
300279
@@ -304,16 +283,12 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 3 unmodified lines
304283 }
305284 if (i != choice) {
306285 /* De-highlight current item */
307− print_item(list,
308− items[(scroll + choice) * 3 + 1],
309− status[scroll + choice], choice,
310− FALSE);
286+ print_item(list, items[(scroll + choice) * 3 + 1],
287+ status[scroll + choice], choice, FALSE);
311288 /* Highlight new item */
312289 choice = i;
313− print_item(list,
314− items[(scroll + choice) * 3 + 1],
315− status[scroll + choice], choice,
316− TRUE);
290+ print_item(list, items[(scroll + choice) * 3 + 1],
291+ status[scroll + choice], choice, TRUE);
317292 wnoutrefresh(list);
318293 wrefresh(dialog);
319294 }
@@ -342,28 +317,18 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 22 unmodified lines
342317 case '\n':
343318 if (!button) {
344319 if (flag == FLAG_CHECK) {
345− status[scroll + choice] =
346− !status[scroll + choice];
320+ status[scroll + choice] = !status[scroll + choice];
347321 wmove(list, choice, check_x);
348322 wattrset(list, check_selected_attr);
349− wprintw(list, "[%c]",
350− status[scroll +
351− choice] ? 'X' : ' ');
323+ wprintw(list, "[%c]", status[scroll + choice] ? 'X' : ' ');
352324 } else {
353325 if (!status[scroll + choice]) {
354326 for (i = 0; i < item_no; i++)
355327 status[i] = 0;
356328 status[scroll + choice] = 1;
357329 for (i = 0; i < max_choice; i++)
358− print_item(list,
359− items[(scroll
360− +
361− i) *
362− 3 + 1],
363− status[scroll
364− + i],
365− i,
366− i == choice);
330+ print_item(list, items[(scroll + i) * 3 + 1],
331+ status[scroll + i], i, i == choice);
367332 }
368333 }
369334 wnoutrefresh(list);
@@ -372,19 +337,15 @@ dialog_checklist(const char *title, const char *prompt, int height, int width, · 2 unmodified lines
372337 for (i = 0; i < item_no; i++) {
373338 if (status[i]) {
374339 if (flag == FLAG_CHECK) {
375− fprintf(stderr,
376− "\"%s\" ",
377− items[i * 3]);
340+ fprintf(stderr, "\"%s\" ", items[i * 3]);
378341 } else {
379− fprintf(stderr, "%s",
380− items[i * 3]);
342+ fprintf(stderr, "%s", items[i * 3]);
381343 }
382344
383345 }
384346 }
385347 } else
386− fprintf(stderr, "%s",
387− items[(scroll + choice) * 3]);
348+ fprintf(stderr, "%s", items[(scroll + choice) * 3]);
388349 delwin(dialog);
389350 free(status);
390351 return button;
scripts/lxdialog/dialog.h+1−2
@@ -1,4 +1,3 @@
1−
21 /*
32 * dialog.h -- common declarations for all dialog modules
43 *
@@ -87,7 +86,7 @@ · 82 unmodified lines
8786 #define ACS_DARROW 'v'
8887 #endif
8988
90−/*
89+/*
9190 * Attribute names
9291 */
9392 #define screen_attr attributes[0]
scripts/lxdialog/inputbox.c+15−34
@@ -41,9 +41,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) · 40 unmodified lines
4141 /*
4242 * Display a dialog box for inputing a string
4343 */
44−int
45−dialog_inputbox(const char *title, const char *prompt, int height, int width,
46− const char *init)
44+int dialog_inputbox(const char *title, const char *prompt, int height, int width,
45+ const char *init)
4746 {
4847 int i, x, y, box_y, box_x, box_width;
4948 int input_x = 0, scroll = 0, key = 0, button = -1;
@@ -90,8 +89,7 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, · 40 unmodified lines
9089 getyx(dialog, y, x);
9190 box_y = y + 2;
9291 box_x = (width - box_width) / 2;
93− draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
94− border_attr, dialog_attr);
92+ draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr);
9593
9694 print_buttons(dialog, height, width, 0);
9795
@@ -111,8 +109,9 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, · 13 unmodified lines
111109 input_x = box_width - 1;
112110 for (i = 0; i < box_width - 1; i++)
113111 waddch(dialog, instr[scroll + i]);
114− } else
112+ } else {
115113 waddstr(dialog, instr);
114+ }
116115
117116 wmove(dialog, box_y, box_x + input_x);
118117
@@ -136,26 +135,17 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, · 17 unmodified lines
136135 if (input_x || scroll) {
137136 wattrset(dialog, inputbox_attr);
138137 if (!input_x) {
139− scroll =
140− scroll <
141− box_width - 1 ? 0 : scroll -
142− (box_width - 1);
138+ scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
143139 wmove(dialog, box_y, box_x);
144140 for (i = 0; i < box_width; i++)
145141 waddch(dialog,
146− instr[scroll +
147− input_x +
148− i] ?
149− instr[scroll +
150− input_x +
151− i] : ' ');
152− input_x =
153− strlen(instr) - scroll;
142+ instr[scroll + input_x + i] ?
143+ instr[scroll + input_x + i] : ' ');
144+ input_x = strlen(instr) - scroll;
154145 } else
155146 input_x--;
156147 instr[scroll + input_x] = '\0';
157− mvwaddch(dialog, box_y, input_x + box_x,
158− ' ');
148+ mvwaddch(dialog, box_y, input_x + box_x, ' ');
159149 wmove(dialog, box_y, input_x + box_x);
160150 wrefresh(dialog);
161151 }
@@ -165,23 +155,14 @@ dialog_inputbox(const char *title, const char *prompt, int height, int width, · 3 unmodified lines
165155 if (scroll + input_x < MAX_LEN) {
166156 wattrset(dialog, inputbox_attr);
167157 instr[scroll + input_x] = key;
168− instr[scroll + input_x + 1] =
169− '\0';
158+ instr[scroll + input_x + 1] = '\0';
170159 if (input_x == box_width - 1) {
171160 scroll++;
172− wmove(dialog, box_y,
173− box_x);
174− for (i = 0;
175− i < box_width - 1;
176− i++)
177− waddch(dialog,
178− instr
179− [scroll +
180− i]);
161+ wmove(dialog, box_y, box_x);
162+ for (i = 0; i < box_width - 1; i++)
163+ waddch(dialog, instr [scroll + i]);
181164 } else {
182− wmove(dialog, box_y,
183− input_x++ +
184− box_x);
165+ wmove(dialog, box_y, input_x++ + box_x);
185166 waddch(dialog, key);
186167 }
187168 wrefresh(dialog);
scripts/lxdialog/menubox.c+26−57
@@ -63,8 +63,8 @@ static int menu_width, item_x; · 62 unmodified lines
6363 /*
6464 * Print menu item
6565 */
66−static void
67−print_item(WINDOW * win, const char *item, int choice, int selected, int hotkey)
66+static void print_item(WINDOW * win, const char *item, int choice,
67+ int selected, int hotkey)
6868 {
6969 int j;
7070 char menu_item[menu_width + 1];
@@ -100,8 +100,8 @@ print_item(WINDOW * win, const char *item, int choice, int selected, int hotkey) · 29 unmodified lines
100100 /*
101101 * Print the scroll indicators.
102102 */
103−static void
104−print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, int height)
103+static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
104+ int height)
105105 {
106106 int cur_y, cur_x;
107107
@@ -158,10 +158,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) · 50 unmodified lines
158158 /*
159159 * Display a menu for choosing among a number of options
160160 */
161−int
162−dialog_menu(const char *title, const char *prompt, int height, int width,
163− int menu_height, const char *current, int item_no,
164− const char *const *items)
161+int dialog_menu(const char *title, const char *prompt, int height, int width,
162+ int menu_height, const char *current, int item_no,
163+ const char *const *items)
165164 {
166165 int i, j, x, y, box_x, box_y;
167166 int key = 0, button = 0, scroll = 0, choice = 0, first_item =
@@ -283,20 +282,14 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 115 unmodified lines
283282 i = max_choice;
284283 else {
285284 for (i = choice + 1; i < max_choice; i++) {
286− j = first_alpha(items[(scroll + i) * 2 + 1],
287− "YyNnMmHh");
288− if (key ==
289− tolower(items[(scroll + i) * 2 + 1][j]))
285+ j = first_alpha(items[(scroll + i) * 2 + 1], "YyNnMmHh");
286+ if (key == tolower(items[(scroll + i) * 2 + 1][j]))
290287 break;
291288 }
292289 if (i == max_choice)
293290 for (i = 0; i < max_choice; i++) {
294− j = first_alpha(items
295− [(scroll + i) * 2 + 1],
296− "YyNnMmHh");
297− if (key ==
298− tolower(items[(scroll + i) * 2 + 1]
299− [j]))
291+ j = first_alpha(items [(scroll + i) * 2 + 1], "YyNnMmHh");
292+ if (key == tolower(items[(scroll + i) * 2 + 1][j]))
300293 break;
301294 }
302295 }
@@ -319,24 +312,19 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 16 unmodified lines
319312
320313 scroll--;
321314
322− print_item(menu, items[scroll * 2 + 1],
323− 0, FALSE,
324− (items[scroll * 2][0] !=
325− ':'));
315+ print_item(menu, items[scroll * 2 + 1], 0, FALSE,
316+ (items[scroll * 2][0] != ':'));
326317 } else
327318 choice = MAX(choice - 1, 0);
328319
329320 } else if (key == KEY_DOWN || key == '+') {
330321
331322 print_item(menu,
332− items[(scroll + choice) * 2 + 1],
333− choice, FALSE,
334− (items[(scroll + choice) * 2][0] !=
335− ':'));
323+ items[(scroll + choice) * 2 + 1], choice, FALSE,
324+ (items[(scroll + choice) * 2][0] != ':'));
336325
337326 if ((choice > max_choice - 3) &&
338− (scroll + max_choice < item_no)
339− ) {
327+ (scroll + max_choice < item_no)) {
340328 /* Scroll menu up */
341329 scrollok(menu, TRUE);
342330 wscrl(menu, 1);
@@ -344,16 +332,11 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 1 unmodified line
344332
345333 scroll++;
346334
347− print_item(menu,
348− items[(scroll + max_choice -
349− 1) * 2 + 1],
335+ print_item(menu, items[(scroll + max_choice - 1) * 2 + 1],
350336 max_choice - 1, FALSE,
351− (items
352− [(scroll + max_choice -
353− 1) * 2][0] != ':'));
337+ (items [(scroll + max_choice - 1) * 2][0] != ':'));
354338 } else
355− choice =
356− MIN(choice + 1, max_choice - 1);
339+ choice = MIN(choice + 1, max_choice - 1);
357340
358341 } else if (key == KEY_PPAGE) {
359342 scrollok(menu, TRUE);
@@ -361,11 +344,8 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 1 unmodified line
361344 if (scroll > 0) {
362345 wscrl(menu, -1);
363346 scroll--;
364− print_item(menu,
365− items[scroll * 2 +
366− 1], 0, FALSE,
367− (items[scroll * 2][0]
368− != ':'));
347+ print_item(menu, items[scroll * 2 + 1], 0, FALSE,
348+ (items[scroll * 2][0] != ':'));
369349 } else {
370350 if (choice > 0)
371351 choice--;
@@ -380,17 +360,9 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 8 unmodified lines
380360 wscrl(menu, 1);
381361 scrollok(menu, FALSE);
382362 scroll++;
383− print_item(menu,
384− items[(scroll +
385− max_choice -
386− 1) * 2 + 1],
387− max_choice - 1,
388− FALSE,
389− (items
390− [(scroll +
391− max_choice -
392− 1) * 2][0] !=
393− ':'));
363+ print_item(menu, items[(scroll + max_choice - 1) * 2 + 1],
364+ max_choice - 1, FALSE,
365+ (items [(scroll + max_choice - 1) * 2][0] != ':'));
394366 } else {
395367 if (choice + 1 < max_choice)
396368 choice++;
@@ -401,8 +373,7 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 4 unmodified lines
401373 choice = i;
402374
403375 print_item(menu, items[(scroll + choice) * 2 + 1],
404− choice, TRUE,
405− (items[(scroll + choice) * 2][0] != ':'));
376+ choice, TRUE, (items[(scroll + choice) * 2][0] != ':'));
406377
407378 print_arrows(dialog, item_no, scroll,
408379 box_y, box_x + item_x + 1, menu_height);
@@ -460,9 +431,7 @@ dialog_menu(const char *title, const char *prompt, int height, int width, · 51 unmodified lines
460431 fprintf(stderr, "%s \"%s\"\n",
461432 items[(scroll + choice) * 2],
462433 items[(scroll + choice) * 2 + 1] +
463− first_alpha(items
464− [(scroll + choice) * 2 + 1],
465− ""));
434+ first_alpha(items [(scroll + choice) * 2 + 1], ""));
466435 else
467436 fprintf(stderr, "%s\n",
468437 items[(scroll + choice) * 2]);
scripts/lxdialog/msgbox.c+2−3
@@ -25,9 +25,8 @@ · 24 unmodified lines
2525 * Display a message box. Program will pause and display an "OK" button
2626 * if the parameter 'pause' is non-zero.
2727 */
28−int
29−dialog_msgbox(const char *title, const char *prompt, int height, int width,
30− int pause)
28+int dialog_msgbox(const char *title, const char *prompt, int height, int width,
29+ int pause)
3130 {
3231 int i, x, y, key = 0;
3332 WINDOW *dialog;
scripts/lxdialog/textbox.c+32−61
@@ -46,30 +46,26 @@ int dialog_textbox(const char *title, const char *file, int height, int width) · 45 unmodified lines
4646 /* Open input file for reading */
4747 if ((fd = open(file, O_RDONLY)) == -1) {
4848 endwin();
49− fprintf(stderr,
50− "\nCan't open input file in dialog_textbox().\n");
49+ fprintf(stderr, "\nCan't open input file in dialog_textbox().\n");
5150 exit(-1);
5251 }
5352 /* Get file size. Actually, 'file_size' is the real file size - 1,
5453 since it's only the last byte offset from the beginning */
5554 if ((file_size = lseek(fd, 0, SEEK_END)) == -1) {
5655 endwin();
57− fprintf(stderr,
58− "\nError getting file size in dialog_textbox().\n");
56+ fprintf(stderr, "\nError getting file size in dialog_textbox().\n");
5957 exit(-1);
6058 }
6159 /* Restore file pointer to beginning of file after getting file size */
6260 if (lseek(fd, 0, SEEK_SET) == -1) {
6361 endwin();
64− fprintf(stderr,
65− "\nError moving file pointer in dialog_textbox().\n");
62+ fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n");
6663 exit(-1);
6764 }
6865 /* Allocate space for read buffer */
6966 if ((buf = malloc(BUF_SIZE + 1)) == NULL) {
7067 endwin();
71− fprintf(stderr,
72− "\nCan't allocate memory in dialog_textbox().\n");
68+ fprintf(stderr, "\nCan't allocate memory in dialog_textbox().\n");
7369 exit(-1);
7470 }
7571 if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) {
@@ -150,23 +146,20 @@ int dialog_textbox(const char *title, const char *file, int height, int width) · 74 unmodified lines
150146 /* First page not in buffer? */
151147 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
152148 endwin();
153− fprintf(stderr,
154− "\nError moving file pointer in dialog_textbox().\n");
149+ fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n");
155150 exit(-1);
156151 }
157152 if (fpos > bytes_read) { /* Yes, we have to read it in */
158153 if (lseek(fd, 0, SEEK_SET) == -1) {
159154 endwin();
160− fprintf(stderr,
161− "\nError moving file pointer in "
162− "dialog_textbox().\n");
155+ fprintf(stderr, "\nError moving file pointer in "
156+ "dialog_textbox().\n");
163157 exit(-1);
164158 }
165159 if ((bytes_read =
166160 read(fd, buf, BUF_SIZE)) == -1) {
167161 endwin();
168− fprintf(stderr,
169− "\nError reading file in dialog_textbox().\n");
162+ fprintf(stderr, "\nError reading file in dialog_textbox().\n");
170163 exit(-1);
171164 }
172165 buf[bytes_read] = '\0';
@@ -185,22 +178,19 @@ int dialog_textbox(const char *title, const char *file, int height, int width) · 12 unmodified lines
185178 /* Last page not in buffer? */
186179 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
187180 endwin();
188− fprintf(stderr,
189− "\nError moving file pointer in dialog_textbox().\n");
181+ fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n");
190182 exit(-1);
191183 }
192184 if (fpos < file_size) { /* Yes, we have to read it in */
193185 if (lseek(fd, -BUF_SIZE, SEEK_END) == -1) {
194186 endwin();
195− fprintf(stderr,
196− "\nError moving file pointer in dialog_textbox().\n");
187+ fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n");
197188 exit(-1);
198189 }
199190 if ((bytes_read =
200191 read(fd, buf, BUF_SIZE)) == -1) {
201192 endwin();
202− fprintf(stderr,
203− "\nError reading file in dialog_textbox().\n");
193+ fprintf(stderr, "\nError reading file in dialog_textbox().\n");
204194 exit(-1);
205195 }
206196 buf[bytes_read] = '\0';
@@ -342,9 +332,8 @@ static void back_lines(int n) · 135 unmodified lines
342332 if (page == buf) {
343333 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
344334 endwin();
345− fprintf(stderr,
346− "\nError moving file pointer in "
347− "back_lines().\n");
335+ fprintf(stderr, "\nError moving file pointer in "
336+ "back_lines().\n");
348337 exit(-1);
349338 }
350339 if (fpos > bytes_read) { /* Not beginning of file yet */
@@ -358,21 +347,16 @@ static void back_lines(int n) · 7 unmodified lines
358347 /* No, move less then */
359348 if (lseek(fd, 0, SEEK_SET) == -1) {
360349 endwin();
361− fprintf(stderr,
362− "\nError moving file pointer in "
363− "back_lines().\n");
350+ fprintf(stderr, "\nError moving file pointer in "
351+ "back_lines().\n");
364352 exit(-1);
365353 }
366354 page = buf + fpos - bytes_read;
367355 } else { /* Move backward BUF_SIZE/2 bytes */
368− if (lseek
369− (fd, -(BUF_SIZE / 2 + bytes_read),
370− SEEK_CUR)
371− == -1) {
356+ if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) {
372357 endwin();
373− fprintf(stderr,
374− "\nError moving file pointer "
375− "in back_lines().\n");
358+ fprintf(stderr, "\nError moving file pointer "
359+ "in back_lines().\n");
376360 exit(-1);
377361 }
378362 page = buf + BUF_SIZE / 2;
@@ -380,8 +364,7 @@ static void back_lines(int n) · 1 unmodified line
380364 if ((bytes_read =
381365 read(fd, buf, BUF_SIZE)) == -1) {
382366 endwin();
383− fprintf(stderr,
384− "\nError reading file in back_lines().\n");
367+ fprintf(stderr, "\nError reading file in back_lines().\n");
385368 exit(-1);
386369 }
387370 buf[bytes_read] = '\0';
@@ -403,33 +386,25 @@ static void back_lines(int n) · 15 unmodified lines
403386 if (page == buf) {
404387 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
405388 endwin();
406− fprintf(stderr,
407− "\nError moving file pointer in back_lines().\n");
389+ fprintf(stderr, "\nError moving file pointer in back_lines().\n");
408390 exit(-1);
409391 }
410392 if (fpos > bytes_read) {
411393 /* Really possible to move backward BUF_SIZE/2 bytes? */
412394 if (fpos < BUF_SIZE / 2 + bytes_read) {
413395 /* No, move less then */
414− if (lseek(fd, 0, SEEK_SET) ==
415− -1) {
396+ if (lseek(fd, 0, SEEK_SET) == -1) {
416397 endwin();
417− fprintf(stderr,
418− "\nError moving file pointer "
419− "in back_lines().\n");
398+ fprintf(stderr, "\nError moving file pointer "
399+ "in back_lines().\n");
420400 exit(-1);
421401 }
422402 page = buf + fpos - bytes_read;
423403 } else { /* Move backward BUF_SIZE/2 bytes */
424− if (lseek
425− (fd,
426− -(BUF_SIZE / 2 +
427− bytes_read),
428− SEEK_CUR) == -1) {
404+ if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) {
429405 endwin();
430− fprintf(stderr,
431− "\nError moving file pointer"
432− " in back_lines().\n");
406+ fprintf(stderr, "\nError moving file pointer"
407+ " in back_lines().\n");
433408 exit(-1);
434409 }
435410 page = buf + BUF_SIZE / 2;
@@ -437,9 +412,8 @@ static void back_lines(int n) · 1 unmodified line
437412 if ((bytes_read =
438413 read(fd, buf, BUF_SIZE)) == -1) {
439414 endwin();
440− fprintf(stderr,
441− "\nError reading file in "
442− "back_lines().\n");
415+ fprintf(stderr, "\nError reading file in "
416+ "back_lines().\n");
443417 exit(-1);
444418 }
445419 buf[bytes_read] = '\0';
@@ -513,9 +487,8 @@ static char *get_line(void) · 67 unmodified lines
513487 /* Either end of file or end of buffer reached */
514488 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
515489 endwin();
516− fprintf(stderr,
517− "\nError moving file pointer in "
518− "get_line().\n");
490+ fprintf(stderr, "\nError moving file pointer in "
491+ "get_line().\n");
519492 exit(-1);
520493 }
521494 if (fpos < file_size) { /* Not end of file yet */
@@ -524,8 +497,7 @@ static char *get_line(void) · 2 unmodified lines
524497 if ((bytes_read =
525498 read(fd, buf, BUF_SIZE)) == -1) {
526499 endwin();
527− fprintf(stderr,
528− "\nError reading file in get_line().\n");
500+ fprintf(stderr, "\nError reading file in get_line().\n");
529501 exit(-1);
530502 }
531503 buf[bytes_read] = '\0';
@@ -561,8 +533,7 @@ static void print_position(WINDOW * win, int height, int width) · 29 unmodified lines
561533
562534 if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) {
563535 endwin();
564− fprintf(stderr,
565− "\nError moving file pointer in print_position().\n");
536+ fprintf(stderr, "\nError moving file pointer in print_position().\n");
566537 exit(-1);
567538 }
568539 wattrset(win, position_indicator_attr);
scripts/lxdialog/util.c+1−1
@@ -28,7 +28,7 @@ const char *backtitle = NULL; · 27 unmodified lines
2828
2929 const char *dialog_result;
3030
31−/*
31+/*
3232 * Attribute values, default is for mono display
3333 */
3434 chtype attributes[] = {
scripts/lxdialog/yesno.c+1−2
@@ -96,8 +96,7 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) · 95 unmodified lines
9696 case TAB:
9797 case KEY_LEFT:
9898 case KEY_RIGHT:
99− button = ((key == KEY_LEFT ? --button : ++button) < 0)
100− ? 1 : (button > 1 ? 0 : button);
99+ button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button);
101100
102101 print_buttons(dialog, height, width, button);
103102 wrefresh(dialog);