[comp.unix.questions] Application Programming Interface for FTP

whna@cgch.UUCP (Heinz Naef) (01/06/88)

Did anyone develop a (limited) FTP client, implemented as a C programming
library, usable from within application programs to allow them to request
standard FTP servers in the network to send or receive a file?

Do any standard semantics exist for such an application programming interface?

Any comments are welcome.

Regards,
Heinz Naef, c/o CIBA-GEIGY AG, R-1032.5.62, P.O.Box, CH-4002 Basel, Switzerland
uucp: cgch!whna - bitnet: whna%cgch.uucp@cernvax.bitnet
                  phone: (+41) 61 37 26 75
                  fax:   (+41) 61 36 43 54 (Attn: H.Naef, R-1032.5.62)

dsg@mitre-bedford.arpa (Dave Goldberg) (01/08/88)

If such a library exists, I'd like to hear about it.  What I've done to work
around the lack of same is to build a file with ftp commands in it and then
use system(3) to execute ftp with input redirected from the file.  To avoid
the password hassle, the ftp at our site provides the facility to have a
file called .netrc in the home directory.  This file is searched for user
names and passwords to be used on the remote system.  It isn't mentioned in
our ftp man page, so I can't be sure if it is a standard though.

--------------------------------------------------------------------------
Dave Goldberg	             ARPA: dsg@mitre-bedford.arpa
The Mitre Corporation        UUCP: linus!mbunix!dsg
MS B015
Bedford, MA 01730
617-271-2460

matt@oddjob.UChicago.EDU (Maxwell House Daemon) (01/09/88)

In article <11180@brl-adm.ARPA> dsg@mitre-bedford.arpa (Dave Goldberg) writes:

) [The ~/.netrc file] isn't mentioned in
) our ftp man page, so I can't be sure if it is a standard though.

It must be standard.  If it were a local addition, somebody would
have had the sense to add it to the man page.
________________________________________________________
Matt	     University		matt@oddjob.uchicago.edu
Crawford     of Chicago     {astrovax,ihnp4}!oddjob!matt

lm@arizona.edu (Larry McVoy) (01/16/88)

In article <571@cgcha.cgch.UUCP> whna@cgch.UUCP (Heinz Naef) writes:
>Did anyone develop a (limited) FTP client, implemented as a C programming
>library, usable from within application programs to allow them to request
>standard FTP servers in the network to send or receive a file?
>
How about

/*
 * send a file via ftp
 *
 * Bugs	- no error checking/handling
 *	- password is in cleartext
 */
send(host, user, passwd, file)
	char* host;
	char* user;
	char* passwd;
	char* file;
{
	FILE* ftp;

	ftp = popen("ftp", "w");
	fprintf(ftp, "open %s\n", host);
	fprintf(ftp, "%s\n", user);
	fprintf(ftp, "%s\n", passwd);
	fprintf(ftp, "put %s\n", file);
	pclose(ftp);
}