"Fossies" - the Fresh Open Source Software Archive

Member "PDCurses-3.9/demos/testcurs.c" (4 Sep 2019, 32442 Bytes) of package /linux/misc/PDCurses-3.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "testcurs.c": 3.8_vs_3.9.

    1 /*
    2  * This is a test program for PDCurses. Originally by
    3  * John Burnell <johnb@kea.am.dsir.govt.nz>
    4  *
    5  *  wrs (1993-05-28) -- modified to be consistent (perform identically)
    6  *                      with either PDCurses or under Unix System V, R4
    7  */
    8 
    9 #ifndef _XOPEN_SOURCE_EXTENDED
   10 # define _XOPEN_SOURCE_EXTENDED 1
   11 #endif
   12 
   13 #include <stdio.h>
   14 #include <ctype.h>
   15 #include <string.h>
   16 #include <curses.h>
   17 
   18 #ifdef WACS_S1
   19 # define HAVE_WIDE 1
   20 #else
   21 # define HAVE_WIDE 0
   22 #endif
   23 
   24 #include <locale.h>
   25 
   26 #if HAVE_WIDE
   27 # include <wchar.h>
   28 #endif
   29 
   30 #if defined(PDCURSES) && !defined(XCURSES)
   31 # define HAVE_RESIZE 1
   32 #else
   33 # define HAVE_RESIZE 0
   34 #endif
   35 
   36 #ifdef A_COLOR
   37 # define HAVE_COLOR 1
   38 #else
   39 # define HAVE_COLOR 0
   40 #endif
   41 
   42 #ifdef PDCURSES
   43 # define HAVE_CLIPBOARD 1
   44 #else
   45 # define HAVE_CLIPBOARD 0
   46 #endif
   47 
   48 void inputTest(WINDOW *);
   49 void scrollTest(WINDOW *);
   50 void introTest(WINDOW *);
   51 int initTest(WINDOW **, int, char **);
   52 void outputTest(WINDOW *);
   53 void padTest(WINDOW *);
   54 void acsTest(WINDOW *);
   55 void attrTest(WINDOW *);
   56 
   57 #if HAVE_COLOR
   58 void colorTest(WINDOW *);
   59 #endif
   60 
   61 #if HAVE_RESIZE
   62 void resizeTest(WINDOW *);
   63 #endif
   64 
   65 #if HAVE_CLIPBOARD
   66 void clipboardTest(WINDOW *);
   67 #endif
   68 
   69 #if HAVE_WIDE
   70 void wideTest(WINDOW *);
   71 #endif
   72 
   73 void display_menu(int, int);
   74 
   75 struct commands
   76 {
   77     const char *text;
   78     void (*function)(WINDOW *);
   79 };
   80 
   81 typedef struct commands COMMAND;
   82 
   83 #define MAX_OPTIONS (7 + HAVE_COLOR + HAVE_RESIZE + HAVE_CLIPBOARD + HAVE_WIDE)
   84 
   85 COMMAND command[MAX_OPTIONS] =
   86 {
   87     {"Intro Test", introTest},
   88     {"Pad Test", padTest},
   89 #if HAVE_RESIZE
   90     {"Resize Test", resizeTest},
   91 #endif
   92     {"Scroll Test", scrollTest},
   93     {"Input Test", inputTest},
   94     {"Output Test", outputTest},
   95     {"ACS Test", acsTest},
   96     {"Attrib Test", attrTest},
   97 #if HAVE_COLOR
   98     {"Color Test", colorTest},
   99 #endif
  100 #if HAVE_CLIPBOARD
  101     {"Clipboard Test", clipboardTest},
  102 #endif
  103 #if HAVE_WIDE
  104     {"Wide Input", wideTest}
  105 #endif
  106 };
  107 
  108 int width, height;
  109 
  110 int main(int argc, char *argv[])
  111 {
  112     WINDOW *win;
  113     int key, old_option = -1, new_option = 0;
  114     bool quit = FALSE;
  115 
  116     setlocale(LC_ALL, "");
  117 
  118     if (initTest(&win, argc, argv))
  119         return 1;
  120 
  121 #ifdef A_COLOR
  122     if (has_colors())
  123     {
  124         init_pair(1, COLOR_WHITE, COLOR_BLUE);
  125         wbkgd(win, COLOR_PAIR(1));
  126     }
  127     else
  128 #endif
  129         wbkgd(win, A_REVERSE);
  130 
  131     erase();
  132     display_menu(old_option, new_option);
  133 
  134     while (1)
  135     {
  136         noecho();
  137         keypad(stdscr, TRUE);
  138         raw();
  139 
  140         key = getch();
  141 
  142         switch(key)
  143         {
  144         case 10:
  145         case 13:
  146         case KEY_ENTER:
  147             old_option = -1;
  148             erase();
  149             refresh();
  150             (*command[new_option].function)(win);
  151             erase();
  152             display_menu(old_option, new_option);
  153             break;
  154 
  155         case KEY_PPAGE:
  156         case KEY_HOME:
  157             old_option = new_option;
  158             new_option = 0;
  159             display_menu(old_option, new_option);
  160             break;
  161 
  162         case KEY_NPAGE:
  163         case KEY_END:
  164             old_option = new_option;
  165             new_option = MAX_OPTIONS - 1;
  166             display_menu(old_option, new_option);
  167             break;
  168 
  169         case KEY_UP:
  170             old_option = new_option;
  171             new_option = (new_option == 0) ?
  172                 new_option : new_option - 1;
  173             display_menu(old_option, new_option);
  174             break;
  175 
  176         case KEY_DOWN:
  177             old_option = new_option;
  178             new_option = (new_option == MAX_OPTIONS - 1) ?
  179                 new_option : new_option + 1;
  180             display_menu(old_option, new_option);
  181             break;
  182 #ifdef KEY_RESIZE
  183         case KEY_RESIZE:
  184 # ifdef PDCURSES
  185             resize_term(0, 0);
  186 # endif
  187             old_option = -1;
  188             erase();
  189             display_menu(old_option, new_option);
  190             break;
  191 #endif
  192         case 'Q':
  193         case 'q':
  194             quit = TRUE;
  195         }
  196 
  197         if (quit == TRUE)
  198             break;
  199     }
  200 
  201     delwin(win);
  202     endwin();
  203 
  204     return 0;
  205 }
  206 
  207 void Continue(WINDOW *win)
  208 {
  209     mvwaddstr(win, 10, 1, " Press any key to continue");
  210     wrefresh(win);
  211     raw();
  212     wgetch(win);
  213 }
  214 
  215 void Continue2(void)
  216 {
  217     move(LINES - 1, 1);
  218     clrtoeol();
  219     mvaddstr(LINES - 2, 1, " Press any key to continue");
  220     refresh();
  221     raw();
  222     getch();
  223 }
  224 
  225 int initTest(WINDOW **win, int argc, char *argv[])
  226 {
  227 #ifdef XCURSES
  228     Xinitscr(argc, argv);
  229 #else
  230     initscr();
  231 #endif
  232 #ifdef A_COLOR
  233     if (has_colors())
  234         start_color();
  235 #endif
  236     /* Create a drawing window */
  237 
  238     width  = 60;
  239     height = 13;
  240 
  241     *win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
  242 
  243     if (*win == NULL)
  244     {
  245         endwin();
  246         return 1;
  247     }
  248 
  249     return 0;
  250 }
  251 
  252 void introTest(WINDOW *win)
  253 {
  254     werase(win);
  255     wmove(win, height / 2 - 5, width / 2);
  256     wvline(win, ACS_VLINE, 10);
  257     wmove(win, height / 2, width / 2 - 10);
  258     whline(win, ACS_HLINE, 20);
  259     Continue(win);
  260 
  261     beep();
  262     werase(win);
  263 
  264     box(win, ACS_VLINE, ACS_HLINE);
  265     wrefresh(win);
  266 
  267     cbreak();
  268     mvwaddstr(win, 1, 1,
  269         "You should have a rectangle in the middle of the screen");
  270     mvwaddstr(win, 2, 1, "You should have heard a beep");
  271     Continue(win);
  272 
  273     flash();
  274     mvwaddstr(win, 3, 1, "You should have seen a flash");
  275     Continue(win);
  276 }
  277 
  278 void scrollTest(WINDOW *win)
  279 {
  280     int i, OldY;
  281 #ifndef PDCURSES
  282     int OldX;
  283 #endif
  284     werase(win);
  285     mvwaddstr(win, height - 2, 1, "The window will now scroll slowly");
  286     box(win, ACS_VLINE, ACS_HLINE);
  287     wrefresh(win);
  288     scrollok(win, TRUE);
  289     napms(500);
  290 
  291     for (i = 1; i <= height; i++)
  292     {
  293         napms(150);
  294         scroll(win);
  295         wrefresh(win);
  296     };
  297 
  298 #ifdef PDCURSES
  299     OldY = getmaxy(win);
  300 #else
  301     getmaxyx(win, OldY, OldX);
  302 #endif
  303     mvwaddstr(win, 6, 1, "The top of the window will scroll");
  304     wmove(win, 1, 1);
  305     wsetscrreg(win, 0, 4);
  306     box(win, ACS_VLINE, ACS_HLINE);
  307     wrefresh(win);
  308 
  309     for (i = 1; i <= 5; i++)
  310     {
  311         napms(500);
  312         scroll(win);
  313         wrefresh(win);
  314     }
  315 
  316     mvwaddstr(win, 3, 1, "The bottom of the window will scroll");
  317     wmove(win, 8, 1);
  318     wsetscrreg(win, 5, --OldY);
  319     box(win, ACS_VLINE, ACS_HLINE);
  320     wrefresh(win);
  321 
  322     for (i = 5; i <= OldY; i++)
  323     {
  324         napms(300);
  325         wscrl(win, -1);
  326         wrefresh(win);
  327     }
  328 
  329     wsetscrreg(win, 0, OldY);
  330 }
  331 
  332 void inputTest(WINDOW *win)
  333 {
  334     int w, h, bx, by, sw, sh, i, c, num = 0;
  335     char buffer[80];
  336     WINDOW *subWin;
  337     static const char spinner[5] = "/-\\|";
  338     int spinner_count = 0;
  339 
  340     wclear(win);
  341 
  342     getmaxyx(win, h, w);
  343     getbegyx(win, by, bx);
  344 
  345     sw = w / 3;
  346     sh = h / 3;
  347 
  348     if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2))
  349         == NULL)
  350         return;
  351 
  352 #ifdef A_COLOR
  353     if (has_colors())
  354     {
  355         init_pair(2, COLOR_WHITE, COLOR_RED);
  356         wbkgd(subWin, COLOR_PAIR(2) | A_BOLD);
  357     }
  358     else
  359 #endif
  360         wbkgd(subWin, A_BOLD);
  361 
  362     box(subWin, ACS_VLINE, ACS_HLINE);
  363     wrefresh(win);
  364 
  365     nocbreak();
  366 
  367     wclear (win);
  368     mvwaddstr(win, 1, 1,
  369         "Press keys (or mouse buttons) to show their names");
  370     mvwaddstr(win, 2, 1, "Press spacebar to finish");
  371     wrefresh(win);
  372 
  373     keypad(win, TRUE);
  374     raw();
  375     noecho();
  376 
  377     wtimeout(win, 200);
  378 
  379 #ifdef PDCURSES
  380     mouse_set(ALL_MOUSE_EVENTS);
  381     PDC_return_key_modifiers(TRUE);
  382 #endif
  383     curs_set(0);        /* turn cursor off */
  384 
  385     while (1)
  386     {
  387         while (1)
  388         {
  389             c = wgetch(win);
  390 
  391             if (c == ERR)
  392             {
  393                 spinner_count++;
  394                 if (spinner_count == 4)
  395                     spinner_count = 0;
  396                 mvwaddch(win, 3, 3, spinner[spinner_count]);
  397                 wrefresh(win);
  398             }
  399             else
  400                 break;
  401         }
  402 #ifdef PDCURSES
  403         wmove(win, 4, 18);
  404         wclrtoeol(win);
  405 #endif
  406         mvwaddstr(win, 3, 5, "Key Pressed: ");
  407         wclrtoeol(win);
  408 
  409         if (c >= KEY_MIN)
  410             wprintw(win, "%s", keyname(c));
  411         else if (isprint(c))
  412             wprintw(win, "%c", c);
  413         else
  414             wprintw(win, "%s", unctrl(c));
  415 #ifdef PDCURSES
  416         if (c == KEY_MOUSE)
  417         {
  418             int button = 0;
  419             request_mouse_pos();
  420 
  421             if (BUTTON_CHANGED(1))
  422                 button = 1;
  423             else if (BUTTON_CHANGED(2))
  424                 button = 2;
  425             else if (BUTTON_CHANGED(3))
  426                 button = 3;
  427 
  428             if (button && (BUTTON_STATUS(button) &
  429                 BUTTON_MODIFIER_MASK))
  430             {
  431                 waddstr(win, " Modifier(s):");
  432 
  433                 if (BUTTON_STATUS(button) & BUTTON_SHIFT)
  434                     waddstr(win, " SHIFT");
  435 
  436                 if (BUTTON_STATUS(button) & BUTTON_CONTROL)
  437                     waddstr(win, " CONTROL");
  438 
  439                 if (BUTTON_STATUS(button) & BUTTON_ALT)
  440                     waddstr(win, " ALT");
  441             }
  442 
  443             wmove(win, 4, 18);
  444             wclrtoeol(win);
  445             wprintw(win, "Button %d: ", button);
  446 
  447             if (MOUSE_MOVED)
  448                 waddstr(win, "moved: ");
  449             else if (MOUSE_WHEEL_UP)
  450                 waddstr(win, "wheel up: ");
  451             else if (MOUSE_WHEEL_DOWN)
  452                 waddstr(win, "wheel dn: ");
  453             else if (MOUSE_WHEEL_LEFT)
  454                 waddstr(win, "wheel lt: ");
  455             else if (MOUSE_WHEEL_RIGHT)
  456                 waddstr(win, "wheel rt: ");
  457             else if ((BUTTON_STATUS(button) &
  458                 BUTTON_ACTION_MASK) == BUTTON_PRESSED)
  459                 waddstr(win, "pressed: ");
  460             else if ((BUTTON_STATUS(button) &
  461                 BUTTON_ACTION_MASK) == BUTTON_CLICKED)
  462                 waddstr(win, "clicked: ");
  463             else if ((BUTTON_STATUS(button) &
  464                 BUTTON_ACTION_MASK) == BUTTON_DOUBLE_CLICKED)
  465                 waddstr(win, "double: ");
  466             else
  467                 waddstr(win, "released: ");
  468 
  469             wprintw(win, "Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS);
  470         }
  471         else if (PDC_get_key_modifiers())
  472         {
  473             waddstr(win, " Modifier(s):");
  474             if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_SHIFT)
  475                 waddstr(win, " SHIFT");
  476 
  477             if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_CONTROL)
  478                 waddstr(win, " CONTROL");
  479 
  480             if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_ALT)
  481                 waddstr(win, " ALT");
  482 
  483             if (PDC_get_key_modifiers() & PDC_KEY_MODIFIER_NUMLOCK)
  484                 waddstr(win, " NUMLOCK");
  485         }
  486 #endif
  487         wrefresh(win);
  488 
  489         if (c == ' ')
  490             break;
  491     }
  492 
  493     wtimeout(win, -1);  /* turn off timeout() */
  494     curs_set(1);        /* turn cursor back on */
  495 
  496 #ifdef PDCURSES
  497     mouse_set(0L);
  498     PDC_return_key_modifiers(FALSE);
  499 #endif
  500     wclear(win);
  501     mvwaddstr(win, 2, 1, "Press some keys for 5 seconds");
  502     mvwaddstr(win, 1, 1, "Pressing ^C should do nothing");
  503     wrefresh(win);
  504 
  505     werase(subWin);
  506     box(subWin, ACS_VLINE, ACS_HLINE);
  507 
  508     for (i = 0; i < 5; i++)
  509     {
  510         mvwprintw(subWin, 1, 1, "Time = %d", i);
  511         wrefresh(subWin);
  512         napms(1000);
  513         flushinp();
  514     }
  515 
  516     delwin(subWin);
  517     werase(win);
  518     flash();
  519     wrefresh(win);
  520     napms(500);
  521     flushinp();
  522 
  523     mvwaddstr(win, 2, 1, "Press a key, followed by ENTER");
  524     wmove(win, 9, 10);
  525     wrefresh(win);
  526     echo();
  527 
  528     keypad(win, TRUE);
  529     raw();
  530     wgetnstr(win, buffer, 3);
  531     flushinp();
  532 
  533     wmove(win, 9, 10);
  534     wdelch(win);
  535     mvwaddstr(win, 4, 1, "The character should now have been deleted");
  536     Continue(win);
  537 
  538     refresh();
  539     wclear(win);
  540     echo();
  541     buffer[0] = '\0';
  542     mvwaddstr(win, 3, 2, "The window should have moved");
  543     mvwaddstr(win, 4, 2,
  544               "This text should have appeared without you pressing a key");
  545     mvwaddstr(win, 6, 2, "Enter a number then a string seperated by space");
  546     mvwin(win, 2, 1);
  547     wrefresh(win);
  548     mvwscanw(win, 7, 6, "%d %s", &num, buffer);
  549     mvwprintw(win, 8, 6, "String: %s Number: %d", buffer, num);
  550     Continue(win);
  551 
  552     refresh();
  553     wclear(win);
  554     echo();
  555     mvwaddstr(win, 3, 2, "Enter a 5 character string: ");
  556     wgetnstr(win, buffer, 5);
  557     mvwprintw(win, 4, 2, "String: %s", buffer);
  558     Continue(win);
  559 }
  560 
  561 void outputTest(WINDOW *win)
  562 {
  563     WINDOW *win1;
  564     char Buffer[80];
  565     chtype ch;
  566     int by, bx;
  567 
  568 #ifdef PDCURSES
  569     PDC_set_blink(TRUE);
  570 #endif
  571     nl();
  572     wclear(win);
  573     mvwaddstr(win, 1, 1, "You should now have a screen in the upper "
  574                          "left corner, and this text should have wrapped");
  575     waddstr(win,"\nThis text should be down\n");
  576     waddstr(win,  "and broken into two here ^");
  577     Continue(win);
  578 
  579     wclear(win);
  580     wattron(win, A_BOLD);
  581     mvwaddstr(win, 1, 1, "A new window will appear with this text in it");
  582     mvwaddstr(win, 8, 1, "Press any key to continue");
  583     wrefresh(win);
  584     wgetch(win);
  585 
  586     getbegyx(win, by, bx);
  587 
  588     if (LINES < 24 || COLS < 75)
  589     {
  590         mvwaddstr(win, 5, 1, "Some tests have been skipped as they require a");
  591         mvwaddstr(win, 6, 1, "display of at least 24 LINES by 75 COLUMNS");
  592         Continue(win);
  593     }
  594     else
  595     {
  596         win1 = newwin(10, 50, 14, 25);
  597 
  598         if (win1 == NULL)
  599         {
  600             endwin();
  601             return;
  602         }
  603 
  604 #ifdef A_COLOR
  605         if (has_colors())
  606         {
  607             init_pair(3, COLOR_BLUE, COLOR_WHITE);
  608             wbkgd(win1, COLOR_PAIR(3));
  609         }
  610         else
  611 #endif
  612             wbkgd(win1, A_NORMAL);
  613 
  614         wclear(win1);
  615         mvwaddstr(win1, 5, 1, "This text should appear; using overlay option");
  616         copywin(win, win1, 0, 0, 0, 0, 9, 49, TRUE);
  617         box(win1, ACS_VLINE, ACS_HLINE);
  618         wmove(win1, 8, 26);
  619         wrefresh(win1);
  620         wgetch(win1);
  621 
  622         wclear(win1);
  623 
  624         wattron(win1, A_BLINK);
  625         mvwaddstr(win1, 4, 1,
  626                   "This blinking text should appear in only the second window");
  627         wattroff(win1, A_BLINK);
  628 
  629         mvwin(win1, by, bx);
  630         overlay(win, win1);
  631         mvwin(win1, 14, 25);
  632         wmove(win1, 8, 26);
  633         wrefresh(win1);
  634         wgetch(win1);
  635 
  636         delwin(win1);
  637     }
  638 
  639     clear();
  640     wclear(win);
  641     wrefresh(win);
  642     mvwaddstr(win, 6, 2, "This line shouldn't appear");
  643     mvwaddstr(win, 4, 2, "Only half of the next line is visible");
  644     mvwaddstr(win, 5, 2, "Only half of the next line is visible");
  645     wmove(win, 6, 1);
  646     wclrtobot(win);
  647     wmove(win, 5, 20);
  648     wclrtoeol(win);
  649     mvwaddstr(win, 8, 2, "This line also shouldn't appear");
  650     wmove(win, 8, 1);
  651     winsdelln(win, -1);
  652     Continue(win);
  653 
  654     wmove(win, 5, 9);
  655     ch = winch(win);
  656 
  657     wclear(win);
  658     wmove(win, 6, 2);
  659     waddstr(win, "The next char should be l:  ");
  660     winsch(win, ch);
  661     Continue(win);
  662 
  663     mvwinsstr(win, 6, 2, "A1B2C3D4E5");
  664     Continue(win);
  665 
  666     wmove(win, 5, 1);
  667     winsdelln(win, 1);
  668     mvwaddstr(win, 5, 2, "The lines below should have moved down");
  669     Continue(win);
  670 
  671     wclear(win);
  672     wmove(win, 2, 2);
  673     wprintw(win, "This is a formatted string in a window: %d %s\n",
  674             42, "is it");
  675     mvwaddstr(win, 10, 1, "Enter a string: ");
  676     wrefresh(win);
  677     echo();
  678     wscanw(win, "%s", Buffer);
  679 
  680     printw("This is a formatted string in stdscr: %d %s\n", 42, "is it");
  681     mvaddstr(10, 1, "Enter a string: ");
  682     scanw("%s", Buffer);
  683 
  684     wclear(win);
  685     curs_set(2);
  686     mvwaddstr(win, 1, 1, "The cursor should be in high-visibility mode");
  687     Continue(win);
  688 
  689     wclear(win);
  690     curs_set(0);
  691     mvwaddstr(win, 1, 1, "The cursor should have disappeared");
  692     Continue(win);
  693 
  694     wclear(win);
  695     curs_set(1);
  696     mvwaddstr(win, 1, 1, "The cursor should be normal");
  697     Continue(win);
  698 
  699 #ifdef A_COLOR
  700     if (has_colors())
  701     {
  702         wclear(win);
  703         mvwaddstr(win, 1, 1, "Colors should change after you press a key");
  704         Continue(win);
  705 
  706         init_pair(1, COLOR_RED, COLOR_WHITE);
  707         wrefresh(win);
  708     }
  709 #endif
  710     werase(win);
  711     mvwaddstr(win, 1, 1, "Information About Your Terminal");
  712     mvwaddstr(win, 3, 1, termname());
  713     mvwaddstr(win, 4, 1, longname());
  714 
  715     if (termattrs() & A_BLINK)
  716         mvwaddstr(win, 5, 1, "This terminal claims to support blinking.");
  717     else
  718         mvwaddstr(win, 5, 1, "This terminal does NOT support blinking.");
  719 
  720     mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16);
  721     wrefresh(win);
  722 
  723     mvwinnstr(win, 7, 5, Buffer, 18);
  724     mvaddstr(LINES - 2, 10, Buffer);
  725     refresh();
  726     Continue(win);
  727 #ifdef PDCURSES
  728     PDC_set_blink(FALSE);
  729 #endif
  730 }
  731 
  732 #if HAVE_RESIZE
  733 void resizeTest(WINDOW *dummy)
  734 {
  735     WINDOW *win1;
  736     int nwidth = 135, nheight = 52;
  737     int owidth = COLS, oheight = LINES;
  738 
  739     savetty();
  740 
  741     resize_term(nheight, nwidth);
  742 
  743     clear();
  744     refresh();
  745 
  746     win1 = newwin(10, 50, 14, 25);
  747 
  748     if (win1 == NULL)
  749     {
  750         endwin();
  751         return;
  752     }
  753 
  754 #ifdef A_COLOR
  755     if (has_colors())
  756     {
  757         init_pair(3, COLOR_BLUE, COLOR_WHITE);
  758         wattrset(win1, COLOR_PAIR(3));
  759     }
  760 
  761     wclear(win1);
  762 #endif
  763     mvwaddstr(win1, 0, 0, "The screen may now be resized");
  764     mvwprintw(win1, 1, 4, "Given size: %d by %d", nwidth, nheight);
  765     mvwprintw(win1, 2, 4, "Actual size: %d by %d", COLS, LINES);
  766     Continue(win1);
  767 
  768     wclear(win1);
  769     resetty();
  770 
  771     mvwaddstr(win1, 0, 0, "The screen should now be reset");
  772     mvwprintw(win1, 1, 6, "Old size: %d by %d", owidth, oheight);
  773     mvwprintw(win1, 2, 6, "Size now: %d by %d", COLS, LINES);
  774     Continue(win1);
  775 
  776     delwin(win1);
  777 
  778     clear();
  779     refresh();
  780 }
  781 #endif /* HAVE_RESIZE */
  782 
  783 void padTest(WINDOW *dummy)
  784 {
  785     WINDOW *pad, *spad;
  786 
  787     pad = newpad(50, 100);
  788     wattron(pad, A_REVERSE);
  789     mvwaddstr(pad, 5, 2, "This is a new pad");
  790     wattrset(pad, 0);
  791     mvwaddstr(pad, 8, 0,
  792         "The end of this line should be truncated here:except  now");
  793     mvwaddstr(pad, 11, 1, "This line should not appear.It will now");
  794     wmove(pad, 10, 1);
  795     wclrtoeol(pad);
  796     mvwaddstr(pad, 10, 1, " Press any key to continue");
  797     prefresh(pad, 0, 0, 0, 0, 10, 45);
  798     keypad(pad, TRUE);
  799     raw();
  800     wgetch(pad);
  801 
  802     spad = subpad(pad, 12, 25, 7, 52);
  803     mvwaddstr(spad, 2, 2, "This is a new subpad");
  804     box(spad, 0, 0);
  805     prefresh(pad, 0, 0, 0, 0, 15, 75);
  806     keypad(pad, TRUE);
  807     raw();
  808     wgetch(pad);
  809 
  810     mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad");
  811     mvwaddstr(pad, 40, 1, " Press any key to continue");
  812     prefresh(pad, 30, 0, 0, 0, 10, 45);
  813     keypad(pad, TRUE);
  814     raw();
  815     wgetch(pad);
  816 
  817     delwin(pad);
  818 }
  819 
  820 #if HAVE_CLIPBOARD
  821 void clipboardTest(WINDOW *win)
  822 {
  823     static const char *text =
  824         "This string placed in clipboard by PDCurses test program, testcurs.";
  825     char *ptr = NULL;
  826     long i, length = 0;
  827 
  828     mvaddstr(1, 1,
  829              "This test will display the contents of the system clipboard");
  830 
  831     Continue2();
  832 
  833     scrollok(stdscr, TRUE);
  834     i = PDC_getclipboard(&ptr, &length);
  835 
  836     switch(i)
  837     {
  838     case PDC_CLIP_ACCESS_ERROR:
  839         mvaddstr(3, 1, "There was an error accessing the clipboard");
  840         refresh();
  841         break;
  842 
  843     case PDC_CLIP_MEMORY_ERROR:
  844         mvaddstr(3, 1,
  845             "Unable to allocate memory for clipboard contents");
  846         break;
  847 
  848     case PDC_CLIP_EMPTY:
  849         mvaddstr(3, 1, "There was no text in the clipboard");
  850         break;
  851 
  852     default:
  853         wsetscrreg(stdscr, 0, LINES - 1);
  854         clear();
  855         mvaddstr(1, 1, "Clipboard contents...");
  856         mvprintw(2, 1, "%s\n", ptr);
  857     }
  858 
  859     Continue2();
  860 
  861     clear();
  862     mvaddstr(1, 1,
  863         "This test will place the following string in the system clipboard:");
  864     mvaddstr(2, 1, text);
  865 
  866     i = PDC_setclipboard(text, strlen(text));
  867 
  868     switch(i)
  869     {
  870     case PDC_CLIP_ACCESS_ERROR:
  871         mvaddstr(3, 1, "There was an error accessing the clipboard");
  872         break;
  873 
  874     case PDC_CLIP_MEMORY_ERROR:
  875         mvaddstr(3, 1, "Unable to allocate memory for clipboard contents");
  876         break;
  877 
  878     default:
  879         mvaddstr(3, 1, "The string was placed in the clipboard successfully");
  880     }
  881 
  882     Continue2();
  883 }
  884 #endif /* HAVE_CLIPBOARD */
  885 
  886 void curTest(void)
  887 {
  888     do {
  889         int c = getch();
  890 #ifdef PDCURSES
  891         if (c == KEY_UP)
  892             move(getcury(stdscr) - 1, getcurx(stdscr));
  893         else if (c == KEY_DOWN)
  894             move(getcury(stdscr) + 1, getcurx(stdscr));
  895         else if (c == KEY_LEFT)
  896             move(getcury(stdscr), getcurx(stdscr) - 1);
  897         else if (c == KEY_RIGHT)
  898             move(getcury(stdscr), getcurx(stdscr) + 1);
  899         else if (c == 'i')
  900             curs_set(SP->visibility == 1 ? 2 : 1);
  901         else
  902 #endif
  903             break;
  904     } while (TRUE);
  905 }
  906 
  907 void acsTest(WINDOW *win)
  908 {
  909 #ifdef ACS_S3
  910 # define ACSNUM 32
  911 #else
  912 # define ACSNUM 25
  913 #endif
  914     static const char *acs_names[] =
  915     {
  916         "ACS_ULCORNER", "ACS_URCORNER", "ACS_LLCORNER", "ACS_LRCORNER",
  917         "ACS_LTEE", "ACS_RTEE", "ACS_TTEE", "ACS_BTEE", "ACS_HLINE",
  918         "ACS_VLINE", "ACS_PLUS",
  919 
  920         "ACS_S1", "ACS_S9", "ACS_DIAMOND", "ACS_CKBOARD", "ACS_DEGREE",
  921         "ACS_PLMINUS", "ACS_BULLET",
  922 
  923         "ACS_LARROW", "ACS_RARROW", "ACS_UARROW", "ACS_DARROW",
  924         "ACS_BOARD", "ACS_LANTERN", "ACS_BLOCK"
  925 #ifdef ACS_S3
  926         , "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL",
  927         "ACS_PI", "ACS_NEQUAL", "ACS_STERLING"
  928 #endif
  929     };
  930 
  931     chtype acs_values[ACSNUM];
  932 
  933 #if HAVE_WIDE
  934     cchar_t *wacs_values[] =
  935     {
  936         WACS_ULCORNER, WACS_URCORNER, WACS_LLCORNER, WACS_LRCORNER,
  937         WACS_LTEE, WACS_RTEE, WACS_TTEE, WACS_BTEE, WACS_HLINE,
  938         WACS_VLINE, WACS_PLUS,
  939 
  940         WACS_S1, WACS_S9, WACS_DIAMOND, WACS_CKBOARD, WACS_DEGREE,
  941         WACS_PLMINUS, WACS_BULLET,
  942 
  943         WACS_LARROW, WACS_RARROW, WACS_UARROW, WACS_DARROW, WACS_BOARD,
  944         WACS_LANTERN, WACS_BLOCK
  945 # ifdef WACS_S3
  946         , WACS_S3, WACS_S7, WACS_LEQUAL, WACS_GEQUAL, WACS_PI,
  947         WACS_NEQUAL, WACS_STERLING
  948 # endif
  949     };
  950 
  951     static const wchar_t russian[] = {0x0420, 0x0443, 0x0441, 0x0441,
  952         0x043a, 0x0438, 0x0439, L' ', 0x044f, 0x0437, 0x044b, 0x043a, 0};
  953 
  954     static const wchar_t greek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7,
  955         0x03bd, 0x03b9, 0x03ba, 0x03ac, 0};
  956 
  957     static const wchar_t georgian[] = {0x10e5, 0x10d0, 0x10e0, 0x10d7,
  958         0x10e3, 0x10da, 0x10d8, L' ', 0x10d4, 0x10dc, 0x10d0, 0};
  959 #endif
  960 
  961     int i, tmarg = (LINES - 22) / 2;
  962 
  963     attrset(A_BOLD);
  964     mvaddstr(tmarg, (COLS - 23) / 2, "Alternate Character Set");
  965     attrset(A_NORMAL);
  966 
  967     tmarg += 3;
  968 
  969 #define A(b,c) acs_values[b] = ACS_##c
  970 
  971     A(0,ULCORNER); A(1,URCORNER); A(2,LLCORNER); A(3,LRCORNER);
  972     A(4,LTEE);     A(5,RTEE);     A(6,TTEE);     A(7,BTEE);
  973     A(8,HLINE);    A(9,VLINE);    A(10,PLUS);    A(11,S1);
  974     A(12,S9);      A(13,DIAMOND); A(14,CKBOARD); A(15,DEGREE);
  975 
  976     A(16,PLMINUS); A(17,BULLET);  A(18,LARROW);  A(19,RARROW);
  977     A(20,UARROW);  A(21,DARROW);  A(22,BOARD);   A(23,LANTERN);
  978     A(24,BLOCK);
  979 #ifdef ACS_S3
  980     A(25,S3);      A(26,S7);      A(27,LEQUAL);  A(28,GEQUAL);
  981     A(29,PI);      A(30,NEQUAL);  A(31,STERLING);
  982 #endif
  983 
  984 #undef A
  985 
  986     for (i = 0; i < ACSNUM; i++)
  987     {
  988         move((i % 8) * 2 + tmarg, (i / 8) * (COLS / 4) + (COLS / 8 - 7));
  989         addch(acs_values[i]);
  990         printw(" %s", acs_names[i]);
  991     }
  992 
  993     mvaddstr(tmarg + 18, 3, "Press any key to continue");
  994     curTest();
  995 
  996 #if HAVE_WIDE
  997     clear();
  998 
  999     attrset(A_BOLD);
 1000     mvaddstr(tmarg - 3, (COLS - 28) / 2, "Wide Alternate Character Set");
 1001     attrset(A_NORMAL);
 1002 
 1003     for (i = 0; i < ACSNUM; i++)
 1004     {
 1005         move((i % 8) * 2 + tmarg, (i / 8) * (COLS / 4) + (COLS / 8 - 7));
 1006         add_wch(wacs_values[i]);
 1007         printw(" W%s", acs_names[i]);
 1008     }
 1009 
 1010     /* Spanish, Russian, Greek, Georgian */
 1011 
 1012     mvaddwstr(tmarg + 16, COLS / 8 - 5, L"Espa\xf1ol");
 1013     mvaddwstr(tmarg + 16, 3 * (COLS / 8) - 5, russian);
 1014     mvaddwstr(tmarg + 16, 5 * (COLS / 8) - 5, greek);
 1015     mvaddwstr(tmarg + 16, 7 * (COLS / 8) - 5, georgian);
 1016 
 1017     mvaddstr(tmarg + 18, 3, "Press any key to continue");
 1018     curTest();
 1019 #endif
 1020 }
 1021 
 1022 void attrTest(WINDOW *win)
 1023 {
 1024     int tmarg = (LINES - 16) / 2;
 1025     int col1 = (COLS - 36) / 2, col2 = col1 + 20;
 1026 
 1027     attrset(A_BOLD);
 1028     mvaddstr(tmarg, (COLS - 20) / 2, "Character Attributes");
 1029     attrset(A_NORMAL);
 1030 
 1031     refresh();
 1032 
 1033 #ifdef PDCURSES
 1034     PDC_set_blink(TRUE);
 1035     PDC_set_bold(TRUE);
 1036 #endif
 1037 
 1038 #ifdef A_ITALIC
 1039     attrset(A_ITALIC);
 1040     mvaddstr(tmarg + 3, col1, "A_ITALIC");
 1041     attrset(A_NORMAL);
 1042 #endif
 1043 
 1044     attrset(A_BOLD);
 1045     mvaddstr(tmarg + 5, col1, "A_BOLD");
 1046     attrset(A_NORMAL);
 1047 
 1048     attrset(A_BLINK);
 1049     mvaddstr(tmarg + 7, col1, "A_BLINK");
 1050     attrset(A_NORMAL);
 1051 
 1052     attrset(A_REVERSE);
 1053     mvaddstr(tmarg + 9, col1, "A_REVERSE");
 1054     attrset(A_NORMAL);
 1055 
 1056     attrset(A_STANDOUT);
 1057     mvaddstr(tmarg + 11, col1, "A_STANDOUT");
 1058     attrset(A_NORMAL);
 1059 
 1060     attrset(A_UNDERLINE);
 1061     mvaddstr(tmarg + 13, col1, "A_UNDERLINE");
 1062     attrset(A_NORMAL);
 1063 
 1064 #ifdef A_ITALIC
 1065     attrset(A_ITALIC|A_UNDERLINE);
 1066     mvaddstr(tmarg + 3, col2, "Underlined Italic");
 1067     attrset(A_NORMAL);
 1068 #endif
 1069 
 1070     attrset(A_BOLD|A_UNDERLINE);
 1071     mvaddstr(tmarg + 5, col2, "Underlined Bold");
 1072     attrset(A_NORMAL);
 1073 
 1074     attrset(A_BLINK|A_UNDERLINE);
 1075     mvaddstr(tmarg + 7, col2, "Underlined Blink");
 1076     attrset(A_NORMAL);
 1077 
 1078 #ifdef A_LEFT
 1079     attrset(A_LEFT);
 1080     mvaddstr(tmarg + 9, col2, "A_LEFT");
 1081     attrset(A_NORMAL);
 1082 #endif
 1083 
 1084 #ifdef A_RIGHT
 1085     attrset(A_RIGHT);
 1086     mvaddstr(tmarg + 11, col2, "A_RIGHT");
 1087     attrset(A_NORMAL);
 1088 #endif
 1089 
 1090     attrset(A_BLINK|A_REVERSE);
 1091     mvaddstr(tmarg + 13, col2, "Reverse Blink");
 1092     attrset(A_NORMAL);
 1093 
 1094     mvaddstr(tmarg + 16, 3, "Press any key to continue");
 1095     curTest();
 1096 
 1097 #ifdef PDCURSES
 1098     PDC_set_bold(FALSE);
 1099     PDC_set_blink(FALSE);
 1100 #endif
 1101 }
 1102 
 1103 #if HAVE_COLOR
 1104 void remap(int tmarg, const short *colors)
 1105 {
 1106     struct
 1107     {
 1108         short red, green, blue;
 1109     } orgcolors[16];
 1110     int i, maxcol = (COLORS >= 16) ? 16 : 8;
 1111 
 1112     for (i = 0; i < maxcol; i++)
 1113         color_content(i, &(orgcolors[i].red),
 1114                          &(orgcolors[i].green),
 1115                          &(orgcolors[i].blue));
 1116 
 1117     attrset(A_BOLD);
 1118     mvaddstr(tmarg, (COLS - 22) / 2, " init_color() Example ");
 1119     attrset(A_NORMAL);
 1120 
 1121     refresh();
 1122 
 1123     for (i = 0; i < 8; i++)
 1124     {
 1125         init_color(colors[i], i * 125, 0, i * 125);
 1126 
 1127         if (COLORS >= 16)
 1128             init_color(colors[i] + 8, 0, i * 125, 0);
 1129     }
 1130 
 1131     mvaddstr(tmarg + 19, 3, "Press any key to continue");
 1132     curTest();
 1133 
 1134     for (i = 0; i < maxcol; i++)
 1135         init_color(i, orgcolors[i].red,
 1136                       orgcolors[i].green,
 1137                       orgcolors[i].blue);
 1138 }
 1139 
 1140 void extended(int tmarg)
 1141 {
 1142     int i, x, y, z, lmarg = (COLS - 77) / 2;
 1143 
 1144     erase();
 1145 
 1146     curs_set(0);
 1147 
 1148     attrset(A_BOLD);
 1149     mvaddstr(tmarg, (COLS - 15) / 2, "Extended Colors");
 1150     attrset(A_NORMAL);
 1151 
 1152     mvaddstr(tmarg + 3, lmarg, "6x6x6 Color Cube (16-231):");
 1153 
 1154     for (i = 16; i < 256; i++)
 1155         init_pair(i, COLOR_BLACK, i);
 1156 
 1157     for (i = 16, x = 0; x < 6; x++)
 1158         for (z = 0; z < 6; z++)
 1159             for (y = 0; y < 6; y++)
 1160             {
 1161                 chtype ch = ' ' | COLOR_PAIR(i++);
 1162 
 1163                 mvaddch(tmarg + 5 + y, z * 13 + x * 2 + lmarg, ch);
 1164                 addch(ch);
 1165             }
 1166 
 1167     mvaddstr(tmarg + 13, lmarg, "Greyscale (232-255):");
 1168 
 1169     for (x = 0; x < 24; x++)
 1170     {
 1171         chtype ch = ' ' | COLOR_PAIR(232 + x);
 1172 
 1173         mvaddch(tmarg + 15, x * 2 + lmarg, ch);
 1174         addch(ch);
 1175     }
 1176 
 1177     refresh();
 1178     curs_set(1);
 1179 
 1180     mvaddstr(tmarg + 19, 3, "Press any key to continue");
 1181     curTest();
 1182 }
 1183 
 1184 void gradient(int tmarg)
 1185 {
 1186     int i;
 1187     short cnum = 256, pnum = 16;
 1188 
 1189     erase();
 1190     refresh();
 1191 
 1192     curs_set(0);
 1193 
 1194     attrset(A_BOLD);
 1195     mvaddstr(tmarg, (COLS - 17) / 2, "Colors Beyond 256");
 1196     attrset(A_NORMAL);
 1197 
 1198     for (i = 0; i < 3; i++)
 1199     {
 1200         int j;
 1201         const char *output_text[3] = {
 1202             "Red on green to white on black | "
 1203             "   (gradients work just as well with",
 1204             "Blue on yellow to black on red | "
 1205             "palettes, if you have enough colors)",
 1206             "White on red to green on blue,  underlined (if available)" };
 1207         const int len = (int)strlen(output_text[i]);
 1208 
 1209         move(tmarg + 3 + i, (COLS - 69) / 2);
 1210         for (j = 0; j < len; j++)
 1211         {
 1212             const int oval = j * 1000 / len;
 1213             const int reverse = 1000 - oval;
 1214 
 1215             if (!i)
 1216             {
 1217                 init_color(cnum, 1000, oval, oval);
 1218                 init_color(cnum + 1, 0, reverse, 0);
 1219             }
 1220             else if (i == 1)
 1221             {
 1222                 init_color(cnum, 0, 0, reverse);
 1223                 init_color(cnum + 1, 1000, reverse, 0);
 1224             }
 1225             else
 1226             {
 1227                 init_color(cnum, reverse, 1000, reverse);
 1228                 init_color(cnum + 1, reverse, 0, oval);
 1229             }
 1230             init_pair(pnum, cnum, cnum + 1);
 1231             attrset(COLOR_PAIR(pnum));
 1232             if (i == 2)
 1233                 attron(A_UNDERLINE);
 1234             addch(output_text[i][j]);
 1235 
 1236             cnum += 2;
 1237             pnum++;
 1238         }
 1239     }
 1240 
 1241     refresh();
 1242     curs_set(1);
 1243 
 1244     attrset(A_NORMAL);
 1245     mvaddstr(tmarg + 19, 3, "Press any key to continue");
 1246     curTest();
 1247 }
 1248 
 1249 void colorTest(WINDOW *win)
 1250 {
 1251     static const short colors[] =
 1252     {
 1253         COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE,
 1254         COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE
 1255     };
 1256 
 1257     static const char *colornames[] =
 1258     {
 1259         "COLOR_BLACK", "COLOR_RED", "COLOR_GREEN", "COLOR_BLUE",
 1260         "COLOR_CYAN", "COLOR_MAGENTA", "COLOR_YELLOW", "COLOR_WHITE"
 1261     };
 1262 
 1263     chtype fill = ACS_BLOCK;
 1264     bool widecol = (COLORS >= 16);
 1265 
 1266     int i, j, tmarg, col1, col2, col3;
 1267 
 1268     if (!has_colors())
 1269         return;
 1270 
 1271     tmarg = (LINES - 19) / 2;
 1272     col1 = (COLS - 60) / 2;
 1273     col2 = col1 + 20;
 1274     col3 = col2 + 20;
 1275 
 1276     attrset(A_BOLD);
 1277     mvaddstr(tmarg, (COLS - 22) / 2, "Color Attribute Macros");
 1278     attrset(A_NORMAL);
 1279 
 1280     if (widecol)
 1281     {
 1282         mvaddstr(tmarg + 3, col2 + 3, "Colors 0-7");
 1283         mvaddstr(tmarg + 3, col3 + 2, "Colors 8-15");
 1284     }
 1285     else
 1286     {
 1287         mvaddstr(tmarg + 3, col2 + 4, "A_NORMAL");
 1288         mvaddstr(tmarg + 3, col3 + 5, "A_BOLD");
 1289     }
 1290 
 1291     for (i = 0; i < 8; i++)
 1292     {
 1293         init_pair(i + 4, colors[i], COLOR_BLACK);
 1294         if (widecol)
 1295             init_pair(i + 12, colors[i] + 8, COLOR_BLACK);
 1296 
 1297         mvaddstr(tmarg + i + 5, col1, colornames[i]);
 1298 
 1299         for (j = 0; j < 16; j++)
 1300         {
 1301             mvaddch(tmarg + i + 5, col2 + j, fill | COLOR_PAIR(i + 4));
 1302             mvaddch(tmarg + i + 5, col3 + j, fill | (widecol ?
 1303                     COLOR_PAIR(i + 12) : (COLOR_PAIR(i + 4) | A_BOLD) ));
 1304         }
 1305     }
 1306 
 1307     mvprintw(tmarg + 15, col1, "COLORS = %d", COLORS);
 1308     mvprintw(tmarg + 16, col1, "COLOR_PAIRS = %d", COLOR_PAIRS);
 1309 
 1310     mvaddstr(tmarg + 19, 3, "Press any key to continue");
 1311     curTest();
 1312 
 1313     if (can_change_color())
 1314         remap(tmarg, colors);
 1315 
 1316     if (COLORS >= 256)
 1317         extended(tmarg);
 1318 
 1319     if (can_change_color() && COLORS >= 768)
 1320         gradient(tmarg);
 1321 }
 1322 #endif
 1323 
 1324 #if HAVE_WIDE
 1325 void wideTest(WINDOW *win)
 1326 {
 1327     wchar_t tmp[513];
 1328     size_t i;
 1329 
 1330     attrset(A_BOLD);
 1331     mvaddstr(1, (COLS - 25) / 2, "Wide Character Input Test");
 1332     attrset(A_NORMAL);
 1333 
 1334     mvaddstr(4, 1, "Enter a string: ");
 1335 
 1336     echo();
 1337 
 1338     get_wstr((wint_t *)tmp);
 1339     addstr("\n\n String:\n\n ");
 1340     addwstr(tmp);
 1341     addstr("\n\n\n Hex:\n\n ");
 1342 
 1343     for (i = 0; i < wcslen(tmp); i++)
 1344     {
 1345         printw("%04x ", tmp[i]);
 1346         addnwstr(tmp + i, 1);
 1347         addstr("  ");
 1348     }
 1349 
 1350     noecho();
 1351 
 1352     Continue2();
 1353 }
 1354 #endif
 1355 
 1356 void display_menu(int old_option, int new_option)
 1357 {
 1358     int lmarg = (COLS - 14) / 2,
 1359         tmarg = (LINES - (MAX_OPTIONS + 2)) / 2;
 1360 
 1361     if (old_option == -1)
 1362     {
 1363         int i;
 1364 
 1365         attrset(A_BOLD);
 1366         mvaddstr(tmarg - 3, lmarg - 5, "PDCurses Test Program");
 1367         attrset(A_NORMAL);
 1368 
 1369         for (i = 0; i < MAX_OPTIONS; i++)
 1370             mvaddstr(tmarg + i, lmarg, command[i].text);
 1371     }
 1372     else
 1373         mvaddstr(tmarg + old_option, lmarg, command[old_option].text);
 1374 
 1375     attrset(A_REVERSE);
 1376     mvaddstr(tmarg + new_option, lmarg, command[new_option].text);
 1377     attrset(A_NORMAL);
 1378 
 1379     mvaddstr(tmarg + MAX_OPTIONS + 2, lmarg - 23,
 1380              "Use Up and Down Arrows to select - Enter to run - Q to quit");
 1381     refresh();
 1382 }