summaryrefslogtreecommitdiffstats
path: root/lib/libftp/doc/example.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-04-25 15:05:11 +0000
committerjkh <jkh@FreeBSD.org>1995-04-25 15:05:11 +0000
commit02ace706173509b7d8549494277ff682b7cefb8a (patch)
tree437a6d909f192743fe7d26def0fdfae947754209 /lib/libftp/doc/example.c
downloadFreeBSD-src-02ace706173509b7d8549494277ff682b7cefb8a.zip
FreeBSD-src-02ace706173509b7d8549494277ff682b7cefb8a.tar.gz
A programmatic interface to ftp. I need this for several other
components of the system. The license is poorly worded, though I have an (email only) release from the author for unlimited FreeBSD use. I will try to get something more concrete, though the author's remote location makes this difficult. Submitted by: Oleg Orel <orel@oea.ihep.su>
Diffstat (limited to 'lib/libftp/doc/example.c')
-rw-r--r--lib/libftp/doc/example.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/libftp/doc/example.c b/lib/libftp/doc/example.c
new file mode 100644
index 0000000..7f09287
--- /dev/null
+++ b/lib/libftp/doc/example.c
@@ -0,0 +1,51 @@
+
+/* Include standard libftp's header */
+
+#include <FtpLibrary.h>
+
+
+
+main(int argc, char *argv[])
+{
+
+ FILE *input,*output;
+ int c;
+
+
+ if (argc<3)
+ exit(fprintf(stderr,"Usage: %s input-file output-file\n",argv[0]));
+
+ FtplibDebug(yes);
+
+ if ((input=Ftpfopen(argv[1],"r"))==NULL)
+ {
+ perror(argv[1]);
+ exit(1);
+ }
+
+ if ((output=Ftpfopen(argv[2],"w"))==NULL)
+ {
+ perror(argv[2]);
+ exit(1);
+ }
+
+ while ( (c=getc(input)) != EOF && (putc(c,output)!=EOF) );
+
+ if (ferror(input))
+ {
+ perror(argv[1]);
+ exit(1);
+ }
+
+ if (ferror(output))
+ {
+ perror(argv[1]);
+ exit(1);
+ }
+
+ Ftpfclose(input);
+ Ftpfclose(output);
+
+ exit(0);
+
+}
OpenPOWER on IntegriCloud