summaryrefslogtreecommitdiff
path: root/noncore/apps
authorzecke <zecke>2002-10-31 18:42:29 (UTC)
committer zecke <zecke>2002-10-31 18:42:29 (UTC)
commit3c76157137de747176466df8c7ecb85105ab9d53 (patch) (unidiff)
tree3c93ed589d8b9fb05dfa139ef21c77649daa7bd1 /noncore/apps
parent1793c4b5f743c31be9db1fbb0b3fbbe08df7df28 (diff)
downloadopie-3c76157137de747176466df8c7ecb85105ab9d53.zip
opie-3c76157137de747176466df8c7ecb85105ab9d53.tar.gz
opie-3c76157137de747176466df8c7ecb85105ab9d53.tar.bz2
The if file exists check was wrong..
I limit it to a /bin/bash check...
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index c3c58be..23d4966 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -280,53 +280,51 @@ QString MyPty::name()const{
280} 280}
281bool MyPty::open() { 281bool MyPty::open() {
282 if (m_fd < 0) 282 if (m_fd < 0)
283 m_fd = openPty(); 283 m_fd = openPty();
284 284
285 start(); 285 start();
286 return true; 286 return true;
287} 287}
288void MyPty::close() { 288void MyPty::close() {
289 donePty(); 289 donePty();
290 m_fd = openPty(); 290 m_fd = openPty();
291} 291}
292void MyPty::reload( const Profile& prof) { 292void MyPty::reload( const Profile& prof) {
293 m_env.clear(); 293 m_env.clear();
294 m_cmd = prof.readEntry("Command", "/bin/sh"); 294 m_cmd = prof.readEntry("Command", "/bin/sh");
295 295
296 /* 296 /*
297 * Lets check if m_cmd actually 297 * Lets check if m_cmd actually
298 * exists.... 298 * exists....
299 * we try to use bin/bash and if 299 * we try to use bin/bash and if
300 * this fails we 300 * this fails we
301 * will fallback to /bin/sh 301 * will fallback to /bin/sh
302 * which should be there 100% 302 * which should be there 100%
303 */ 303 */
304 if ( !QFile::exists(QFile::encodeName(m_cmd) ) ) 304 if ( m_cmd.stripWhiteSpace() == "/bin/bash" && !QFile::exists(QFile::encodeName(m_cmd) ) )
305 if (QFile::exists("/bin/bash") )
306 m_cmd = "/bin/bash";
307 else
308 m_cmd = "/bin/sh"; 305 m_cmd = "/bin/sh";
306
309 307
310 int envcount = prof.readNumEntry("EnvVars", 0); 308 int envcount = prof.readNumEntry("EnvVars", 0);
311 for (int i=0; i<envcount; i++) { 309 for (int i=0; i<envcount; i++) {
312 QString name = prof.readEntry("Env_Name_" + QString::number(i), ""); 310 QString name = prof.readEntry("Env_Name_" + QString::number(i), "");
313 QString value = prof.readEntry("Env_Value_" + QString::number(i), ""); 311 QString value = prof.readEntry("Env_Value_" + QString::number(i), "");
314 if (!(name.isEmpty() || value.isEmpty())) { 312 if (!(name.isEmpty() || value.isEmpty())) {
315 m_env.insert(name, value); 313 m_env.insert(name, value);
316 } 314 }
317 } 315 }
318} 316}
319/*! sends len bytes through the line */ 317/*! sends len bytes through the line */
320void MyPty::send(const QByteArray& ar) 318void MyPty::send(const QByteArray& ar)
321{ 319{
322#ifdef VERBOSE_DEBUG 320#ifdef VERBOSE_DEBUG
323 // verbose debug 321 // verbose debug
324 printf("sending bytes:\n"); 322 printf("sending bytes:\n");
325 for (uint i = 0; i < ar.count(); i++) 323 for (uint i = 0; i < ar.count(); i++)
326 printf("%c", ar[i]); 324 printf("%c", ar[i]);
327 printf("\n"); 325 printf("\n");
328#endif 326#endif
329 327
330 ::write(m_fd, ar.data(), ar.count()); 328 ::write(m_fd, ar.data(), ar.count());
331} 329}
332 330