Diffstat (limited to 'core/apps/embeddedkonsole/MyPty.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index e7d8274..5a8519a 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp | |||
@@ -70,25 +70,24 @@ | |||
70 | #include <qstring.h> | 70 | #include <qstring.h> |
71 | 71 | ||
72 | #include <stdlib.h> | 72 | #include <stdlib.h> |
73 | #include <stdio.h> | 73 | #include <stdio.h> |
74 | #include <signal.h> | 74 | #include <signal.h> |
75 | #include <fcntl.h> | 75 | #include <fcntl.h> |
76 | #include <unistd.h> | 76 | #include <unistd.h> |
77 | #include <termios.h> | 77 | #include <termios.h> |
78 | #include <sys/types.h> | 78 | #include <sys/types.h> |
79 | #include <sys/ioctl.h> | 79 | #include <sys/ioctl.h> |
80 | #include <sys/wait.h> | 80 | #include <sys/wait.h> |
81 | 81 | ||
82 | #undef HAVE_OPENPTY | ||
83 | #ifdef HAVE_OPENPTY | 82 | #ifdef HAVE_OPENPTY |
84 | #include <pty.h> | 83 | #include <pty.h> |
85 | #endif | 84 | #endif |
86 | 85 | ||
87 | #include "MyPty.h" | 86 | #include "MyPty.h" |
88 | 87 | ||
89 | 88 | ||
90 | #undef VERBOSE_DEBUG | 89 | #undef VERBOSE_DEBUG |
91 | 90 | ||
92 | 91 | ||
93 | /* -------------------------------------------------------------------------- */ | 92 | /* -------------------------------------------------------------------------- */ |
94 | 93 | ||
@@ -251,40 +250,40 @@ MyPty::~MyPty() | |||
251 | /*! sends len bytes through the line */ | 250 | /*! sends len bytes through the line */ |
252 | void MyPty::send_bytes(const char* s, int len) | 251 | void MyPty::send_bytes(const char* s, int len) |
253 | { | 252 | { |
254 | 253 | ||
255 | #ifdef VERBOSE_DEBUG | 254 | #ifdef VERBOSE_DEBUG |
256 | // verbose debug | 255 | // verbose debug |
257 | printf("sending bytes:\n"); | 256 | printf("sending bytes:\n"); |
258 | for (int i = 0; i < len; i++) | 257 | for (int i = 0; i < len; i++) |
259 | printf("%c", s[i]); | 258 | printf("%c", s[i]); |
260 | printf("\n"); | 259 | printf("\n"); |
261 | #endif | 260 | #endif |
262 | 261 | ||
263 | ::write(fd, s, len); | 262 | ::write(fd, s, len); |
264 | } | 263 | } |
265 | 264 | ||
266 | /*! indicates that a block of data is received */ | 265 | /*! indicates that a block of data is received */ |
267 | void MyPty::readPty() | 266 | void MyPty::readPty() |
268 | { | 267 | { |
269 | char buf[4096]; | 268 | char buf[4096]; |
270 | 269 | ||
271 | int len = ::read( fd, buf, 4096 ); | 270 | int len = ::read( fd, buf, 4096 ); |
272 | 271 | ||
273 | if (len == -1) | 272 | if (len == -1) |
274 | donePty(); | 273 | donePty(); |
275 | 274 | ||
276 | if (len < 0) | 275 | if (len < 0) |
277 | return; | 276 | return; |
278 | 277 | ||
279 | emit block_in(buf,len); | 278 | emit block_in(buf,len); |
280 | 279 | ||
281 | #ifdef VERBOSE_DEBUG | 280 | #ifdef VERBOSE_DEBUG |
282 | // verbose debug | 281 | // verbose debug |
283 | printf("read bytes:\n"); | 282 | printf("read bytes:\n"); |
284 | for (int i = 0; i < len; i++) | 283 | for (int i = 0; i < len; i++) |
285 | printf("%c", buf[i]); | 284 | printf("%c", buf[i]); |
286 | printf("\n"); | 285 | printf("\n"); |
287 | #endif | 286 | #endif |
288 | 287 | ||
289 | } | 288 | } |
290 | 289 | ||