Projects / libfget

libfget

fget is a commandline tool for mirroring remote files via FTP. It is based upon the included FTP client library, whose API is designed to resemble the normal Unix API for accessing files and directories. This interface should make it very easy to integrate FTP support into other applications.

Tags
Licenses
Operating Systems
Implementation

Recent releases

  •  14 May 2005 10:53

    Release Notes: An option to download files into the current directory instead of creating a subdirectory with the name of the remote directory was added.

    •  07 Nov 2004 04:02

      Release Notes: This version features several minor portability and bugfixes, including one bug that caused the directory cache to fail to refresh properly in many cases.

      •  14 Aug 2004 18:37

        Release Notes: This release includes some minor portability fixes, improved error handling, and a number of documentation improvements.

        •  19 Jul 2004 08:42

          Release Notes: This release includes a huge number of API improvements, a few new features, and a number of bug fixes. Noteworthy changes include a new extensible option mechanism, a better interface for debugging hooks, improved thread safety on most platforms, and better timeout handling.

          •  24 Dec 2002 05:24

            Release Notes: Various portability fixes were made.

            Recent comments

            30 Aug 2004 21:18 roth

            Re: how to disable dircache


            There is currently no mechanism for completely disabling the directory cache. However, you can usually work around this by changing the values of the FTP_OPT_CACHE_MAXSIZE and/or FTP_OPT_CACHE_EXPIRE options; see the ftp_set_options(3) man page for details.


            If neither of those options solves your problem, I may be able to add an option to completely disable the directory cache. Please join the fget mailing list if you'd like to discuss this further.


            Good luck!

            30 Aug 2004 21:11 roth

            Re: test code on hp-ux ( libfget configed as "LIBS=-ld4r ./configure")


            I'd be happy to help you debug this problem further, but the project comment section here on freshmeat is a rather cumbersome way to communicate about this. Instead of posting here, please post this information to the fget mailing list so that I can help you more effectively.


            You can join the fget mailing list here:


            https://lists.feep.net:8080/mailman/listinfo.cgi/fget


            Thanks!

            30 Aug 2004 19:33 ricky_weng

            how to disable dircache
            I try scanning a specified dir on ftp server every 30 second . if a file found , get it , then delete it.

            while new log files will keep on being moved to that dir by server applications .

            I use ftp_opendir,ftp_readdir and ftp_closedir to scan the dir and process files . but dircache makes me in trouble ! I have to close the connection and re-connect to refresh the dir list .

            is there a better solution ?

            29 Aug 2004 23:34 ricky_weng

            test code on hp-ux ( libfget configed as "LIBS=-ld4r ./configure")


            Makefile :

            CC= cc

            CFLAGS= -g -D_REENTRANT

            LIBS = libfget.a -ld4r

            all: fexp

            fexp: fexp.o

            $(CC) -o fexp fexp.o $(LIBS)

            fexp.o: fexp.c

            $(CC) $(CFLAGS) -o fexp.o -c fexp.c

            clean:

            rm -f *.o

            rm -f fexp

            test program fexp.c :

            #include <stdio.h>

            #include <errno.h>

            #include <pthread.h>

            #include "libfget.h"

            void thread_main (void *arg);

            void send_debug(char *text,FTP* ftp, void *arg);

            void recv_debug(char *text,FTP* ftp, void *arg);

            int main( int argc, char **argv )

            {

            thread_main (NULL);

            /*

            pthread_t tid;

            int ret ;

            ret = pthread_create(&tid,NULL,thread_main,NULL);

            if(ret)

            {

            fprintf(stderr,"Create pthread error!\n");

            exit (1);

            }

            pthread_join(tid,NULL);

            */

            return 0 ;

            }

            void thread_main (void *arg)

            {

            FTP *ftp = NULL ;

            char *host = "1.1.1.111" ;

            char *user = "ricky";

            char *pass = "hello" ;

            if( ftp_connect(&ftp,host,NULL,0,FTP_CONNECT_DNS_RR,\

            FTP_OPT_IO_TIMEOUT,60,\

            FTP_OPT_CACHE_EXPIRE,(long)0,\

            FTP_OPT_SEND_HOOK,send_debug,\

            FTP_OPT_RECV_HOOK,recv_debug,\

            FTP_OPT_HOOK_DATA,NULL,0) == -1)

            {

            fprintf(stderr,"Connect [ %s ] fail ! <<%s>>\n",host,strerror(errno));

            return ;

            }

            fprintf(stdout,"Connect to host [ %s ] OK !\n",host);

            if(ftp_login(ftp, user, pass) == -1)

            {

            fprintf(stderr,"Login as user : [ %s/%s ] fail ! <<%s>>\n ",user,pass,strerror(errno));

            ftp_quit(ftp,0);

            return ;

            }

            fprintf(stdout,"Login as [ %s/%s ] OK !\n",user,pass);

            fprintf(stdout,"Quit !\n");

            ftp_quit(ftp,0);

            return ;

            }

            void send_debug(char *msg,FTP* ftp, void *arg)

            {

            fprintf(stdout,">> %s\n",msg);

            }

            void recv_debug(char *msg,FTP* ftp, void *arg)

            {

            fprintf(stdout,"<< %s\n",msg);

            }

            run test program :

            [ricky@hp-mbill fget_test]$ ./fexp

            Connect [ 1.1.1.111 ] fail ! <<Invalid argument>>

            [ricky@hp-mbill fget_test]$

            29 Aug 2004 19:45 ricky_weng

            Re: fget-1.3.1 , multithread , hp-ux
            The fget command doesn't work either, and reported same error!

            >

            > % I use "LIBS=-ld4r

            > ./configure"

            > % to build fget-1.3.1 on

            > % hp-ux(pa-11.11), everything is ok .

            > then

            > % in my application , I call

            > ftp_connect()

            > % in thread to setup ftp connection ,it

            > % reported error ( errno=0). but the

            > % same application can work on linux ,

            > I

            > % think it has something to do with

            > % thread-safe function , what shall I do

            > ?

            >

            >

            > I don't have access to an HP-UX system

            > to test this, so I can't be of much

            > direct help.

            >

            > Does the fget command-line utility work

            > for you? If so, libfget is probably

            > working fine.

            >

            > I suggest that you try building a simple

            > test program, just to see if you can

            > reproduce the problem. If you can,

            > please mail your test program to the

            > fget mailing list, and I will see if I

            > can help you further.

            >

            > Good luck!

            >

            Screenshot

            Project Spotlight

            OpenStack4j

            A Fluent OpenStack client API for Java.

            Screenshot

            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.