unctrl
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 04:05:32 +0000 (20:05 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 04:05:32 +0000 (20:05 -0800)
SCCS-vsn: usr.bin/window/wwmisc.c 1.7

usr/src/usr.bin/window/wwmisc.c

index b4f928b..ae64ff0 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwmisc.c    1.6 83/07/22";
+static char *sccsid = "@(#)wwmisc.c    1.7 83/07/28";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -34,3 +34,27 @@ register id;
                ;
        return w;
 }
                ;
        return w;
 }
+
+char *
+unctrl(c)
+register char c;
+{
+       static char buf[5];
+       register char *p = buf;
+
+       if (c == DEL) {
+               *p++ = '^';
+               *p++ = '?';
+       } else if (c < ' ') {
+               *p++ = '^';
+               *p++ = c + '@';
+       } else if (c > DEL) {
+               *p++ = '\\';
+               *p++ = (c >> 6 & 3) + '0';
+               *p++ = (c >> 3 & 7) + '0';
+               *p++ = (c & 7) + '0';
+       } else
+               *p++ = c;
+       *p = 0;
+       return buf;
+}