+++ /dev/null
-#include <unistd.h>
-#include <stdlib.h>
-#include <curses.h>
-#include <string.h>
-
-#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);
-}
-
+++ /dev/null
-#include <stdio.h>
-#include <curses.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#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();
-}
+++ /dev/null
-#include <unistd.h>
-#include <stdlib.h>
-#include <curses.h>
-
-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);
-}
+++ /dev/null
-#include <stdio.h>
-#include <curses.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-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();
-}
+++ /dev/null
-#include <stdio.h>
-#include <curses.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-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;
-}
+++ /dev/null
-#include <unistd.h>
-#include <stdlib.h>
-#include <curses.h>
-
-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);
-}
-