From: Alan Cox Date: Sat, 22 Aug 2015 07:44:24 +0000 (+0100) Subject: curses: remove test examples that shouldn't have been committed X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d9e095f57690f721a8d417d569161373238e7764;p=FUZIX.git curses: remove test examples that shouldn't have been committed --- diff --git a/Applications/curses-tests/cbreak_echo.c b/Applications/curses-tests/cbreak_echo.c deleted file mode 100644 index 46c03121..00000000 --- a/Applications/curses-tests/cbreak_echo.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include - -#define PW_LEN 256 -#define NAME_LEN 256 - -int main(int argc, char *argv[]) { - - char name[NAME_LEN]; - char password[PW_LEN]; - const char *real_password = "abcxyz"; - - int i = 0; - - initscr(); - move(5, 10); - printw("%s", "Please login:"); - move(7, 10); - printw("%s", "User name: "); - refresh(); - getstr(name); - move(8, 10); - printw("%s", "Password: "); - refresh(); - - cbreak(); - noecho(); - - _tty.c_cc[VMIN] = 1; - tcsetattr(0, TCSANOW, &_tty); - - memset(password, '\0', sizeof(password)); - while (i < PW_LEN) { - password[i] = getch(); - if (password[i] == '\r'| password[i] == '\n') break; - move(8, 20 + i); - addch('*'); - refresh(); - i++; - } - - - echo(); - nocbreak(); - move(11, 10); - - if (strncmp(real_password, password, strlen(real_password)) == 0) - printw("%s", "Correct"); - else printw("%s", "Wrong"); - printw("%s", " password"); - refresh(); - - sleep(2); - endwin(); - exit(EXIT_SUCCESS); -} - diff --git a/Applications/curses-tests/curs_tools.c b/Applications/curses-tests/curs_tools.c deleted file mode 100644 index d6627bf8..00000000 --- a/Applications/curses-tests/curs_tools.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include - -#define Y 18 -#define gotosleep() sleep(5) - -void main(int argc, char *argv[]) -{ - WINDOW *main_window_ptr; - WINDOW *status_window_ptr; - char c; - int i = 0; - - initscr(); - - main_window_ptr = newwin(20, 80, 0, 0); - status_window_ptr = newwin(1, 80, 21, 0); - - while (i++ < (Y - 1)) - wprintw(main_window_ptr, "testing curses functions.\n"); - - touchwin(main_window_ptr); wrefresh(main_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 0 , 0); - - c = (char)winch(main_window_ptr); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "winch: char at (%d, %d) is %c\n", main_window_ptr->_curx, main_window_ptr->_cury, c); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - c = (char)mvwinch(main_window_ptr, 9, 2); - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "winch: char at (%d, %d) is %c\n", main_window_ptr->_curx, main_window_ptr->_cury, c); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "wclrtoeol"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 0, 7); - wclrtoeol(main_window_ptr); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "winsch"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 6, 0); - winsch(main_window_ptr, 't'); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "wdelch"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 6, 0); - wdelch(main_window_ptr); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "wdeleteln"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 7, 0); - wdeleteln(main_window_ptr); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "winsertln"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 9, 0); - winsertln(main_window_ptr); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - werase(status_window_ptr); wrefresh(status_window_ptr); - mvwprintw(status_window_ptr, 0, 0, "wclrtobot"); - touchwin(status_window_ptr); wrefresh(status_window_ptr); - - gotosleep(); - - wmove(main_window_ptr, 9, 0); - wclrtobot(main_window_ptr); - touchwin(main_window_ptr); - wrefresh(main_window_ptr); - - gotosleep(); - - delwin(main_window_ptr); - delwin(status_window_ptr); - endwin(); -} diff --git a/Applications/curses-tests/multiple_windows.c b/Applications/curses-tests/multiple_windows.c deleted file mode 100644 index 0fe45464..00000000 --- a/Applications/curses-tests/multiple_windows.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - WINDOW *new_window_ptr; - WINDOW *popup_window_ptr; - int x_loop; - int y_loop; - char a_letter = 'a'; - - initscr(); - move(5, 5); - printw("%s", "Testing multiple windows"); - refresh(); - for (y_loop = 0; y_loop < LINES - 1; y_loop++) { - for (x_loop = 0; x_loop < COLS - 1; x_loop++) { - mvwaddch(stdscr, y_loop, x_loop, a_letter); - a_letter++; - if (a_letter > 'z') a_letter = 'a'; - } - } - - /* Update the screen */ - refresh(); - sleep(2); - - new_window_ptr = newwin(10, 20,5, 5); - mvwprintw(new_window_ptr, 2, 2,"%s", "Hello World"); - mvwprintw(new_window_ptr, 5, 2, "%s", "Notice how very long lines wrap inside the window"); - wrefresh(new_window_ptr); - sleep(2); - - for (y_loop = 0; y_loop < LINES -1; y_loop++) { - for (x_loop = 0; x_loop < COLS - 1; x_loop++) { - mvwaddch(stdscr, y_loop, x_loop, a_letter); - a_letter++; - if (a_letter > '9') - a_letter = '0'; - } - } - - refresh(); - sleep(2); - - wrefresh(new_window_ptr); - sleep(2); - - touchwin(new_window_ptr); - wrefresh(new_window_ptr); - - sleep(2); - popup_window_ptr = newwin(10, 20, 8, 8); - box(popup_window_ptr, '|', '-'); - mvwprintw(popup_window_ptr, 5, 2, "%s", "Pop Up Window!"); - wrefresh(popup_window_ptr); - sleep(2); - - touchwin(new_window_ptr); - wrefresh(new_window_ptr); - - sleep(2); - wclear(new_window_ptr); - wrefresh(new_window_ptr); - - sleep(2); - delwin(new_window_ptr); - touchwin(popup_window_ptr); - wrefresh(popup_window_ptr); - sleep(2); - - delwin(popup_window_ptr); - touchwin(stdscr); - refresh(); - - sleep(2); - - endwin(); - exit(EXIT_SUCCESS); -} diff --git a/Applications/curses-tests/overwrite.c b/Applications/curses-tests/overwrite.c deleted file mode 100644 index 93eb8582..00000000 --- a/Applications/curses-tests/overwrite.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include - -void main(int argc, char *argv[]) -{ - WINDOW *w = newwin(5, 20, 5, 5); - int i = 0; - - initscr(); - - while (i++ < (LINES * COLS)/2) - printw("a "); - - refresh(); - sleep(5); - - wprintw(w, "b b b b b b b b b b \nb b b b b b b "); - - touchwin(w); - - overwrite(w, stdscr); - - refresh(); - - sleep(5); - delwin(w); - endwin(); -} diff --git a/Applications/curses-tests/scroll.c b/Applications/curses-tests/scroll.c deleted file mode 100644 index 409037de..00000000 --- a/Applications/curses-tests/scroll.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - initscr(); - - scrollok(stdscr,TRUE); - - while(i < 250) - { - printw("%d - lots and lots of lines flowing down the terminal\n", i); - ++i; - refresh(); - } - - getch(); - endwin(); - return 0; -} diff --git a/Applications/curses-tests/subwindow.c b/Applications/curses-tests/subwindow.c deleted file mode 100644 index ebaf9b0e..00000000 --- a/Applications/curses-tests/subwindow.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - WINDOW *sub_window_ptr; - int x_loop; - int y_loop; - int counter; - char a_letter = '1'; - - initscr(); - for (y_loop = 0; y_loop < LINES - 1; y_loop++) { - for (x_loop = 0; x_loop < COLS - 1; x_loop++) { - mvwaddch(stdscr, y_loop, x_loop, a_letter); - a_letter++; - if (a_letter > '9') a_letter = '1'; - } - } - - sub_window_ptr = subwin(stdscr, 10, 20, 10, 10); - scrollok(sub_window_ptr, 1); - touchwin(stdscr); - refresh(); - sleep(1); - - werase(sub_window_ptr); - mvwprintw(sub_window_ptr, 2, 0, "%s", "This window will now scroll"); - wrefresh(sub_window_ptr); - sleep(1); - - for (counter = 1; counter < 10; counter++) { - wprintw(sub_window_ptr, "%s", "This text is both wrapping and \ - scrolling."); - wrefresh(sub_window_ptr); - sleep(1); - } - - delwin(sub_window_ptr); - touchwin(stdscr); - refresh(); - sleep(1); - endwin(); - - exit(EXIT_SUCCESS); -} -