author | zecke <zecke> | 2002-10-15 10:55:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-15 10:55:58 (UTC) |
commit | f2e9de1c8b6d3b2b2e82dec23ebf502c5805f575 (patch) (unidiff) | |
tree | 108efdb1a75a78dd212a69ccad718c2e65ece0bf /noncore/apps/opie-console/filetransfer.cpp | |
parent | daae7a75b0e9ccbf1ea4c699c631ad77825e6301 (diff) | |
download | opie-f2e9de1c8b6d3b2b2e82dec23ebf502c5805f575.zip opie-f2e9de1c8b6d3b2b2e82dec23ebf502c5805f575.tar.gz opie-f2e9de1c8b6d3b2b2e82dec23ebf502c5805f575.tar.bz2 |
Remove debugging output
Fix possible crashes in io_bt and io_irda
Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 8ca0df2..b81c2a2 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -44,25 +44,24 @@ void FileTransfer::sendFile( const QString& file ) { | |||
44 | if ( pipe( m_info ) < 0 ) | 44 | if ( pipe( m_info ) < 0 ) |
45 | m_info[0] = m_info[1] = 0; | 45 | m_info[0] = m_info[1] = 0; |
46 | 46 | ||
47 | 47 | ||
48 | m_pid = fork(); | 48 | m_pid = fork(); |
49 | switch( m_pid ) { | 49 | switch( m_pid ) { |
50 | case -1: | 50 | case -1: |
51 | emit error( StartError, tr("Was not able to fork") ); | 51 | emit error( StartError, tr("Was not able to fork") ); |
52 | slotExec(); | 52 | slotExec(); |
53 | break; | 53 | break; |
54 | case 0:{ | 54 | case 0:{ |
55 | setupChild(); | 55 | setupChild(); |
56 | qWarning("output:"+file ); | ||
57 | /* exec */ | 56 | /* exec */ |
58 | char* verbose = "-vv"; | 57 | char* verbose = "-vv"; |
59 | char* binray = "-b"; | 58 | char* binray = "-b"; |
60 | 59 | ||
61 | 60 | ||
62 | char* typus; | 61 | char* typus; |
63 | switch(m_type ) { | 62 | switch(m_type ) { |
64 | case SZ: | 63 | case SZ: |
65 | typus = ""; | 64 | typus = ""; |
66 | break; | 65 | break; |
67 | case SX: | 66 | case SX: |
68 | typus = "-X"; | 67 | typus = "-X"; |
@@ -157,37 +156,34 @@ void FileTransfer::setupChild() { | |||
157 | dup2( m_fd, STDIN_FILENO ); | 156 | dup2( m_fd, STDIN_FILENO ); |
158 | dup2( m_fd, STDOUT_FILENO ); | 157 | dup2( m_fd, STDOUT_FILENO ); |
159 | dup2( m_comm[1], STDERR_FILENO ); | 158 | dup2( m_comm[1], STDERR_FILENO ); |
160 | } | 159 | } |
161 | 160 | ||
162 | /* | 161 | /* |
163 | * read from the stderr of the child | 162 | * read from the stderr of the child |
164 | * process | 163 | * process |
165 | */ | 164 | */ |
166 | void FileTransfer::slotRead() { | 165 | void FileTransfer::slotRead() { |
167 | QByteArray ar(4096); | 166 | QByteArray ar(4096); |
168 | int len = read(m_comm[0], ar.data(), 4096 ); | 167 | int len = read(m_comm[0], ar.data(), 4096 ); |
169 | qWarning("slot read %d", len); | ||
170 | for (int i = 0; i < len; i++ ) { | 168 | for (int i = 0; i < len; i++ ) { |
171 | // printf("%c", ar[i] ); | 169 | // printf("%c", ar[i] ); |
172 | } | 170 | } |
173 | ar.resize( len ); | 171 | ar.resize( len ); |
174 | QString str( ar ); | 172 | QString str( ar ); |
175 | qWarning(str.simplifyWhiteSpace() ); | ||
176 | QStringList lis = QStringList::split(' ', str ); | 173 | QStringList lis = QStringList::split(' ', str ); |
177 | /* | 174 | /* |
178 | * Transfer finished.. either complete or incomplete | 175 | * Transfer finished.. either complete or incomplete |
179 | */ | 176 | */ |
180 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { | 177 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { |
181 | qWarning("sent!!!!"); | ||
182 | return; | 178 | return; |
183 | } | 179 | } |
184 | /* | 180 | /* |
185 | * do progress reading | 181 | * do progress reading |
186 | */ | 182 | */ |
187 | slotProgress( lis ); | 183 | slotProgress( lis ); |
188 | 184 | ||
189 | 185 | ||
190 | } | 186 | } |
191 | /* | 187 | /* |
192 | * find the progress | 188 | * find the progress |
193 | */ | 189 | */ |
@@ -205,25 +201,24 @@ void FileTransfer::slotProgress( const QStringList& list ) { | |||
205 | // Data looks like this | 201 | // Data looks like this |
206 | // 0 1 2 3 4 5 | 202 | // 0 1 2 3 4 5 |
207 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 | 203 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 |
208 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); | 204 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); |
209 | sent = progi[0].toULong(&complete ); | 205 | sent = progi[0].toULong(&complete ); |
210 | if (!complete ) return; | 206 | if (!complete ) return; |
211 | 207 | ||
212 | total = progi[1].toULong(&complete ); | 208 | total = progi[1].toULong(&complete ); |
213 | if (!complete || total == 0) { | 209 | if (!complete || total == 0) { |
214 | return; | 210 | return; |
215 | } | 211 | } |
216 | 212 | ||
217 | qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total ); | ||
218 | 213 | ||
219 | double pro = (double)sent/total; | 214 | double pro = (double)sent/total; |
220 | int prog = pro * 100; | 215 | int prog = pro * 100; |
221 | 216 | ||
222 | // speed | 217 | // speed |
223 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); | 218 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); |
224 | bps = progi[1].toInt(); | 219 | bps = progi[1].toInt(); |
225 | 220 | ||
226 | // time | 221 | // time |
227 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); | 222 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); |
228 | min = progi[0].toInt(); | 223 | min = progi[0].toInt(); |
229 | sec = progi[1].toInt(); | 224 | sec = progi[1].toInt(); |
@@ -231,25 +226,24 @@ void FileTransfer::slotProgress( const QStringList& list ) { | |||
231 | 226 | ||
232 | if ( prog > m_prog ) { | 227 | if ( prog > m_prog ) { |
233 | m_prog = prog; | 228 | m_prog = prog; |
234 | emit progress(m_file, m_prog, bps, -1, min , sec ); | 229 | emit progress(m_file, m_prog, bps, -1, min , sec ); |
235 | } | 230 | } |
236 | 231 | ||
237 | } | 232 | } |
238 | void FileTransfer::cancel() { | 233 | void FileTransfer::cancel() { |
239 | if(m_pid > 0) ::kill(m_pid,9 ); | 234 | if(m_pid > 0) ::kill(m_pid,9 ); |
240 | 235 | ||
241 | } | 236 | } |
242 | void FileTransfer::slotExec() { | 237 | void FileTransfer::slotExec() { |
243 | qWarning("exited!"); | ||
244 | char buf[2]; | 238 | char buf[2]; |
245 | ::read(m_term[0], buf, 1 ); | 239 | ::read(m_term[0], buf, 1 ); |
246 | delete m_proc; | 240 | delete m_proc; |
247 | delete m_not; | 241 | delete m_not; |
248 | m_proc = m_not = 0l; | 242 | m_proc = m_not = 0l; |
249 | close( m_term[0] ); | 243 | close( m_term[0] ); |
250 | close( m_term[1] ); | 244 | close( m_term[1] ); |
251 | close( m_comm[0] ); | 245 | close( m_comm[0] ); |
252 | close( m_comm[1] ); | 246 | close( m_comm[1] ); |
253 | layer()->closeRawIO( m_fd ); | 247 | layer()->closeRawIO( m_fd ); |
254 | emit sent(); | 248 | emit sent(); |
255 | m_pid = 0; | 249 | m_pid = 0; |