projects
/
unix-history
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
call malloc only once per wwalloc
[unix-history]
/
usr
/
src
/
usr.bin
/
window
/
wwmisc.c
#ifndef lint
static char
*
sccsid
=
"@(#)wwmisc.c 3.1 83/08/11"
;
#endif
#include
"ww.h"
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
;
}