summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-25 18:57:47 (UTC)
committer harlekin <harlekin>2002-10-25 18:57:47 (UTC)
commit1d3135677f1f49b9cc87ebf01f1c4eaab3c450f4 (patch) (unidiff)
tree63599d704e4f522393a613692369ff9c4a554eef
parent4151cc12a6c37cbec4bb6883204703eec2fb8648 (diff)
downloadopie-1d3135677f1f49b9cc87ebf01f1c4eaab3c450f4.zip
opie-1d3135677f1f49b9cc87ebf01f1c4eaab3c450f4.tar.gz
opie-1d3135677f1f49b9cc87ebf01f1c4eaab3c450f4.tar.bz2
is there is a real bash installed, take that instead of sh
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 984e347..2570826 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -54,32 +54,33 @@
54 other by the operating system. One may think of them as two serial devices 54 other by the operating system. One may think of them as two serial devices
55 linked by a null-modem cable. Being based on devices the number of 55 linked by a null-modem cable. Being based on devices the number of
56 simultanous instances of this class is (globally) limited by the number of 56 simultanous instances of this class is (globally) limited by the number of
57 those device pairs, which is 256. 57 those device pairs, which is 256.
58 58
59 Another technic are UNIX 98 PTY's. These are supported also, and prefered 59 Another technic are UNIX 98 PTY's. These are supported also, and prefered
60 over the (obsolete) predecessor. 60 over the (obsolete) predecessor.
61 61
62 There's a sinister ioctl(2), signal(2) and job control stuff 62 There's a sinister ioctl(2), signal(2) and job control stuff
63 nessesary to make everything work as it should. 63 nessesary to make everything work as it should.
64*/ 64*/
65 65
66 66
67#include <qapplication.h> 67#include <qapplication.h>
68#include <qsocketnotifier.h> 68#include <qsocketnotifier.h>
69#include <qstring.h> 69#include <qstring.h>
70#include <qfile.h>
70 71
71#include <stdlib.h> 72#include <stdlib.h>
72#include <stdio.h> 73#include <stdio.h>
73#include <signal.h> 74#include <signal.h>
74#include <fcntl.h> 75#include <fcntl.h>
75#include <unistd.h> 76#include <unistd.h>
76#include <termios.h> 77#include <termios.h>
77#include <sys/types.h> 78#include <sys/types.h>
78#include <sys/ioctl.h> 79#include <sys/ioctl.h>
79#include <sys/wait.h> 80#include <sys/wait.h>
80 81
81#ifdef HAVE_OPENPTY 82#ifdef HAVE_OPENPTY
82#include <pty.h> 83#include <pty.h>
83#endif 84#endif
84 85
85#include "procctl.h" 86#include "procctl.h"
@@ -129,32 +130,37 @@ void MyPty::donePty()
129 130
130 131
131const char* MyPty::deviceName() 132const char* MyPty::deviceName()
132{ 133{
133 return m_ttynam; 134 return m_ttynam;
134} 135}
135 136
136 137
137void MyPty::error() 138void MyPty::error()
138{ 139{
139 // This is code from the Qt DumbTerminal example 140 // This is code from the Qt DumbTerminal example
140 donePty(); 141 donePty();
141} 142}
142 143
143void MyPty::start() { 144void MyPty::start() {
144 char* cmd = "/bin/sh"; 145 char* cmd = "/bin/sh";
146
147 if ( QFile::exists( "/bin/bash" ) ) {
148 char* cmd = "/bin/bash";
149 }
150
145 QStrList lis; 151 QStrList lis;
146 int r =run(cmd, lis, 0, 0); 152 int r =run(cmd, lis, 0, 0);
147 r = r; 153 r = r;
148} 154}
149/*! 155/*!
150 start the client program. 156 start the client program.
151*/ 157*/
152int MyPty::run(const char* cmd, QStrList &, const char*, int) 158int MyPty::run(const char* cmd, QStrList &, const char*, int)
153{ 159{
154 // This is code from the Qt DumbTerminal example 160 // This is code from the Qt DumbTerminal example
155 m_cpid = fork(); 161 m_cpid = fork();
156 162
157 if ( !m_cpid ) { 163 if ( !m_cpid ) {
158 // child - exec shell on tty 164 // child - exec shell on tty
159 for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL); 165 for (int sig = 1; sig < NSIG; sig++) signal(sig,SIG_DFL);
160 int ttyfd = ::open(m_ttynam, O_RDWR); 166 int ttyfd = ::open(m_ttynam, O_RDWR);