author | zecke <zecke> | 2003-02-16 17:50:15 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-16 17:50:15 (UTC) |
commit | 62cc9d89378f281c11599f38c3ebe89886b69568 (patch) (unidiff) | |
tree | 7499e9704f66820e785acc8c772e35b4f804aa80 | |
parent | e9e20c4e64b8b228af928822e3d4a49ed773dc2e (diff) | |
download | opie-62cc9d89378f281c11599f38c3ebe89886b69568.zip opie-62cc9d89378f281c11599f38c3ebe89886b69568.tar.gz opie-62cc9d89378f281c11599f38c3ebe89886b69568.tar.bz2 |
Fix getting files
-rw-r--r-- | core/obex/obex.cc | 8 | ||||
-rw-r--r-- | core/obex/receiver.cpp | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc index 92cd317..b8ed6e0 100644 --- a/core/obex/obex.cc +++ b/core/obex/obex.cc | |||
@@ -1,166 +1,166 @@ | |||
1 | 1 | ||
2 | #include <qapplication.h> | 2 | #include <qapplication.h> |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | #include <opie/oprocess.h> | 6 | #include <opie/oprocess.h> |
7 | #include "obex.h" | 7 | #include "obex.h" |
8 | 8 | ||
9 | using namespace OpieObex; | 9 | using namespace OpieObex; |
10 | 10 | ||
11 | Obex::Obex( QObject *parent, const char* name ) | 11 | Obex::Obex( QObject *parent, const char* name ) |
12 | : QObject(parent, name ) | 12 | : QObject(parent, name ) |
13 | { | 13 | { |
14 | m_rec = 0; | 14 | m_rec = 0; |
15 | m_send=0; | 15 | m_send=0; |
16 | m_count = 0; | 16 | m_count = 0; |
17 | m_receive = false; | 17 | m_receive = false; |
18 | connect( this, SIGNAL(error(int) ), // for recovering to receive | 18 | connect( this, SIGNAL(error(int) ), // for recovering to receive |
19 | SLOT(slotError() ) ); | 19 | SLOT(slotError() ) ); |
20 | connect( this, SIGNAL(sent() ), | 20 | connect( this, SIGNAL(sent(bool) ), |
21 | SLOT(slotError() ) ); | 21 | SLOT(slotError() ) ); |
22 | }; | 22 | }; |
23 | Obex::~Obex() { | 23 | Obex::~Obex() { |
24 | delete m_rec; | 24 | delete m_rec; |
25 | delete m_send; | 25 | delete m_send; |
26 | } | 26 | } |
27 | void Obex::receive() { | 27 | void Obex::receive() { |
28 | m_receive = true; | 28 | m_receive = true; |
29 | m_outp = QString::null; | 29 | m_outp = QString::null; |
30 | qWarning("Receive" ); | 30 | qWarning("Receive" ); |
31 | m_rec = new OProcess(); | 31 | m_rec = new OProcess(); |
32 | *m_rec << "irobex_palm3"; | 32 | *m_rec << "irobex_palm3"; |
33 | // connect to the necessary slots | 33 | // connect to the necessary slots |
34 | connect(m_rec, SIGNAL(processExited(OProcess*) ), | 34 | connect(m_rec, SIGNAL(processExited(OProcess*) ), |
35 | this, SLOT(slotExited(OProcess*) ) ); | 35 | this, SLOT(slotExited(OProcess*) ) ); |
36 | 36 | ||
37 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 37 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), |
38 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 38 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); |
39 | 39 | ||
40 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 40 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
41 | qWarning("could not start :("); | 41 | qWarning("could not start :("); |
42 | emit done( false ); | 42 | emit done( false ); |
43 | delete m_rec; | 43 | delete m_rec; |
44 | m_rec = 0; | 44 | m_rec = 0; |
45 | } | 45 | } |
46 | // emit currentTry(m_count ); | 46 | // emit currentTry(m_count ); |
47 | 47 | ||
48 | } | 48 | } |
49 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive | 49 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive |
50 | m_count = 0; | 50 | m_count = 0; |
51 | m_file = fileName; | 51 | m_file = fileName; |
52 | qWarning("send %s", fileName.latin1() ); | 52 | qWarning("send %s", fileName.latin1() ); |
53 | if (m_rec != 0 ) { | 53 | if (m_rec != 0 ) { |
54 | qWarning("running"); | 54 | qWarning("running"); |
55 | if (m_rec->isRunning() ) { | 55 | if (m_rec->isRunning() ) { |
56 | emit error(-1 ); | 56 | emit error(-1 ); |
57 | qWarning("is running"); | 57 | qWarning("is running"); |
58 | delete m_rec; | 58 | delete m_rec; |
59 | m_rec = 0; | 59 | m_rec = 0; |
60 | 60 | ||
61 | }else{ | 61 | }else{ |
62 | qWarning("is not running"); | 62 | qWarning("is not running"); |
63 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending | 63 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending |
64 | return; | 64 | return; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | sendNow(); | 67 | sendNow(); |
68 | } | 68 | } |
69 | void Obex::sendNow(){ | 69 | void Obex::sendNow(){ |
70 | qWarning("sendNow"); | 70 | qWarning("sendNow"); |
71 | if ( m_count >= 25 ) { // could not send | 71 | if ( m_count >= 25 ) { // could not send |
72 | emit error(-1 ); | 72 | emit error(-1 ); |
73 | emit sent(false); | 73 | emit sent(false); |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | // OProcess inititialisation | 76 | // OProcess inititialisation |
77 | m_send = new OProcess(); | 77 | m_send = new OProcess(); |
78 | *m_send << "irobex_palm3"; | 78 | *m_send << "irobex_palm3"; |
79 | *m_send << QFile::encodeName(m_file); | 79 | *m_send << QFile::encodeName(m_file); |
80 | 80 | ||
81 | // connect to slots Exited and and StdOut | 81 | // connect to slots Exited and and StdOut |
82 | connect(m_send, SIGNAL(processExited(OProcess*) ), | 82 | connect(m_send, SIGNAL(processExited(OProcess*) ), |
83 | this, SLOT(slotExited(OProcess*)) ); | 83 | this, SLOT(slotExited(OProcess*)) ); |
84 | connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )), | 84 | connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )), |
85 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 85 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); |
86 | 86 | ||
87 | // now start it | 87 | // now start it |
88 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { | 88 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { |
89 | qWarning("could not send" ); | 89 | qWarning("could not send" ); |
90 | m_count = 25; | 90 | m_count = 25; |
91 | emit error(-1 ); | 91 | emit error(-1 ); |
92 | delete m_send; | 92 | delete m_send; |
93 | m_send=0; | 93 | m_send=0; |
94 | } | 94 | } |
95 | // end | 95 | // end |
96 | m_count++; | 96 | m_count++; |
97 | emit currentTry( m_count ); | 97 | emit currentTry( m_count ); |
98 | } | 98 | } |
99 | 99 | ||
100 | void Obex::slotExited(OProcess* proc ){ | 100 | void Obex::slotExited(OProcess* proc ){ |
101 | if (proc == m_rec ) { // receive process | 101 | if (proc == m_rec ) { // receive process |
102 | received(); | 102 | received(); |
103 | }else if ( proc == m_send ) { | 103 | }else if ( proc == m_send ) { |
104 | sendEnd(); | 104 | sendEnd(); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | 107 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ |
108 | if ( proc == m_rec ) { // only receive | 108 | if ( proc == m_rec ) { // only receive |
109 | QCString cstring( buf, len ); | 109 | QString str = QString::fromUtf8( buf, len ); |
110 | m_outp.append( cstring.data() ); | 110 | m_outp.append( str ); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | void Obex::received() { | 114 | void Obex::received() { |
115 | if (m_rec->normalExit() ) { | 115 | if (m_rec->normalExit() ) { |
116 | if ( m_rec->exitStatus() == 0 ) { // we got one | 116 | if ( m_rec->exitStatus() == 0 ) { // we got one |
117 | QString filename = parseOut(); | 117 | QString filename = parseOut(); |
118 | qWarning("ACHTUNG"); | 118 | qWarning("ACHTUNG %s", filename.latin1() ); |
119 | emit receivedFile( filename ); | 119 | emit receivedFile( filename ); |
120 | } | 120 | } |
121 | }else{ | 121 | }else{ |
122 | emit done(false); | 122 | emit done(false); |
123 | }; | 123 | }; |
124 | delete m_rec; | 124 | delete m_rec; |
125 | m_rec = 0; | 125 | m_rec = 0; |
126 | receive(); | 126 | receive(); |
127 | } | 127 | } |
128 | 128 | ||
129 | void Obex::sendEnd() { | 129 | void Obex::sendEnd() { |
130 | if (m_send->normalExit() ) { | 130 | if (m_send->normalExit() ) { |
131 | if ( m_send->exitStatus() == 0 ) { | 131 | if ( m_send->exitStatus() == 0 ) { |
132 | delete m_send; | 132 | delete m_send; |
133 | m_send=0; | 133 | m_send=0; |
134 | qWarning("done" ); | 134 | qWarning("done" ); |
135 | emit sent(true); | 135 | emit sent(true); |
136 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready | 136 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready |
137 | // let's try it again | 137 | // let's try it again |
138 | delete m_send; | 138 | delete m_send; |
139 | m_send = 0; | 139 | m_send = 0; |
140 | qWarning("try sending again" ); | 140 | qWarning("try sending again" ); |
141 | sendNow(); | 141 | sendNow(); |
142 | } | 142 | } |
143 | }else { | 143 | }else { |
144 | emit error( -1 ); | 144 | emit error( -1 ); |
145 | delete m_send; | 145 | delete m_send; |
146 | m_send = 0; | 146 | m_send = 0; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | QString Obex::parseOut( ){ | 149 | QString Obex::parseOut( ){ |
150 | QString path; | 150 | QString path; |
151 | QStringList list = QStringList::split("\n", m_outp); | 151 | QStringList list = QStringList::split("\n", m_outp); |
152 | QStringList::Iterator it; | 152 | QStringList::Iterator it; |
153 | for (it = list.begin(); it != list.end(); ++it ) { | 153 | for (it = list.begin(); it != list.end(); ++it ) { |
154 | if ( (*it).startsWith("Wrote" ) ) { | 154 | if ( (*it).startsWith("Wrote" ) ) { |
155 | int pos = (*it).findRev('(' ); | 155 | int pos = (*it).findRev('(' ); |
156 | if ( pos > 0 ) { | 156 | if ( pos > 0 ) { |
157 | qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; | 157 | qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; |
158 | qWarning("%d %d", (*it).length(), (*it).length()-pos ); | 158 | qWarning("%d %d", (*it).length(), (*it).length()-pos ); |
159 | 159 | ||
160 | path = (*it).remove( pos, (*it).length() - pos ); | 160 | path = (*it).remove( pos, (*it).length() - pos ); |
161 | qWarning("%s", path.latin1() ); | 161 | qWarning("%s", path.latin1() ); |
162 | path = path.mid(6 ); | 162 | path = path.mid(6 ); |
163 | path = path.stripWhiteSpace(); | 163 | path = path.stripWhiteSpace(); |
164 | qWarning("path %s", path.latin1() ); | 164 | qWarning("path %s", path.latin1() ); |
165 | } | 165 | } |
166 | } | 166 | } |
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index 50ee6cb..d5a7271 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -15,142 +15,146 @@ | |||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
18 | 18 | ||
19 | #include "obex.h" | 19 | #include "obex.h" |
20 | #include "receiver.h" | 20 | #include "receiver.h" |
21 | 21 | ||
22 | using namespace OpieObex; | 22 | using namespace OpieObex; |
23 | 23 | ||
24 | Receiver::Receiver() { | 24 | Receiver::Receiver() { |
25 | m_obex = new Obex(this, "Receiver"); | 25 | m_obex = new Obex(this, "Receiver"); |
26 | connect(m_obex, SIGNAL(receivedFile(const QString& ) ), | 26 | connect(m_obex, SIGNAL(receivedFile(const QString& ) ), |
27 | this, SLOT(slotReceived(const QString& ) ) ); | 27 | this, SLOT(slotReceived(const QString& ) ) ); |
28 | m_obex->receive(); | 28 | m_obex->receive(); |
29 | } | 29 | } |
30 | Receiver::~Receiver() { | 30 | Receiver::~Receiver() { |
31 | m_obex->setReceiveEnabled( false ); | 31 | m_obex->setReceiveEnabled( false ); |
32 | delete m_obex; | 32 | delete m_obex; |
33 | } | 33 | } |
34 | void Receiver::slotReceived( const QString& file ) { | 34 | void Receiver::slotReceived( const QString& file ) { |
35 | int check = checkFile(file); | 35 | int check = checkFile(file); |
36 | if ( check == AddressBook ) | 36 | if ( check == AddressBook ) |
37 | handleAddr( file ); | 37 | handleAddr( file ); |
38 | else if ( check == Datebook ) | 38 | else if ( check == Datebook ) |
39 | handleDateTodo( file ); | 39 | handleDateTodo( file ); |
40 | else | 40 | else |
41 | handleOther( file ); | 41 | handleOther( file ); |
42 | } | 42 | } |
43 | void Receiver::handleAddr( const QString& str ) { | 43 | void Receiver::handleAddr( const QString& str ) { |
44 | QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); | 44 | QCopEnvelope e("QPE/Application/addressbook", "setDocument(QString)" ); |
45 | e << str; | 45 | e << str; |
46 | } | 46 | } |
47 | /* we can not say for sure if it's a VEevent ot VTodo */ | 47 | /* we can not say for sure if it's a VEevent ot VTodo */ |
48 | void Receiver::handleDateTodo( const QString& str ) { | 48 | void Receiver::handleDateTodo( const QString& str ) { |
49 | QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); | 49 | QCopEnvelope e0("QPE/Application/todolist", "setDocument(QString)"); |
50 | e0 << str; | 50 | e0 << str; |
51 | QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); | 51 | QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); |
52 | e1 << str; | 52 | e1 << str; |
53 | } | 53 | } |
54 | /* | 54 | /* |
55 | * Handle other asks if it should accept the | 55 | * Handle other asks if it should accept the |
56 | * beamed object and creates a DocLnk | 56 | * beamed object and creates a DocLnk |
57 | */ | 57 | */ |
58 | void Receiver::handleOther( const QString& other ) { | 58 | void Receiver::handleOther( const QString& other ) { |
59 | OtherHandler* hand = new OtherHandler(); | 59 | OtherHandler* hand = new OtherHandler(); |
60 | hand->handle( other ); | 60 | hand->handle( other ); |
61 | } | 61 | } |
62 | int Receiver::checkFile( const QString& file ) { | 62 | int Receiver::checkFile( const QString& file ) { |
63 | qWarning("check file!! %s", file.latin1() ); | ||
63 | int ret; | 64 | int ret; |
64 | if (file.right(4) == ".vcs" ) { | 65 | if (file.right(4) == ".vcs" ) { |
65 | ret = Datebook; | 66 | ret = Datebook; |
66 | }else if ( file.right(4) == ".vcf") { | 67 | }else if ( file.right(4) == ".vcf") { |
67 | ret = AddressBook; | 68 | ret = AddressBook; |
68 | }else | 69 | }else |
69 | ret = Other; | 70 | ret = Other; |
70 | 71 | ||
72 | |||
73 | qWarning("check it now %d", ret ); | ||
71 | return ret; | 74 | return ret; |
72 | } | 75 | } |
73 | 76 | ||
74 | OtherHandler::OtherHandler() | 77 | OtherHandler::OtherHandler() |
75 | : QVBox() | 78 | : QVBox() |
76 | { | 79 | { |
77 | QHBox* box = new QHBox(this); | 80 | QHBox* box = new QHBox(this); |
78 | QLabel* lbl = new QLabel(box); | 81 | QLabel* lbl = new QLabel(box); |
79 | lbl->setText(tr("<qt><b>Received:</b></qt>")); | 82 | lbl->setText(tr("<qt><b>Received:</b></qt>")); |
80 | m_na = new QLabel(box); | 83 | m_na = new QLabel(box); |
81 | 84 | ||
82 | QFrame* frame = new QFrame(this); | 85 | QFrame* frame = new QFrame(this); |
83 | frame->setFrameShape( QFrame::HLine ); | 86 | frame->setFrameShape( QFrame::HLine ); |
84 | frame->setFrameShadow( QFrame::Sunken ); | 87 | frame->setFrameShadow( QFrame::Sunken ); |
85 | 88 | ||
86 | m_view = new QTextView(this); | 89 | m_view = new QTextView(this); |
87 | 90 | ||
88 | box = new QHBox(this); | 91 | box = new QHBox(this); |
89 | QPushButton *but = new QPushButton(box); | 92 | QPushButton *but = new QPushButton(box); |
90 | but->setText(tr("Accept") ); | 93 | but->setText(tr("Accept") ); |
91 | connect(but, SIGNAL(clicked() ), | 94 | connect(but, SIGNAL(clicked() ), |
92 | this, SLOT(accept()) ); | 95 | this, SLOT(accept()) ); |
93 | 96 | ||
94 | but = new QPushButton(box); | 97 | but = new QPushButton(box); |
95 | but->setText(tr("Deny") ); | 98 | but->setText(tr("Deny") ); |
96 | connect(but, SIGNAL(clicked() ), | 99 | connect(but, SIGNAL(clicked() ), |
97 | this, SLOT(deny() ) ); | 100 | this, SLOT(deny() ) ); |
98 | 101 | ||
99 | raise(); | 102 | raise(); |
100 | showMaximized(); | 103 | showMaximized(); |
101 | } | 104 | } |
102 | OtherHandler::~OtherHandler() { | 105 | OtherHandler::~OtherHandler() { |
103 | 106 | ||
104 | } | 107 | } |
105 | void OtherHandler::handle( const QString& file ) { | 108 | void OtherHandler::handle( const QString& file ) { |
106 | m_file = file; | 109 | m_file = file; |
107 | m_na->setText(file); | 110 | m_na->setText(file); |
108 | DocLnk lnk(file); | 111 | DocLnk lnk(file); |
112 | qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() ); | ||
109 | 113 | ||
110 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); | 114 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); |
111 | m_view->setText( str ); | 115 | m_view->setText( str ); |
112 | } | 116 | } |
113 | 117 | ||
114 | /* | 118 | /* |
115 | * hehe evil evil mmap ahead :) | 119 | * hehe evil evil mmap ahead :) |
116 | * we quickly copy the file and then we'll create a DocLnk for it | 120 | * we quickly copy the file and then we'll create a DocLnk for it |
117 | */ | 121 | */ |
118 | void OtherHandler::accept() { | 122 | void OtherHandler::accept() { |
119 | QString na = targetName( m_file ); | 123 | QString na = targetName( m_file ); |
120 | copy(m_file, na ); | 124 | copy(m_file, na ); |
121 | DocLnk lnk(na); | 125 | DocLnk lnk(na); |
122 | lnk.writeLink(); | 126 | lnk.writeLink(); |
123 | QFile::remove(m_file); | 127 | QFile::remove(m_file); |
124 | delete this; | 128 | delete this; |
125 | } | 129 | } |
126 | void OtherHandler::deny() { | 130 | void OtherHandler::deny() { |
127 | QFile::remove( m_file ); | 131 | QFile::remove( m_file ); |
128 | delete this; | 132 | delete this; |
129 | } | 133 | } |
130 | QString OtherHandler::targetName( const QString& file ) { | 134 | QString OtherHandler::targetName( const QString& file ) { |
131 | QFileInfo info( file ); | 135 | QFileInfo info( file ); |
132 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); | 136 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); |
133 | QString newFileBase = newFile; | 137 | QString newFileBase = newFile; |
134 | 138 | ||
135 | int trie = 0; | 139 | int trie = 0; |
136 | while (QFile::exists(newFile + info.extension() ) ) { | 140 | while (QFile::exists(newFile + info.extension() ) ) { |
137 | newFile = newFileBase + "_"+QString::number(trie) ; | 141 | newFile = newFileBase + "_"+QString::number(trie) ; |
138 | trie++; | 142 | trie++; |
139 | } | 143 | } |
140 | newFile += info.extension(); | 144 | newFile += info.extension(); |
141 | 145 | ||
142 | return newFile; | 146 | return newFile; |
143 | } | 147 | } |
144 | 148 | ||
145 | /* fast cpy */ | 149 | /* fast cpy */ |
146 | void OtherHandler::copy(const QString& src, const QString& file) { | 150 | void OtherHandler::copy(const QString& src, const QString& file) { |
147 | int src_fd = ::open( QFile::encodeName( src ), O_RDONLY ); | 151 | int src_fd = ::open( QFile::encodeName( src ), O_RDONLY ); |
148 | int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC, | 152 | int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC, |
149 | S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP ); | 153 | S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP ); |
150 | 154 | ||
151 | struct stat stater; | 155 | struct stat stater; |
152 | ::fstat(src_fd, &stater ); | 156 | ::fstat(src_fd, &stater ); |
153 | ::lseek(to_fd, stater.st_size-1, SEEK_SET ); | 157 | ::lseek(to_fd, stater.st_size-1, SEEK_SET ); |
154 | 158 | ||
155 | void *src_addr, *dest_addr; | 159 | void *src_addr, *dest_addr; |
156 | src_addr = ::mmap(0, stater.st_size, PROT_READ, | 160 | src_addr = ::mmap(0, stater.st_size, PROT_READ, |