diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-30 01:59:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-30 01:59:53 +0000 |
commit | d3c042fc605737643c265a7f86fc7a77c88f629e (patch) | |
tree | a1850a3ca6493fb6409e8df0a24baf1331d325f6 /editors/ed.c | |
parent | fcd878efcd6df8a8d052cef753305c34c1297267 (diff) | |
download | busybox-w32-d3c042fc605737643c265a7f86fc7a77c88f629e.tar.gz busybox-w32-d3c042fc605737643c265a7f86fc7a77c88f629e.tar.bz2 busybox-w32-d3c042fc605737643c265a7f86fc7a77c88f629e.zip |
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.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/editors/ed.c b/editors/ed.c index cceff0c40..a569788ad 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -847,20 +847,8 @@ static int printLines(int num1, int num2, int expandFlag) | |||
847 | count--; | 847 | count--; |
848 | 848 | ||
849 | while (count-- > 0) { | 849 | while (count-- > 0) { |
850 | ch = *cp++; | 850 | ch = (unsigned char) *cp++; |
851 | if (ch & 0x80) { | 851 | fputc_printable(ch | PRINTABLE_META, stdout); |
852 | fputs("M-", stdout); | ||
853 | ch &= 0x7f; | ||
854 | } | ||
855 | if (ch < ' ') { | ||
856 | bb_putchar('^'); | ||
857 | ch += '@'; | ||
858 | } | ||
859 | if (ch == 0x7f) { | ||
860 | bb_putchar('^'); | ||
861 | ch = '?'; | ||
862 | } | ||
863 | bb_putchar(ch); | ||
864 | } | 852 | } |
865 | 853 | ||
866 | fputs("$\n", stdout); | 854 | fputs("$\n", stdout); |