-rw-r--r-- | scripts/lxdialog/Makefile | 32 | ||||
-rwxr-xr-x | scripts/lxdialog/lxdialog | bin | 37159 -> 0 bytes | |||
-rw-r--r-- | scripts/lxdialog/util.c | 2 |
3 files changed, 20 insertions, 14 deletions
diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile index 75b7bac..b34bbc3 100644 --- a/scripts/lxdialog/Makefile +++ b/scripts/lxdialog/Makefile | |||
@@ -1,44 +1,50 @@ | |||
1 | HOST_CFLAGS := -DLOCALE | 1 | HOST_EXTRACFLAGS := -DLOCALE |
2 | HOST_LDFLAGS := -lncurses | 2 | HOST_LOADLIBES := -lncurses |
3 | HOSTCC = gcc | ||
3 | 4 | ||
4 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) | 5 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) |
5 | HOST_CFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" | 6 | HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" |
6 | else | 7 | else |
7 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) | 8 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) |
8 | HOST_CFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" | 9 | HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" |
9 | else | 10 | else |
10 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) | 11 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) |
11 | HOST_CFLAGS += -DCURSES_LOC="<ncurses.h>" | 12 | HOST_EXTRACFLAGS += -DCURSES_LOC="<ncurses.h>" |
12 | else | 13 | else |
13 | HOST_CFLAGS += -DCURSES_LOC="<curses.h>" | 14 | HOST_EXTRACFLAGS += -DCURSES_LOC="<curses.h>" |
14 | endif | 15 | endif |
15 | endif | 16 | endif |
16 | endif | 17 | endif |
17 | 18 | ||
18 | host-progs := lxdialog | 19 | host-progs := lxdialog |
20 | always := $(host-progs) | ||
19 | 21 | ||
20 | lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ | 22 | lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ |
21 | util.o lxdialog.o msgbox.o | 23 | util.o lxdialog.o msgbox.o |
22 | 24 | ||
23 | EXTRA_TARGETS := lxdialog | 25 | first_rule: ncurses lxdialog |
24 | |||
25 | first_rule: ncurses | ||
26 | |||
27 | include $(TOPDIR)/Rules.make | ||
28 | 26 | ||
29 | .PHONY: ncurses | 27 | .PHONY: ncurses |
30 | |||
31 | ncurses: | 28 | ncurses: |
32 | @echo "main() {}" > lxtemp.c | 29 | @echo "main() {}" > lxtemp.c |
33 | @if $(HOSTCC) $(HOST_CFLAGS) lxtemp.c $(HOST_LDFLAGS); then \ | 30 | @if $(HOSTCC) lxtemp.c $(HOST_LOADLIBES); then \ |
34 | rm -f lxtemp.c a.out; \ | 31 | rm -f lxtemp.c a.out; \ |
35 | else \ | 32 | else \ |
36 | rm -f lxtemp.c; \ | 33 | rm -f lxtemp.c; \ |
37 | echo -e "\007" ;\ | 34 | echo -e "\007" ;\ |
38 | echo ">> Unable to find the Ncurses libraries." ;\ | 35 | echo ">> Unable to find the Ncurses libraries." ;\ |
39 | echo ">>" ;\ | 36 | echo ">>" ;\ |
40 | echo ">> You must have Ncurses installed in order" ;\ | 37 | echo ">> You must have Ncurses installed in order" ;\ |
41 | echo ">> to use 'make menuconfig'" ;\ | 38 | echo ">> to use 'make menuconfig'" ;\ |
42 | echo ;\ | 39 | echo ;\ |
43 | exit 1 ;\ | 40 | exit 1 ;\ |
44 | fi | 41 | fi |
42 | |||
43 | clean: | ||
44 | rm -f $(lxdialog-objs) lxdialog | ||
45 | |||
46 | %.o: %.c | ||
47 | $(HOSTCC) $(HOST_EXTRACFLAGS) -fPIC -c $^ -o $@ | ||
48 | |||
49 | lxdialog: $(lxdialog-objs) | ||
50 | $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) $^ -o $@ | ||
diff --git a/scripts/lxdialog/lxdialog b/scripts/lxdialog/lxdialog deleted file mode 100755 index f0dca91..0000000 --- a/scripts/lxdialog/lxdialog +++ b/dev/null | |||
Binary files differ | |||
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c index b3a7af9..e7bce9b 100644 --- a/scripts/lxdialog/util.c +++ b/scripts/lxdialog/util.c | |||
@@ -303,57 +303,57 @@ draw_box (WINDOW * win, int y, int x, int height, int width, | |||
303 | else if (!i) | 303 | else if (!i) |
304 | waddch (win, border | ACS_HLINE); | 304 | waddch (win, border | ACS_HLINE); |
305 | else if (i == height - 1) | 305 | else if (i == height - 1) |
306 | waddch (win, box | ACS_HLINE); | 306 | waddch (win, box | ACS_HLINE); |
307 | else if (!j) | 307 | else if (!j) |
308 | waddch (win, border | ACS_VLINE); | 308 | waddch (win, border | ACS_VLINE); |
309 | else if (j == width - 1) | 309 | else if (j == width - 1) |
310 | waddch (win, box | ACS_VLINE); | 310 | waddch (win, box | ACS_VLINE); |
311 | else | 311 | else |
312 | waddch (win, box | ' '); | 312 | waddch (win, box | ' '); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | /* | 316 | /* |
317 | * Draw shadows along the right and bottom edge to give a more 3D look | 317 | * Draw shadows along the right and bottom edge to give a more 3D look |
318 | * to the boxes | 318 | * to the boxes |
319 | */ | 319 | */ |
320 | void | 320 | void |
321 | draw_shadow (WINDOW * win, int y, int x, int height, int width) | 321 | draw_shadow (WINDOW * win, int y, int x, int height, int width) |
322 | { | 322 | { |
323 | int i; | 323 | int i; |
324 | 324 | ||
325 | if (has_colors ()) {/* Whether terminal supports color? */ | 325 | if (has_colors ()) {/* Whether terminal supports color? */ |
326 | wattrset (win, shadow_attr); | 326 | wattrset (win, shadow_attr); |
327 | wmove (win, y + height, x + 2); | 327 | wmove (win, y + height, x + 2); |
328 | for (i = 0; i < width; i++) | 328 | for (i = 0; i < width; i++) |
329 | waddch (win, winch (win) & A_CHARTEXT); | 329 | waddch (win, winch (win) & A_CHARTEXT); |
330 | for (i = y + 1; i < y + height + 1; i++) { | 330 | for (i = y + 1; i < y + height + 1; i++) { |
331 | wmove (win, i, x + width); | 331 | wmove (win, i, x + width); |
332 | waddch (win, winch (win) & A_CHARTEXT); | 332 | waddch (win, winch (win) & A_CHARTEXT); |
333 | waddch (win, winch (win) & A_CHARTEXT); | 333 | waddch (win, winch (win) & A_CHARTEXT); |
334 | } | 334 | } |
335 | wnoutrefresh (win); | 335 | wnoutrefresh (win); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | /* | 339 | /* |
340 | * Return the position of the first alphabetic character in a string. | 340 | * Return the position of the first alphabetic character in a string. |
341 | */ | 341 | */ |
342 | int | 342 | int |
343 | first_alpha(const char *string, const char *exempt) | 343 | first_alpha(const char *string, const char *exempt) |
344 | { | 344 | { |
345 | int i, in_paren=0, c; | 345 | int i, in_paren=0, c; |
346 | 346 | ||
347 | for (i = 0; i < strlen(string); i++) { | 347 | for (i = 0; i < strlen(string); i++) { |
348 | c = tolower(string[i]); | 348 | c = tolower(string[i]); |
349 | 349 | ||
350 | if (strchr("<[(", c)) ++in_paren; | 350 | if (strchr("<[(", c)) ++in_paren; |
351 | if (strchr(">])", c)) --in_paren; | 351 | if (strchr(">])", c) && in_paren > 0) --in_paren; |
352 | 352 | ||
353 | if ((! in_paren) && isalpha(c) && | 353 | if ((! in_paren) && isalpha(c) && |
354 | strchr(exempt, c) == 0) | 354 | strchr(exempt, c) == 0) |
355 | return i; | 355 | return i; |
356 | } | 356 | } |
357 | 357 | ||
358 | return 0; | 358 | return 0; |
359 | } | 359 | } |