lftp
4.4.7
About:
lftp
is a command line ftp client (FTP, HTTP, ssl support, background transfer, reget, reput, ...)
Fossies
Dox
:
lftp-4.4.7.tar.gz
("inofficial" and yet experimental doxygen-generated source code documentation)
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
example2.cc
Go to the documentation of this file.
1
#include <config.h>
2
#include <unistd.h>
3
#include "
FileAccess.h
"
4
#include "
log.h
"
5
6
char
*
program_name
;
7
8
int
main
(
int
argc,
char
**argv)
9
{
10
program_name
=argv[0];
11
12
Log::global
->SetOutput(2,
false
);
13
Log::global
->SetLevel(5);
14
Log::global
->Enable();
15
Log::global
->ShowNothing();
16
17
FileAccess
*f=
FileAccess::New
(
"http"
,
"ftp.yar.ru"
);
18
if
(!f)
19
{
20
fprintf(stderr,
"http: unknown protocol, cannot create http session\n"
);
21
return
1;
22
}
23
f->
Open
(
"/pub/source/lftp/"
,f->
RETRIEVE
);
24
for
(;;)
25
{
26
SMTask::Schedule
();
27
28
char
buf[1024];
29
int
res=f->
Read
(buf,
sizeof
(buf));
30
if
(res<0)
31
{
32
if
(res==f->
DO_AGAIN
)
33
{
34
SMTask::Block
();
35
continue
;
36
}
37
fprintf(stderr,
"Error: %s\n"
,f->
StrError
(res));
38
return
1;
39
}
40
if
(res==0)
// eof
41
{
42
f->
Close
();
43
return
0;
44
}
45
write(1,buf,res);
46
}
47
SMTask::Delete
(f);
48
return
0;
49
}
lftp-4.4.7
src
example2.cc
Generated by
1.8.4