1 |
ab11 |
1.1 |
#include <ftp.h> |
2 |
|
|
#include <string.h> |
3 |
|
|
|
4 |
|
|
// sunos does not prototype this in stdio.h |
5 |
|
|
extern "C" char* getpass (char* prompt); |
6 |
|
|
|
7 |
|
|
int main (int ac, char** av) |
8 |
|
|
{ |
9 |
|
|
// This is an ftp client. |
10 |
|
|
// It puts a file at the remote site outside the |
11 |
|
|
// nsc firewall. Donot use this outside of NSC. |
12 |
|
|
if (ac != 4) { |
13 |
|
|
cerr << "USAGE: " |
14 |
|
|
<< av [0] |
15 |
|
|
<< " user@hostname localfilepath remotefilepath\n"; |
16 |
|
|
return 1; |
17 |
|
|
} |
18 |
|
|
|
19 |
|
|
ftp f (&cout); |
20 |
|
|
|
21 |
|
|
// establish connection |
22 |
|
|
f->connect ("gatekeeper.nsc.com"); |
23 |
|
|
f->get_response (); // get the connection response |
24 |
|
|
|
25 |
|
|
// set access |
26 |
|
|
f->user (av [1]); |
27 |
|
|
f->passwd (getpass ("Password: ")); |
28 |
|
|
|
29 |
|
|
// get help |
30 |
|
|
f->help (); |
31 |
|
|
|
32 |
|
|
// set representation type to image |
33 |
|
|
f->rep_type (ftp::rt_image); |
34 |
|
|
|
35 |
|
|
// put a file |
36 |
|
|
f->putfile (av [2], av [3]); |
37 |
|
|
|
38 |
|
|
// quit |
39 |
|
|
f->quit (); |
40 |
|
|
} |
41 |
|
|
|