diff options
Diffstat (limited to 'miscutils/conspy.c')
-rw-r--r-- | miscutils/conspy.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/miscutils/conspy.c b/miscutils/conspy.c index 01928b35f..040fa86f3 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c | |||
@@ -43,6 +43,9 @@ | |||
43 | #include "libbb.h" | 43 | #include "libbb.h" |
44 | #include <sys/kd.h> | 44 | #include <sys/kd.h> |
45 | 45 | ||
46 | |||
47 | #define ESC "\033" | ||
48 | |||
46 | struct screen_info { | 49 | struct screen_info { |
47 | unsigned char lines, cols, cursor_x, cursor_y; | 50 | unsigned char lines, cols, cursor_x, cursor_y; |
48 | }; | 51 | }; |
@@ -70,7 +73,7 @@ struct globals { | |||
70 | unsigned col; | 73 | unsigned col; |
71 | unsigned line; | 74 | unsigned line; |
72 | smallint curoff; // unknown:0 cursor on:-1 cursor off:1 | 75 | smallint curoff; // unknown:0 cursor on:-1 cursor off:1 |
73 | char attrbuf[sizeof("\033[0;1;5;30;40m")]; | 76 | char attrbuf[sizeof(ESC"[0;1;5;30;40m")]; |
74 | // remote console | 77 | // remote console |
75 | struct screen_info remote; | 78 | struct screen_info remote; |
76 | // saved local tty terminfo | 79 | // saved local tty terminfo |
@@ -101,7 +104,7 @@ enum { | |||
101 | static void clrscr(void) | 104 | static void clrscr(void) |
102 | { | 105 | { |
103 | // Home, clear till end of screen | 106 | // Home, clear till end of screen |
104 | fputs("\033[1;1H" "\033[J", stdout); | 107 | fputs(ESC"[1;1H" ESC"[J", stdout); |
105 | G.col = G.line = 0; | 108 | G.col = G.line = 0; |
106 | } | 109 | } |
107 | 110 | ||
@@ -109,7 +112,7 @@ static void set_cursor(int state) | |||
109 | { | 112 | { |
110 | if (G.curoff != state) { | 113 | if (G.curoff != state) { |
111 | G.curoff = state; | 114 | G.curoff = state; |
112 | fputs("\033[?25", stdout); | 115 | fputs(ESC"[?25", stdout); |
113 | bb_putchar("h?l"[1 + state]); | 116 | bb_putchar("h?l"[1 + state]); |
114 | } | 117 | } |
115 | } | 118 | } |
@@ -119,7 +122,7 @@ static void gotoxy(int col, int line) | |||
119 | if (G.col != col || G.line != line) { | 122 | if (G.col != col || G.line != line) { |
120 | G.col = col; | 123 | G.col = col; |
121 | G.line = line; | 124 | G.line = line; |
122 | printf("\033[%u;%uH", line + 1, col + 1); | 125 | printf(ESC"[%u;%uH", line + 1, col + 1); |
123 | } | 126 | } |
124 | } | 127 | } |
125 | 128 | ||
@@ -132,7 +135,7 @@ static void cleanup(int code) | |||
132 | } | 135 | } |
133 | // Reset attributes | 136 | // Reset attributes |
134 | if (!BW) | 137 | if (!BW) |
135 | fputs("\033[0m", stdout); | 138 | fputs(ESC"[0m", stdout); |
136 | bb_putchar('\n'); | 139 | bb_putchar('\n'); |
137 | if (code > 1) | 140 | if (code > 1) |
138 | kill_myself_with_sig(code); | 141 | kill_myself_with_sig(code); |