date and time created 83/08/11 20:49:33 by sam
[unix-history] / usr / src / old / lib2648 / rdchar.c
CommitLineData
d9fde7be
RC
1/* rdchar.c 4.1 83/03/09 */
2/*
3 * rdchar: returns a readable representation of an ASCII char, using ^ notation.
4 */
5
6#include <ctype.h>
7
8char *rdchar(c)
9char c;
10{
11 static char ret[4];
12 register char *p;
13
14 /*
15 * Due to a bug in isprint, this prints spaces as ^`, but this is OK
16 * because we want something to show up on the screen.
17 */
18 ret[0] = ((c&0377) > 0177) ? '\'' : ' ';
19 c &= 0177;
20 ret[1] = isprint(c) ? ' ' : '^';
21 ret[2] = isprint(c) ? c : c^0100;
22 ret[3] = 0;
23 for (p=ret; *p==' '; p++)
24 ;
25 return (p);
26}