summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/MyPty.cpp
Side-by-side diff
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
@@ -93,69 +93,67 @@
/*!
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(m_fd < 0) return;
ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
}
void MyPty::donePty()
{
// This is code from the Qt DumbTerminal example
int status = 0;
::close(m_fd);
if (m_cpid) {
- qWarning("killing!!!");
kill(m_cpid, SIGHUP);
//waitpid(m_cpid, &status, 0);
delete m_sn_e;
m_sn_e = 0l;
}
m_cpid = 0;
// emit done(status);
}
const char* MyPty::deviceName()
{
return m_ttynam;
}
void MyPty::error()
{
- qWarning("error");
// This is code from the Qt DumbTerminal example
donePty();
}
void MyPty::start() {
char* cmd = "/bin/sh";
QStrList lis;
int r =run(cmd, lis, 0, 0);
r = r;
}
/*!
start the client program.
*/
int MyPty::run(const char* cmd, QStrList &, const char*, int)
{
// This is code from the Qt DumbTerminal example
m_cpid = fork();
if ( !m_cpid ) {
// child - exec shell on tty
for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL);
int ttyfd = ::open(m_ttynam, O_RDWR);
dup2(ttyfd, STDIN_FILENO);
dup2(ttyfd, STDOUT_FILENO);
@@ -247,69 +245,65 @@ MyPty::MyPty(const Profile&) : m_cpid(0)
*/
MyPty::~MyPty()
{
donePty();
}
QString MyPty::identifier()const {
return QString::fromLatin1("term");
}
QString MyPty::name()const{
return identifier();
}
bool MyPty::open() {
start();
return true;
}
void MyPty::close() {
donePty();
}
void MyPty::reload( const Profile& ) {
}
/*! sends len bytes through the line */
void MyPty::send(const QByteArray& ar)
{
- qWarning("sending!");
#ifdef VERBOSE_DEBUG
// verbose debug
printf("sending bytes:\n");
for (uint i = 0; i < ar.count(); i++)
printf("%c", ar[i]);
printf("\n");
#endif
::write(m_fd, ar.data(), ar.count());
}
/*! indicates that a block of data is received */
void MyPty::readPty()
{
- qWarning("read");
QByteArray buf(4096);
int len = ::read( m_fd, buf.data(), 4096 );
if (len == -1 || len == 0) {
- qWarning("donePty!!! now!");
donePty();
- qWarning("return %s", sender()->className() );
delete sender();
return;
}
if (len < 0)
return;
buf.resize(len);
emit received(buf);
#ifdef VERBOSE_DEBUG
// verbose debug
printf("read bytes:\n");
for (uint i = 0; i < buf.count(); i++)
printf("%c", buf[i]);
printf("\n");
#endif
}