summaryrefslogtreecommitdiff
path: root/editors/ed.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-12-30 01:59:53 +0000
committerDenis Vlasenko2007-12-30 01:59:53 +0000
commitd3c042fc605737643c265a7f86fc7a77c88f629e (patch)
treea1850a3ca6493fb6409e8df0a24baf1331d325f6 /editors/ed.c
parentfcd878efcd6df8a8d052cef753305c34c1297267 (diff)
downloadbusybox-d3c042fc605737643c265a7f86fc7a77c88f629e.zip
busybox-d3c042fc605737643c265a7f86fc7a77c88f629e.tar.gz
libbb: introduce fputc_printable (from ed)
netstat: print control chars as ^C etc vi: style fixlet function old new delta fputc_printable - 100 +100 unix_do_one 451 487 +36 printLines 258 190 -68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 136/-68) Total: 68 bytes
Diffstat (limited to 'editors/ed.c')
-rw-r--r--editors/ed.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/editors/ed.c b/editors/ed.c
index cceff0c..a569788 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -847,20 +847,8 @@ static int printLines(int num1, int num2, int expandFlag)
count--;
while (count-- > 0) {
- ch = *cp++;
- if (ch & 0x80) {
- fputs("M-", stdout);
- ch &= 0x7f;
- }
- if (ch < ' ') {
- bb_putchar('^');
- ch += '@';
- }
- if (ch == 0x7f) {
- bb_putchar('^');
- ch = '?';
- }
- bb_putchar(ch);
+ ch = (unsigned char) *cp++;
+ fputc_printable(ch | PRINTABLE_META, stdout);
}
fputs("$\n", stdout);