summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/MyPty.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 6b0d6f2..16bb5ff 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -172,13 +172,13 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
172 ioctl(STDIN_FILENO, TIOCSCTTY, 0); 172 ioctl(STDIN_FILENO, TIOCSCTTY, 0);
173#endif 173#endif
174 tcgetattr( STDIN_FILENO, &ttmode ); 174 tcgetattr( STDIN_FILENO, &ttmode );
175 ttmode.c_cc[VINTR] = 3; 175 ttmode.c_cc[VINTR] = 3;
176 ttmode.c_cc[VERASE] = 8; 176 ttmode.c_cc[VERASE] = 8;
177 tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); 177 tcsetattr( STDIN_FILENO, TCSANOW, &ttmode );
178 setenv("TERM","vt100",1); 178 setenv("TERM",m_term,1);
179 setenv("COLORTERM","0",1); 179 setenv("COLORTERM","0",1);
180 180
181 if (getuid() == 0) { 181 if (getuid() == 0) {
182 char msg[] = "WARNING: You are running this shell as root!\n"; 182 char msg[] = "WARNING: You are running this shell as root!\n";
183 write(ttyfd, msg, sizeof(msg)); 183 write(ttyfd, msg, sizeof(msg));
184 } 184 }
@@ -233,14 +233,29 @@ int MyPty::openPty()
233 return ptyfd; 233 return ptyfd;
234} 234}
235 235
236/*! 236/*!
237 Create an instance. 237 Create an instance.
238*/ 238*/
239MyPty::MyPty(const Profile&) : m_cpid(0) 239MyPty::MyPty(const Profile& prof) : m_cpid(0)
240{ 240{
241
242 int term = prof.readNumEntry("Terminal", Profile::VT100 );
243 switch( term ) {
244 default:
245 case Profile::VT100:
246 case Profile::VT102:
247 m_term = "vt100";
248 break;
249 case Profile::Linux:
250 m_term = "linux";
251 break;
252 case Profile::XTerm:
253 m_term = "xterm";
254 break;
255 }
241 m_sn_e = 0l; 256 m_sn_e = 0l;
242 m_sn_r = 0l; 257 m_sn_r = 0l;
243 m_fd = openPty(); 258 m_fd = openPty();
244 ProcCtl* ctl = ProcCtl::self(); 259 ProcCtl* ctl = ProcCtl::self();
245} 260}
246 261