Category : C++ Source Code
Archive   : CURSESP.ZIP
Filename : UNCTRL.C

 
Output of file : UNCTRL.C contained in archive : CURSESP.ZIP
/****************************************************************/
/* Unctrl() 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 to make it public domain. */
/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
/****************************************************************/
/* IMPLEMENTATION NOTE */
/* The conversion from a control character to a two-character */
/* sequence is done by the unctrl() function. In the BSD ver- */
/* sion of curses it is done by a macro, which uses a publi- */
/* cally available translation table. Some ill-behaved appli- */
/* cation programs use the table directly, and since it does */
/* not exist in this curses version such application will link */
/* with an error message complainting about undefined symbols. */
/****************************************************************/
/* 1.0: Release: 870515 */
/* 1.2: Rcsid[] string for maintenance: 881002 */
/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
/****************************************************************/

#include
#include

static char strbuf[3] = {0,0,0};

char _curses_unctrl_rcsid[] = "@(#)unctrl.c v1.3 - 881005";

/****************************************************************/
/* Unctrl() returns a char pointer to a string corresponding to */
/* argument character 'c'. */
/****************************************************************/

char *unctrl(c)
char c;
{
int ic = c;
ic &= 0xff;

if ((ic >= ' ') && (ic != 0x7f)) /* normal characters */
{
strbuf[0] = (char) ic;
strbuf[1] = '\0';
return(strbuf);
} /* if */
strbuf[0] = '^'; /* '^' prefix */
if (c == 0x7f) /* DEL */
strbuf[1] = '?';
else /* other control */
strbuf[1] = ((char) ic) + '@';
return(strbuf);
} /* unctrl */


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