home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* Initscr() routine of the PCcurses package */
- /* */
- /****************************************************************/
- /* This version of curses is based on ncurses, a curses version */
- /* originally written by Pavel Curtis at Cornell University. */
- /* I have made substantial changes to make it run on IBM PC's, */
- /* and therefore consider myself free to make it public domain. */
- /* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- /****************************************************************/
- /* 1.0: Release: 870515 */
- /****************************************************************/
- /* Modified to run under the MINIX operating system by Don Cope */
- /* These changes are also released into the public domain. */
- /* 900906 */
- /****************************************************************/
-
- #include <curses.h>
- #include "curspriv.h"
-
- WINDOW *curscr; /* the current screen image */
- WINDOW *stdscr; /* the default screen window */
- cursv _cursvar; /* curses variables */
- int LINES; /* terminal height */
- int COLS; /* terminal width */
-
- #ifdef TERMIO
- #include "termio.h"
- struct termio _cursoldtty;
- #endif
-
- /****************************************************************/
- /* Initscr() does neccessary initializations for the PCcurses */
- /* package. It MUST be called before any other curses routines. */
- /****************************************************************/
-
- int initscr()
- {
- _cursvar.cursrow = -1; /* Initial cursor unknown */
- _cursvar.curscol = -1;
- _cursvar.autocr = TRUE; /* lf -> crlf by default */
- _cursvar.raw = FALSE; /* tty I/O modes */
- _cursvar.cbreak = FALSE;
- _cursvar.echo = TRUE;
- _cursvar.refrbrk = FALSE; /* no premature end of refresh */
- _cursvar.orgcbr = _cursesgcb(); /* original ^BREAK setting */
-
- _curstcap();
- LINES = _cursesglines();
- COLS = _cursesgcols();
-
- if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- exit(1);
- if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- exit(1);
- if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- exit(1);
- curscr->_clear = FALSE;
- #ifdef TERMIO
- ioctl(0,TCGETA,&_cursoldtty);
- { struct termio t;
- char buf[256],*p=buf;
- t=_cursoldtty;
- t.c_oflag&=~OPOST;
- ioctl(0,TCSETA,&t);
- tputs(tgetstr("is",&p),1,outc);
- }
- #endif
- return(OK);
- } /* initscr */
-