00001 /****************************************************************/ 00002 /* Unctrl() routines of the PCcurses package */ 00003 /* */ 00004 /****************************************************************/ 00005 /* This version of curses is based on ncurses, a curses version */ 00006 /* Originally written by Pavel Curtis at Cornell University. */ 00007 /* I have made substantial changes to make it run on IBM PC's, */ 00008 /* And therefore consider myself free to make it public domain. */ 00009 /* Bjorn Larsson (...mcvax!enea!infovax!bl) */ 00010 /****************************************************************/ 00011 /* 1.0: Release: 870515 */ 00012 /****************************************************************/ 00013 /* Modified to run under the MINIX operating system by Don Cope */ 00014 /* These changes are also released into the public domain. */ 00015 /* 900906 */ 00016 /****************************************************************/ 00017 00018 #include <curses.h> 00019 #include "curspriv.h" 00020 00021 static char strbuf[3] = {0, 0, 0}; 00022 00023 /****************************************************************/ 00024 /* Unctrl() returns a char pointer to a string corresponding to */ 00025 /* Argument character 'c'. */ 00026 /****************************************************************/ 00027 00028 char *unctrl(c) 00029 char c; 00030 { 00031 int ic = c; 00032 ic &= 0xff; 00033 00034 if ((ic >= ' ') && (ic != 0x7f)) { /* normal characters */ 00035 strbuf[0] = ic; 00036 strbuf[1] = '\0'; 00037 return(strbuf); 00038 } /* if */ 00039 strbuf[0] = '^'; /* '^' prefix */ 00040 if (c == 0x7f) /* DEL */ 00041 strbuf[1] = '?'; 00042 else /* other control */ 00043 strbuf[1] = ic + '@'; 00044 return(strbuf); 00045 } /* unctrl */
1.4.6