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.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 16bb5ff..984e347 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -89,49 +89,48 @@
89#undef VERBOSE_DEBUG 89#undef VERBOSE_DEBUG
90 90
91 91
92/* -------------------------------------------------------------------------- */ 92/* -------------------------------------------------------------------------- */
93 93
94/*! 94/*!
95 Informs the client program about the 95 Informs the client program about the
96 actual size of the window. 96 actual size of the window.
97*/ 97*/
98 98
99void MyPty::setSize(int lines, int columns) 99void MyPty::setSize(int lines, int columns)
100{ 100{
101 qWarning("setting size"); 101 qWarning("setting size");
102 struct winsize wsize; 102 struct winsize wsize;
103 wsize.ws_row = (unsigned short)lines; 103 wsize.ws_row = (unsigned short)lines;
104 wsize.ws_col = (unsigned short)columns; 104 wsize.ws_col = (unsigned short)columns;
105 if(m_fd < 0) return; 105 if(m_fd < 0) return;
106 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 106 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
107} 107}
108 108
109 109
110void MyPty::donePty() 110void MyPty::donePty()
111{ 111{
112 // This is code from the Qt DumbTerminal example 112 // This is code from the Qt DumbTerminal example
113 int status = 0;
114 113
115 ::close(m_fd); 114 ::close(m_fd);
116 115
117 if (m_cpid) { 116 if (m_cpid) {
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 delete m_sn_r; 120 delete m_sn_r;
122 m_sn_e = 0l; 121 m_sn_e = 0l;
123 m_sn_r = 0l; 122 m_sn_r = 0l;
124 } 123 }
125 124
126 m_cpid = 0; 125 m_cpid = 0;
127 m_fd = -1; 126 m_fd = -1;
128// emit done(status); 127// emit done(status);
129} 128}
130 129
131 130
132const char* MyPty::deviceName() 131const char* MyPty::deviceName()
133{ 132{
134 return m_ttynam; 133 return m_ttynam;
135} 134}
136 135
137 136
@@ -236,48 +235,49 @@ int MyPty::openPty()
236/*! 235/*!
237 Create an instance. 236 Create an instance.
238*/ 237*/
239MyPty::MyPty(const Profile& prof) : m_cpid(0) 238MyPty::MyPty(const Profile& prof) : m_cpid(0)
240{ 239{
241 240
242 int term = prof.readNumEntry("Terminal", Profile::VT100 ); 241 int term = prof.readNumEntry("Terminal", Profile::VT100 );
243 switch( term ) { 242 switch( term ) {
244 default: 243 default:
245 case Profile::VT100: 244 case Profile::VT100:
246 case Profile::VT102: 245 case Profile::VT102:
247 m_term = "vt100"; 246 m_term = "vt100";
248 break; 247 break;
249 case Profile::Linux: 248 case Profile::Linux:
250 m_term = "linux"; 249 m_term = "linux";
251 break; 250 break;
252 case Profile::XTerm: 251 case Profile::XTerm:
253 m_term = "xterm"; 252 m_term = "xterm";
254 break; 253 break;
255 } 254 }
256 m_sn_e = 0l; 255 m_sn_e = 0l;
257 m_sn_r = 0l; 256 m_sn_r = 0l;
258 m_fd = openPty(); 257 m_fd = openPty();
259 ProcCtl* ctl = ProcCtl::self(); 258 ProcCtl* ctl = ProcCtl::self();
259 Q_UNUSED(ctl);
260} 260}
261 261
262/*! 262/*!
263 Destructor. 263 Destructor.
264 Note that the related client program is not killed 264 Note that the related client program is not killed
265 (yet) when a instance is deleted. 265 (yet) when a instance is deleted.
266*/ 266*/
267MyPty::~MyPty() 267MyPty::~MyPty()
268{ 268{
269 donePty(); 269 donePty();
270} 270}
271QString MyPty::identifier()const { 271QString MyPty::identifier()const {
272 return QString::fromLatin1("term"); 272 return QString::fromLatin1("term");
273} 273}
274QString MyPty::name()const{ 274QString MyPty::name()const{
275 return identifier(); 275 return identifier();
276} 276}
277bool MyPty::open() { 277bool MyPty::open() {
278 if (m_fd < 0) 278 if (m_fd < 0)
279 m_fd = openPty(); 279 m_fd = openPty();
280 280
281 start(); 281 start();
282 return true; 282 return true;
283} 283}