Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jan 1995 07:05:50 -0600
From:      Peter da Silva <peter@bonkers.taronga.com>
To:        hackers@FreeBSD.org
Subject:   uftp
Message-ID:  <199501201305.HAA16898@bonkers.taronga.com>

next in thread | raw e-mail | index | archive | help
The recently posted libftp software might be the solution to the problem
of getting a reasonable FTP environment for installing. I understand the
disks currently use ncftp but its error handling sucks. This is way better
and quite clean.

Author of uftp and libftp
         Oleg Orel

         Department of Electronics and automatisation.

         Institute for High Energy Physics

         Protvino, Russia

         E-mail: orel@oea.ihep.su, orel@dxcern.cern.ch

Here's an example of a "dumb copy" program using libftp.

/* 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);
  
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199501201305.HAA16898>