Last change
on this file since 2897 was 2725, checked in by Bruno Cornec, 14 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
-
Property svn:eol-style
set to
native
|
File size:
620 bytes
|
Rev | Line | |
---|
[2725] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * Utility routines.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 2007 Denys Vlasenko
|
---|
| 6 | *
|
---|
| 7 | * Licensed under GPLv2, see file LICENSE in this source tree.
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include "libbb.h"
|
---|
| 11 |
|
---|
| 12 | void FAST_FUNC fputc_printable(int ch, FILE *file)
|
---|
| 13 | {
|
---|
| 14 | if ((ch & (0x80 + PRINTABLE_META)) == (0x80 + PRINTABLE_META)) {
|
---|
| 15 | fputs("M-", file);
|
---|
| 16 | ch &= 0x7f;
|
---|
| 17 | }
|
---|
| 18 | ch = (unsigned char) ch;
|
---|
| 19 | if (ch == 0x9b) {
|
---|
| 20 | /* VT100's CSI, aka Meta-ESC, is not printable on vt-100 */
|
---|
| 21 | ch = '{';
|
---|
| 22 | goto print_caret;
|
---|
| 23 | }
|
---|
| 24 | if (ch < ' ') {
|
---|
| 25 | ch += '@';
|
---|
| 26 | goto print_caret;
|
---|
| 27 | }
|
---|
| 28 | if (ch == 0x7f) {
|
---|
| 29 | ch = '?';
|
---|
| 30 | print_caret:
|
---|
| 31 | fputc('^', file);
|
---|
| 32 | }
|
---|
| 33 | fputc(ch, file);
|
---|
| 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.