home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / crssrc12 / unctrl.c < prev    next >
C/C++ Source or Header  |  1993-07-29  |  2KB  |  67 lines

  1. /* 
  2.  * ++jrb, turn it into a fn
  3.  */
  4.  
  5. static char ret[3] = { '\0', '\0', '\0' };
  6.  
  7. char *unctrl(ch)
  8. int ch;
  9. {
  10.     int c = ch & 0377;    /* Note 8bit chars get mapped to themselves */
  11.  
  12.     if((c < ' ') || (c == 0177))
  13.     {
  14.     ret[0] = '^';
  15.         ret[1] = (c == 0177) ? '?' : c | 0100;
  16.     }
  17.     else
  18.     {
  19.     ret[0] = c;
  20.         ret[1] = '\0';
  21.     }
  22.     return ret;
  23. }
  24.  
  25.     
  26. #if 0
  27. /*
  28.  * Copyright (c) 1981 Regents of the University of California.
  29.  * All rights reserved.
  30.  *
  31.  * Redistribution and use in source and binary forms are permitted
  32.  * provided that the above copyright notice and this paragraph are
  33.  * duplicated in all such forms and that any documentation,
  34.  * advertising materials, and other materials related to such
  35.  * distribution and use acknowledge that the software was developed
  36.  * by the University of California, Berkeley.  The name of the
  37.  * University may not be used to endorse or promote products derived
  38.  * from this software without specific prior written permission.
  39.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  40.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  41.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  42.  */
  43.  
  44. #ifndef lint
  45. static char sccsid[] = "@(#)unctrl.c    5.3 (Berkeley) 6/30/88";
  46. #endif /* not lint */
  47.  
  48. /*
  49.  * define unctrl codes for each character
  50.  *
  51.  */
  52.  
  53. /* LINTLIBRARY */
  54. char    *_unctrl[]    = {    /* unctrl codes for ttys        */
  55.     "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
  56.     "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
  57.     "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
  58.     " ", "!", "\"", "#", "$",  "%", "&", "'", "(", ")", "*", "+", ",", "-",
  59.     ".", "/", "0",  "1", "2",  "3", "4", "5", "6", "7", "8", "9", ":", ";",
  60.     "<", "=", ">",  "?", "@",  "A", "B", "C", "D", "E", "F", "G", "H", "I",
  61.     "J", "K", "L",  "M", "N",  "O", "P", "Q", "R", "S", "T", "U", "V", "W",
  62.     "X", "Y", "Z",  "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
  63.     "f", "g", "h",  "i", "j",  "k", "l", "m", "n", "o", "p", "q", "r", "s",
  64.     "t", "u", "v",  "w", "x",  "y", "z", "{", "|", "}", "~", "^?"
  65. };
  66. #endif
  67.