summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/MyPty.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index ae01392..b6ae1d9 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -105,45 +105,43 @@ void MyPty::setSize(int lines, int columns)
105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 105 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
106} 106}
107 107
108 108
109void MyPty::donePty() 109void MyPty::donePty()
110{ 110{
111 // This is code from the Qt DumbTerminal example 111 // This is code from the Qt DumbTerminal example
112 int status = 0; 112 int status = 0;
113 113
114 ::close(m_fd); 114 ::close(m_fd);
115 115
116 if (m_cpid) { 116 if (m_cpid) {
117 qWarning("killing!!!");
118 kill(m_cpid, SIGHUP); 117 kill(m_cpid, SIGHUP);
119 //waitpid(m_cpid, &status, 0); 118 //waitpid(m_cpid, &status, 0);
120 delete m_sn_e; 119 delete m_sn_e;
121 m_sn_e = 0l; 120 m_sn_e = 0l;
122 } 121 }
123 122
124 m_cpid = 0; 123 m_cpid = 0;
125// emit done(status); 124// emit done(status);
126} 125}
127 126
128 127
129const char* MyPty::deviceName() 128const char* MyPty::deviceName()
130{ 129{
131 return m_ttynam; 130 return m_ttynam;
132} 131}
133 132
134 133
135void MyPty::error() 134void MyPty::error()
136{ 135{
137 qWarning("error");
138 // This is code from the Qt DumbTerminal example 136 // This is code from the Qt DumbTerminal example
139 donePty(); 137 donePty();
140} 138}
141 139
142void MyPty::start() { 140void MyPty::start() {
143 char* cmd = "/bin/sh"; 141 char* cmd = "/bin/sh";
144 QStrList lis; 142 QStrList lis;
145 int r =run(cmd, lis, 0, 0); 143 int r =run(cmd, lis, 0, 0);
146 r = r; 144 r = r;
147} 145}
148/*! 146/*!
149 start the client program. 147 start the client program.
@@ -259,48 +257,44 @@ bool MyPty::open() {
259 start(); 257 start();
260 return true; 258 return true;
261} 259}
262void MyPty::close() { 260void MyPty::close() {
263 donePty(); 261 donePty();
264} 262}
265void MyPty::reload( const Profile& ) { 263void MyPty::reload( const Profile& ) {
266 264
267} 265}
268/*! sends len bytes through the line */ 266/*! sends len bytes through the line */
269void MyPty::send(const QByteArray& ar) 267void MyPty::send(const QByteArray& ar)
270{ 268{
271 qWarning("sending!");
272#ifdef VERBOSE_DEBUG 269#ifdef VERBOSE_DEBUG
273 // verbose debug 270 // verbose debug
274 printf("sending bytes:\n"); 271 printf("sending bytes:\n");
275 for (uint i = 0; i < ar.count(); i++) 272 for (uint i = 0; i < ar.count(); i++)
276 printf("%c", ar[i]); 273 printf("%c", ar[i]);
277 printf("\n"); 274 printf("\n");
278#endif 275#endif
279 276
280 ::write(m_fd, ar.data(), ar.count()); 277 ::write(m_fd, ar.data(), ar.count());
281} 278}
282 279
283/*! indicates that a block of data is received */ 280/*! indicates that a block of data is received */
284void MyPty::readPty() 281void MyPty::readPty()
285{ 282{
286 qWarning("read");
287 QByteArray buf(4096); 283 QByteArray buf(4096);
288 284
289 int len = ::read( m_fd, buf.data(), 4096 ); 285 int len = ::read( m_fd, buf.data(), 4096 );
290 286
291 if (len == -1 || len == 0) { 287 if (len == -1 || len == 0) {
292 qWarning("donePty!!! now!");
293 donePty(); 288 donePty();
294 qWarning("return %s", sender()->className() );
295 delete sender(); 289 delete sender();
296 return; 290 return;
297 } 291 }
298 292
299 if (len < 0) 293 if (len < 0)
300 return; 294 return;
301 295
302 296
303 buf.resize(len); 297 buf.resize(len);
304 emit received(buf); 298 emit received(buf);
305 299
306#ifdef VERBOSE_DEBUG 300#ifdef VERBOSE_DEBUG