home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CURS13_2.ZIP / INITSCR.C < prev    next >
Text File  |  1989-12-08  |  2KB  |  60 lines

  1. /****************************************************************/
  2. /* Initscr() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /* 1.1:    Revision string in the code:            880306    */
  13. /* 1.2:    Rcsid[] string for maintenance:            881002    */
  14. /* 1.3:    MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  15. /****************************************************************/
  16.  
  17. #include <curses.h>
  18. #include <curspriv.h>
  19.  
  20. char _curses_initscr_rcsid[] = "@(#)initscr.c v1.3 - 881005";
  21. char _curses_revcod[] =  CURSES_RCS_ID;
  22. char _curses_cpyrgt[] = "Author B. Larsson - Public Domain";
  23.  
  24. extern    void    exit();        /* to avoid warings */
  25.  
  26. WINDOW *curscr;            /* the current screen image */
  27. WINDOW *stdscr;            /* the default screen window */
  28. cursv   _cursvar;        /* curses variables */
  29. int    LINES;            /* terminal height */
  30. int    COLS;            /* terminal width */
  31.  
  32. /****************************************************************/
  33. /* Initscr() does necessary initializations for the PCcurses    */
  34. /* package. It MUST be called before any other curses routines.    */
  35. /****************************************************************/
  36.  
  37. int initscr()
  38.   {
  39.   _cursvar.cursrow   = -1;        /* Initial cursor unknown */
  40.   _cursvar.curscol   = -1;
  41.   _cursvar.autocr    = TRUE;        /* lf -> crlf by default */
  42.   _cursvar.raw       = FALSE;        /* tty I/O modes */
  43.   _cursvar.cbreak    = FALSE;
  44.   _cursvar.echo      = TRUE;
  45.   _cursvar.refrbrk   = FALSE;        /* no premature end of refresh */
  46.   _cursvar.orgcbr    = (bool)_cursesgcb();/* original ^BREAK setting */
  47.  
  48.   LINES              = 25;        /* @@@@ this must be fixed */
  49.   COLS               = _cursesgcols();
  50.  
  51.   if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  52.     exit(1);
  53.   if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  54.     exit(1);
  55.   if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  56.     exit(1);
  57.   curscr->_clear = FALSE;
  58.   return(OK);
  59.   } /* initscr */
  60.