Annotation of coherent/g/usr/lib/ncurses/tests/init.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * test ncurses.
        !             3:  */
        !             4: #include <curses.h>
        !             5: #include <signal.h>
        !             6: 
        !             7: static char *diemsg = "Signal recieved";
        !             8: 
        !             9: die()
        !            10: {
        !            11:        noraw();
        !            12:        echo();
        !            13:        signal(SIGINT, SIG_IGN);
        !            14:        mvcur(0, COLS - 1, LINES - 1, 0);
        !            15:        endwin();
        !            16:        printf("%s\n", diemsg);
        !            17:        exit(0);
        !            18: }
        !            19: 
        !            20: rg(win)
        !            21: WINDOW *win;
        !            22: {
        !            23:        if (!memok()) {
        !            24:                diemsg = "memok trouble";
        !            25:                die();
        !            26:        }
        !            27:        wrefresh(win);
        !            28:        if ('q' == getch())
        !            29:                die();
        !            30: }
        !            31: 
        !            32: main()
        !            33: {
        !            34:        register WINDOW *win, *win2;
        !            35:        int c;
        !            36: 
        !            37:        initscr();
        !            38:        raw();
        !            39:        noecho();
        !            40:        signal(SIGINT, die);
        !            41: 
        !            42:        box(stdscr, '|', '-');
        !            43:        refresh();
        !            44:        win = newwin(LINES - 2, COLS - 2, 1, 1);
        !            45:        wmove(win, 10, 10);
        !            46:        waddstr(win, "134567890 missing ");
        !            47:        waddch(win, '2');
        !            48:        rg(win);
        !            49: 
        !            50:        wmove(win, 10, 11);
        !            51:        winsch(win, '2');
        !            52:        wmove(win, 10, 20);
        !            53:        wclrtoeol(win);
        !            54:        wmove(win, 11, 10);
        !            55:        waddstr(win, "2 inserted");
        !            56:        rg(win);
        !            57: 
        !            58:        wmove(win, 10, 11);
        !            59:        c = winch(win);
        !            60:        wdelch(win);
        !            61:        wmove(win, 11, 10);
        !            62:        wstandout(win);
        !            63:        wprintw(win, "%c found at 11, 10 and removed", c);
        !            64:        wstandend(win);
        !            65:        rg(win);
        !            66: 
        !            67:        wmove(win, 11, 10);
        !            68:        winsertln(win);
        !            69:        rg(win);
        !            70: 
        !            71:        delwin(win);
        !            72:        touchwin(stdscr);
        !            73:        rg(stdscr);
        !            74: 
        !            75:        win  = newwin(5, 20, 1, 1);
        !            76:        win2 = newwin(5, 20, 10, 10);
        !            77:        waddstr(win, "A long line in a small window");
        !            78:        wmove(win2, 2, 0);
        !            79:        waddstr(win2, "Window 2");
        !            80:        wrefresh(win2);
        !            81:        rg(win);
        !            82: 
        !            83:        mvwin(win, 15, 10);     /* move the window */
        !            84:        touchwin(stdscr);       /* refresh whats below */
        !            85:        refresh();
        !            86:        touchwin(win2);
        !            87:        wrefresh(win2);
        !            88:        rg(win);                /* show moved copy */
        !            89: 
        !            90:        clear();
        !            91:        scrollok(stdscr, TRUE);
        !            92:        setscrreg(2, LINES-4);
        !            93:        mvaddstr(2, 2, "scroll this out");
        !            94:        mvaddstr(3, 2, "this goes to the top");
        !            95:        mvaddstr(LINES-4, 2, "bottom of scroll region");
        !            96:        move(LINES-7, 2);
        !            97:        rg(stdscr);
        !            98: 
        !            99:        scroll(stdscr);
        !           100:        rg(stdscr);
        !           101: 
        !           102:        move(10, 0);
        !           103:        clrtobot();
        !           104:        move(2, 0);     
        !           105:        deleteln();
        !           106:        rg(stdscr);
        !           107: 
        !           108:        mvaddstr(2, 0, "line 1\nline 2\nline 3");
        !           109:        move(2, 0);     
        !           110:        deleteln();
        !           111:        rg(stdscr);
        !           112: 
        !           113:        erase();
        !           114:        rg(stdscr);
        !           115: 
        !           116:        diemsg = "normal end";
        !           117:        die();
        !           118: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.