Category : C Source Code
Archive   : CURSESNT.ZIP
Filename : INITSCR.C

 
Output of file : INITSCR.C contained in archive : CURSESNT.ZIP
/****************************************************************/
/* 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 ([email protected]) */
/****************************************************************/
/* 1.4: Use of short wherever possible. Portability */
/* improvements: 900114 */
/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
/* 1.2: Rcsid[] string for maintenance: 881002 */
/* 1.1: Revision string in the code: 880306 */
/* 1.0: Release: 870515 */
/****************************************************************/

#include
#include

#ifdef WIN32
#include
#endif

char _curses_initscr_rcsid[] = "@(#)initscr.c v.1.4 - 900114";
char _curses_revcod[] = CURSES_RCS_ID;
char _curses_cpyrgt[] = "Author B. Larsson - Public Domain";

extern void exit(); /* to avoid warings */

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 WIN32
HANDLE hConIn, hConOut;
#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 = (bool)_cursesgcb();/* original ^BREAK setting */

#ifdef WIN32
LINES = _cursesglines();
#else
LINES = 25; /* this ought to be fixed */
#endif
COLS = _cursesgcols();
#ifdef WIN32
hConOut = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
hConIn = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
#endif
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;
return(OK);
} /* initscr */


  3 Responses to “Category : C Source Code
Archive   : CURSESNT.ZIP
Filename : INITSCR.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/