From: Ralph Campbell Date: Thu, 10 Mar 1983 08:23:12 +0000 (-0800) Subject: date and time created 83/03/09 16:23:12 by ralph X-Git-Tag: BSD-4_1c_2-Snapshot-Development~43 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/d9fde7be68e59afda65256bee42551a3da1c9cba date and time created 83/03/09 16:23:12 by ralph SCCS-vsn: old/lib2648/rdchar.c 4.1 --- diff --git a/usr/src/old/lib2648/rdchar.c b/usr/src/old/lib2648/rdchar.c new file mode 100644 index 0000000000..c98f746597 --- /dev/null +++ b/usr/src/old/lib2648/rdchar.c @@ -0,0 +1,26 @@ +/* rdchar.c 4.1 83/03/09 */ +/* + * rdchar: returns a readable representation of an ASCII char, using ^ notation. + */ + +#include + +char *rdchar(c) +char c; +{ + static char ret[4]; + register char *p; + + /* + * Due to a bug in isprint, this prints spaces as ^`, but this is OK + * because we want something to show up on the screen. + */ + ret[0] = ((c&0377) > 0177) ? '\'' : ' '; + c &= 0177; + ret[1] = isprint(c) ? ' ' : '^'; + ret[2] = isprint(c) ? c : c^0100; + ret[3] = 0; + for (p=ret; *p==' '; p++) + ; + return (p); +}