X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2Ftest.c;h=037a6e7c9ac13bf023903665b8a4f5fd8e62dbe8;hb=refs%2Ftags%2Fupstream%2F1.5.pre1;hp=40192017ebc314e806540a40d7dead65d98ebeea;hpb=67fc54773e1504698e80c9cb83977bde32665350;p=ap-utils.git diff --git a/lib/test.c b/lib/test.c index 4019201..037a6e7 100644 --- a/lib/test.c +++ b/lib/test.c @@ -22,7 +22,6 @@ #include #include #include "ap-utils.h" -#include "ap-curses.h" #define TEST_MODE _("[T] Test mode: ") #define ANTENNA _("[A] Antenna: ") @@ -34,10 +33,10 @@ extern WINDOW *main_sub; extern short ap_type; +extern char *channels[]; void test() { - struct TestModeCommandStruct_ATMEL410 { unsigned char Channel; unsigned char Antenna; @@ -70,11 +69,10 @@ void test() char message[1024], *antenna[2] = { _("Left"), _("Right") }, *filer[2] = { "EN", "US"}, *rates[4] = { - "1", "2", "5.5", "11"}, *item_name[14]; + "1", "2", "5.5", "11"}; char teston = 2, *commands[4] = { "CONTINUOUS_TX", "CONTINUOUS_RX", "CARRIER_ACCURACY", "IDLE" }; varbind varbinds[5]; - int ch_num = 0, i; if (ap_type == ATMEL12350) { TestModeOnOff[5] = 0xE0; @@ -85,32 +83,18 @@ void test() TestModeStatistics[6] = 0x3E; } - print_title(_("Test mode")); + print_top(NULL, _("Test mode")); mvwaddstr(main_sub, 3, 6, _ ("Using the \"Test mode\" may cause loss of your current")); mvwaddstr(main_sub, 4, 6, _("configuration.")); mvwaddstr(main_sub, 6, 20, _("Do you want to continue? ")); wrefresh(main_sub); - print_help(_("(Y - Yes; N - No (it's safer to answer No.)")); - i = 1; - while (i) - switch (getch()) { - case 'Y': - case 'y': - clear_main(3); - i = 0; - break; - case 'n': - case 'N': - clear_main(3); - goto quit; - } - if ((ch_num = ch_list(0, item_name)) == 0) { - print_helperr(ERR_RET); - goto exit; - } + if (help_ysn()) + goto quit; + + print_help(__HELP); sprintf(message, "%s%s", TEST_MODE, OFF); mvwaddstr(main_sub, 0, 0, message); @@ -146,7 +130,6 @@ void test() wrefresh(main_sub); noecho(); - print_help(__HELP); while (1) { switch (getch()) { case 'Q': @@ -229,8 +212,8 @@ void test() continue; case 'C': case 'c': - testmode.Channel = menu_choose(3, strlen(CHANNEL), item_name, - ch_num) + 1; + testmode.Channel = menu_choose(3, strlen(CHANNEL), channels, + 14) + 1; clear_main_new(3, 4); sprintf(message, "%02u (%u MHz)", testmode.Channel, 2407 + 5 * testmode.Channel); @@ -290,10 +273,7 @@ void test() print_help(ANY_KEY); exit: getch(); - /* free memory allocated for channel list */ - for (i = 0; i < ch_num; i++) - free(item_name[i]); quit: - print_title(""); + print_top(NULL, NULL); clear_main(0); }