Category : C Source Code
Archive   : PCURSE14.ZIP
Filename : SETMODE.C

 
Output of file : SETMODE.C contained in archive : PCURSE14.ZIP
/****************************************************************/
/* Terminal mode routines 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 make it public domain. */
/* Bjorn Larsson ([email protected]) */
/****************************************************************/
/* BUT: this particualr module was written by */
/* N. Dean Pentcheff ([email protected]) */
/* It provides PC Curses versions of: */
/* reset_prog_mode(); */
/* reset_shell_mode(); */
/* set_prog_mode(); */
/* set_shell_mode(); */
/* */
/* B. Larsson took the liberty to mofify it's style slightly */
/* when incorporating it into PCcurses v.1.2. The routines in */
/* this module do a similar thing to savetty() and resetty(). */
/****************************************************************/
/* 1.4: Use of short wherever possible. Portability */
/* improvements: 900114 */
/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
/* 1.2: Style clean-up, rcsid[] string for main- */
/* tenance: 881002 */
/****************************************************************/

#include
#include

struct cttyset
{
bool been_set;
bool oautocr;
bool ocbreak;
bool oecho;
bool oraw;
};

char _curses_setmode_rcsid[] = "@(#)setmode.c v.1.4 - 900114";

static struct cttyset pr_tty = {FALSE};/* tty modes for prog_mode */

/****************************************************************/
/* Def_prog_mode() saves the current tty status, to be recalled */
/* later by reset_prog_mode. */
/****************************************************************/

void def_prog_mode()
{
pr_tty.been_set = TRUE;
pr_tty.oautocr = _cursvar.autocr;
pr_tty.ocbreak = _cursvar.cbreak;
pr_tty.oecho = _cursvar.echo;
pr_tty.oraw = _cursvar.raw;
} /* def_prog_mode */

/****************************************************************/
/* Reset_prog_mode() resets tty modes to the values saved in a */
/* call to def_prog_mode. */
/****************************************************************/

void reset_prog_mode()
{
if (pr_tty.been_set == TRUE)
{
_cursvar.autocr = pr_tty.oautocr;
_cursvar.cbreak = pr_tty.ocbreak;
_cursvar.echo = pr_tty.oecho;
_cursvar.raw = pr_tty.oraw;
} /* if */
} /* reset_prog_mode */

/****************************************************************/
/* Def_shell_mode() saves the tty status, to be recalled by */
/* reset_shell_mode. A noop in PCcurses. */
/****************************************************************/

void def_shell_mode()
{
} /* def_shell_mode */

/****************************************************************/
/* Reset_shell_mode() resets the tty status to the status it */
/* had before curses began. */
/****************************************************************/

void reset_shell_mode()
{
_cursvar.autocr = TRUE;
_cursvar.cbreak = FALSE;
_cursvar.echo = TRUE;
_cursvar.raw = FALSE;
} /* reset_shell_mode */


  3 Responses to “Category : C Source Code
Archive   : PCURSE14.ZIP
Filename : SETMODE.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/