summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
authorzecke <zecke>2002-10-12 01:21:45 (UTC)
committer zecke <zecke>2002-10-12 01:21:45 (UTC)
commitb256987cda5449e3abfd3bd4c2d0650530b5a562 (patch) (side-by-side diff)
treeb739480699193ae0a2bd7a5ea9bfb3ce00923d8b /noncore/apps/opie-console
parenta92703ad1ed767713de21c2389b06434dc223eba (diff)
downloadopie-b256987cda5449e3abfd3bd4c2d0650530b5a562.zip
opie-b256987cda5449e3abfd3bd4c2d0650530b5a562.tar.gz
opie-b256987cda5449e3abfd3bd4c2d0650530b5a562.tar.bz2
Implemented Y-Moden and X-Modem
The parsing needs to ne adjusted for these gusys though..
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 97552fe..b39dc95 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -36,50 +36,63 @@ void FileTransfer::sendFile( const QString& file ) {
m_fd = layer()->rawIO();
//
// m_fd = ::open("/dev/ttyS0", O_RDWR);
m_file = file;
if ( pipe( m_comm ) < 0 )
m_comm[0] = m_comm[1] = 0;
if ( pipe( m_info ) < 0 )
m_info[0] = m_info[1] = 0;
m_pid = fork();
switch( m_pid ) {
case -1:
emit error( StartError, tr("Was not able to fork") );
break;
case 0:{
setupChild();
qWarning("output:"+file );
/* exec */
char* verbose = "-vv";
char* binray = "-b";
+ char* typus;
+ switch(m_type ) {
+ case SZ:
+ typus = "";
+ break;
+ case SX:
+ typus = "-X";
+ break;
+ case SY:
+ typus = "--ymodem";
+ break;
+ }
+
/* we should never return from here */
- execlp("sz", "sz", verbose, binray, file.latin1(), NULL );
+ execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL );
/* communication for error!*/
char resultByte =1;
if (m_info[1] )
write(m_info[1], &resultByte, 1 );
_exit( -1 );
break;
}
default:{
if ( m_info[1] )
close( m_info[1] );
if ( m_info[0] ) for (;;) {
char resultByte; int len;
len = read(m_info[0], &resultByte, 1 );
/* len == 1 start up failed */
if ( len == 1 ) {
emit error( StartError, tr("Could not start") );
return;
}
if ( len == -1 )
if ( (errno == ECHILD ) || (errno == EINTR ) )
continue;
// len == 0 or something like this