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 @@ -58,49 +58,48 @@ Another technic are UNIX 98 PTY's. These are supported also, and prefered over the (obsolete) predecessor. There's a sinister ioctl(2), signal(2) and job control stuff nessesary to make everything work as it should. */ #include <qfileinfo.h> #include <qapplication.h> #include <qsocketnotifier.h> #include <qstring.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> -#undef HAVE_OPENPTY #ifdef HAVE_OPENPTY #include <pty.h> #endif #include "MyPty.h" #undef VERBOSE_DEBUG /* -------------------------------------------------------------------------- */ /*! Informs the client program about the actual size of the window. */ void MyPty::setSize(int lines, int columns) { struct winsize wsize; wsize.ws_row = (unsigned short)lines; wsize.ws_col = (unsigned short)columns; if(fd < 0) return; ioctl(fd,TIOCSWINSZ,(char *)&wsize); @@ -239,52 +238,52 @@ MyPty::MyPty() : cpid(0) /*! Destructor. Note that the related client program is not killed (yet) when a instance is deleted. */ MyPty::~MyPty() { donePty(); } /*! sends len bytes through the line */ void MyPty::send_bytes(const char* s, int len) { #ifdef VERBOSE_DEBUG // verbose debug printf("sending bytes:\n"); for (int i = 0; i < len; i++) printf("%c", s[i]); printf("\n"); #endif - ::write(fd, s, len); + ::write(fd, s, len); } /*! indicates that a block of data is received */ void MyPty::readPty() -{ +{ char buf[4096]; int len = ::read( fd, buf, 4096 ); if (len == -1) donePty(); if (len < 0) return; emit block_in(buf,len); - + #ifdef VERBOSE_DEBUG // verbose debug printf("read bytes:\n"); for (int i = 0; i < len; i++) printf("%c", buf[i]); printf("\n"); #endif } |