author | zecke <zecke> | 2002-10-31 16:14:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-31 16:14:20 (UTC) |
commit | d2a79869efe8b18849e45b8e1beedb5108eba6ac (patch) (side-by-side diff) | |
tree | 98b5d50f696d2d411cd287f4fe1bc7e1c0f7b7a2 /noncore/apps/opie-console/MyPty.cpp | |
parent | c3a6f53669140cf9e3c953772c610cd91d69ab78 (diff) | |
download | opie-d2a79869efe8b18849e45b8e1beedb5108eba6ac.zip opie-d2a79869efe8b18849e45b8e1beedb5108eba6ac.tar.gz opie-d2a79869efe8b18849e45b8e1beedb5108eba6ac.tar.bz2 |
Auto connect on Locale Console again!
MyPty test if cmd is available(exists) and then
either use /bin/bash or /bin/sh
ConsoleConfigWidget added a comment about the expected behaviour
Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index b0f0275..c3c58be 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -270,49 +270,64 @@ MyPty::MyPty(const Profile& prof) : m_cpid(0) */ MyPty::~MyPty() { donePty(); } QString MyPty::identifier()const { return QString::fromLatin1("term"); } QString MyPty::name()const{ return identifier(); } bool MyPty::open() { if (m_fd < 0) m_fd = openPty(); start(); return true; } void MyPty::close() { donePty(); m_fd = openPty(); } void MyPty::reload( const Profile& prof) { m_env.clear(); - m_cmd = prof.readEntry("Command", "/bin/bash"); + m_cmd = prof.readEntry("Command", "/bin/sh"); + + /* + * Lets check if m_cmd actually + * exists.... + * we try to use bin/bash and if + * this fails we + * will fallback to /bin/sh + * which should be there 100% + */ + if ( !QFile::exists(QFile::encodeName(m_cmd) ) ) + if (QFile::exists("/bin/bash") ) + m_cmd = "/bin/bash"; + else + m_cmd = "/bin/sh"; + int envcount = prof.readNumEntry("EnvVars", 0); for (int i=0; i<envcount; i++) { QString name = prof.readEntry("Env_Name_" + QString::number(i), ""); QString value = prof.readEntry("Env_Value_" + QString::number(i), ""); if (!(name.isEmpty() || value.isEmpty())) { m_env.insert(name, value); } } } /*! sends len bytes through the line */ void MyPty::send(const QByteArray& ar) { #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 */ |