Now check all the warning purges and general clean-up in on the second
pass.
This commit is contained in:
parent
6f52f41fb2
commit
8e47e70f34
@ -13,8 +13,9 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
int
|
||||
FtpAbort(FTP *ftp)
|
||||
{
|
||||
fd_set fds;
|
||||
@ -36,11 +37,10 @@ FtpAbort(FTP *ftp)
|
||||
|
||||
while (select ( getdtablesize(), &fds, 0,0, &(ftp->timeout) )>0)
|
||||
{
|
||||
register int i;
|
||||
|
||||
FtpGetMessage(ftp,msg);
|
||||
if (FtpGood(FtpNumber(msg),225,226,EOF)) break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,9 +17,6 @@ Commercial usage is also possible with participation of it's author.
|
||||
|
||||
STATUS FtpBye(FTP *ftp)
|
||||
{
|
||||
String S1;
|
||||
int i;
|
||||
|
||||
FtpAssert(ftp,FtpCommand(ftp,"QUIT",221,EOF));
|
||||
|
||||
fclose(FTPCMD(ftp));
|
||||
@ -29,9 +26,7 @@ STATUS FtpBye(FTP *ftp)
|
||||
|
||||
STATUS FtpQuickBye(FTP *ftp)
|
||||
{
|
||||
|
||||
|
||||
if (ftp == NULL) return;
|
||||
if (ftp == NULL) return 0;
|
||||
|
||||
if (FTPDATA(ftp)!=NULL)
|
||||
{
|
||||
@ -44,7 +39,7 @@ STATUS FtpQuickBye(FTP *ftp)
|
||||
shutdown(fileno(FTPCMD(ftp)),2);
|
||||
fclose(FTPCMD(ftp));
|
||||
}
|
||||
|
||||
free(ftp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
STATUS FtpConnect(FTP **con,char * hostname)
|
||||
{
|
||||
|
@ -13,13 +13,15 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
STATUS FtpData(FTP * con,char * command , char * file ,char * mode)
|
||||
{
|
||||
struct sockaddr_in data,from;
|
||||
register struct hostent *host;
|
||||
String hostname,cmd;
|
||||
int NewSocket,Accepted_Socket,len=sizeof(data),one=1,fromlen=sizeof(from),i;
|
||||
String hostname;
|
||||
int NewSocket,Accepted_Socket,len=sizeof(data),one=1,fromlen=sizeof(from),
|
||||
i = 0;
|
||||
char *a,*b;
|
||||
|
||||
FREE(data);
|
||||
@ -50,7 +52,7 @@ STATUS FtpData(FTP * con,char * command , char * file ,char * mode)
|
||||
if ( bind ( NewSocket , (struct sockaddr *)&data , sizeof data ) < 0 )
|
||||
return EXIT(con,QUIT);
|
||||
|
||||
if ( getsockname ( NewSocket , &data , &len ) < 0 )
|
||||
if ( getsockname ( NewSocket , (struct sockaddr *)&data , &len ) < 0 )
|
||||
return EXIT(con,QUIT);
|
||||
|
||||
if ( listen ( NewSocket , 1 ) < 0 )
|
||||
@ -71,7 +73,7 @@ STATUS FtpData(FTP * con,char * command , char * file ,char * mode)
|
||||
FtpAssert(con, FtpCommand ( con , command , file ,
|
||||
200, 120 , 150 , 125 , 250 , EOF ));
|
||||
|
||||
if (( Accepted_Socket = accept (NewSocket , &from , &fromlen )) < 0)
|
||||
if (( Accepted_Socket = accept (NewSocket , (struct sockaddr *)&from , &fromlen )) < 0)
|
||||
{
|
||||
close(NewSocket);
|
||||
return EXIT(con,QUIT);
|
||||
|
@ -49,6 +49,7 @@ STATUS FtpDebugError(FTP *ftp,int n, char * Message)
|
||||
FtpLog(ftp->title,Message);
|
||||
if ( ! FtpTestFlag(ftp,FTP_NOEXIT))
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATUS FtpDebugIO(FTP *ftp,int n, char * Message)
|
||||
@ -57,6 +58,7 @@ STATUS FtpDebugIO(FTP *ftp,int n, char * Message)
|
||||
FtpLog(ftp->title,Message);
|
||||
if ( ! FtpTestFlag(ftp,FTP_NOEXIT))
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATUS FtpLog(char *name,char *str)
|
||||
@ -66,14 +68,16 @@ STATUS FtpLog(char *name,char *str)
|
||||
fprintf(stderr,"%02d:%02d:%02d %s %s\n",lt->tm_hour,
|
||||
lt->tm_min,lt->tm_sec,name,str);
|
||||
fflush(stderr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
FtpHash(FTP *ftp, unsigned long chars)
|
||||
{
|
||||
|
||||
if (chars==0) return ftp->counter=0;
|
||||
ftp->counter+=chars;
|
||||
fprintf(stdout,"%10u bytes transfered\r",ftp->counter);
|
||||
fprintf(stdout,"%10u bytes transfered\r",(unsigned int)ftp->counter);
|
||||
fflush(stdout);
|
||||
return ftp->counter;
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ STATUS FtpFilenameChecker(char ** in, char ** out)
|
||||
strcat(new,"/");
|
||||
strcat(new,sfn);
|
||||
*out=new;
|
||||
return;
|
||||
return 0;
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,10 +13,10 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
||||
static FTP *ftp_table[256];
|
||||
static STATUS syntax();
|
||||
|
||||
FILE * FtpFullOpen(char * file , char * mode )
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
struct hostent *FtpGetHost(char *host)
|
||||
|
@ -13,6 +13,7 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int FtpRead(FTP *con)
|
||||
{
|
||||
@ -87,13 +88,14 @@ STATUS FtpPutc(FTP *ftp,FILE *fp,char c)
|
||||
return EXIT(ftp,QUIT);
|
||||
|
||||
if (ftp->hash!=NULL) (*ftp->hash)(ftp,1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STATUS FtpReadBlock(FTP *ftp, char *buffer, int size)
|
||||
{
|
||||
fd_set fds;
|
||||
register int rsize,status;
|
||||
register int rsize;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fileno(FTPDATA(ftp)),&fds);
|
||||
|
@ -25,6 +25,7 @@ FTP FtpInit = {
|
||||
0, /*flags*/
|
||||
{120,0}, /*timeout 2 min*/
|
||||
21, /*Port*/
|
||||
"johndoe", /* Title */
|
||||
0, /*Counter*/
|
||||
};
|
||||
|
||||
|
@ -20,6 +20,8 @@ Commercial usage is also possible with participation of it's author.
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/timeb.h>
|
||||
@ -174,6 +176,9 @@ STATUS FtpPort ( FTP *con ,int ,int ,int ,int ,int ,int );
|
||||
STATUS FtpOpenDir( FTP * con , char * files );
|
||||
STATUS FtpClose ( FTP *);
|
||||
|
||||
STATUS FtpReadBlock(FTP *ftp, char *buffer, int size);
|
||||
STATUS FtpWriteBlock(FTP *ftp, char *buffer, int size);
|
||||
|
||||
/* Command for hand transfer */
|
||||
|
||||
STATUS FtpRead ( FTP * con);
|
||||
|
@ -13,7 +13,7 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static char * FtpMessageList[1000];
|
||||
|
||||
@ -45,7 +45,7 @@ INLINE static char *___gets(char *s, int maxchars, FTP *ftp)
|
||||
|
||||
int FtpGetMessage(FTP *con , char * Message )
|
||||
{
|
||||
int i=0,n;
|
||||
int n;
|
||||
char tmp[1024];
|
||||
|
||||
while(1)
|
||||
@ -95,7 +95,7 @@ char *FtpMessage(int number)
|
||||
|
||||
FtpInitMessageList();
|
||||
if ( number == 0 )
|
||||
return sys_errlist[errno];
|
||||
return (char *)sys_errlist[errno];
|
||||
return (FtpMessageList[abs(number)]==NULL)?
|
||||
"":FtpMessageList[abs(number)];
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
char * FtpPasv (FTP *ftp)
|
||||
{
|
||||
@ -46,6 +47,7 @@ STATUS FtpLink(FTP *ftp1, FTP *ftp2)
|
||||
strcpy(PORT,FtpPasv(ftp1));
|
||||
|
||||
FtpCommand(ftp2,"PORT %s",PORT,200,EOF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *f1, char *f2)
|
||||
@ -89,6 +91,7 @@ STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *f1, char *f2)
|
||||
FtpGetMessage(ftp1,tmp);
|
||||
FtpLog(ftp1->title,tmp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,16 +13,18 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
extern STATUS FtpFilenameChecker(char ** in, char ** out);
|
||||
|
||||
STATUS FtpRetr (FTP * con , char * command ,
|
||||
char *in , char * out)
|
||||
{
|
||||
FILE *o;
|
||||
int c;
|
||||
struct stat st;
|
||||
char buffer[FTPBUFSIZ],buffer2[FTPBUFSIZ];
|
||||
char buffer[FTPBUFSIZ];
|
||||
register int size;
|
||||
|
||||
|
||||
FtpFilenameChecker(&in,&out);
|
||||
|
||||
if ( FtpTestFlag(con,FTP_REST) && stat(out,&st)==0)
|
||||
|
@ -13,6 +13,7 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
|
||||
STATUS FtpStor (FTP * con , char * command ,
|
||||
char *in , char * out)
|
||||
|
@ -13,12 +13,13 @@ Commercial usage is also possible with participation of it's author.
|
||||
*/
|
||||
|
||||
#include "FtpLibrary.h"
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define DEF(syscal,name) name(a,b,c,d,e,f,g,h) \
|
||||
#define DEF(syscal,name) int name(void *a, void *b, void *c) \
|
||||
{\
|
||||
register int status;\
|
||||
while (((status=syscal(a,b,c,d,e,f,g,h))==-1) && (errno==EINTR));\
|
||||
while (((status=syscal(a,b,c))==-1) && (errno==EINTR));\
|
||||
return status;\
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,20 @@
|
||||
LIB= ftp
|
||||
CFLAGS+= -I${.CURDIR}
|
||||
CFLAGS+= -I${.CURDIR} -Wall
|
||||
|
||||
SRCS= FtpAbort.c FtpArchie.c FtpBye.c FtpClose.c FtpCommand.c FtpConnect.c \
|
||||
FtpCopy.c FtpData.c FtpDebug.c FtpFilenameChecker.c FtpFull.c \
|
||||
FtpMove.c FtpOpenDir.c FtpPasv.c FtpPort.c FtpPwd.c FtpRetr.c \
|
||||
FtpSize.c FtpStor.c FtpType.c Ftpfopen.c
|
||||
SRCS= FtpAbort.c FtpFull.c FtpPasv.c \
|
||||
FtpArchie.c FtpGetHost.c FtpPort.c \
|
||||
FtpBye.c FtpGood.c FtpPwd.c \
|
||||
FtpClose.c FtpIO.c FtpRetr.c \
|
||||
FtpCommand.c FtpInit.c FtpSize.c \
|
||||
FtpConnect.c FtpLogin.c FtpStor.c \
|
||||
FtpCopy.c FtpMessage.c \
|
||||
FtpData.c FtpMove.c FtpType.c \
|
||||
FtpDebug.c Ftpfopen.c \
|
||||
FtpFilenameChecker.c FtpOpenDir.c
|
||||
|
||||
beforeinstall:
|
||||
-cd ${.CURDIR}; cmp -s FtpLibrary.h ${DESTDIR}/usr/include/FtpLibrary.h || \
|
||||
install -c -o ${BINOWN} -g ${BINGRP} -m 444 FtpLibrary.h \
|
||||
${DESTDIR}/usr/include
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
@ -17,13 +17,13 @@ DPADD+= ${.CURDIR}/../libftp.a
|
||||
all: ftptry mirror uftp
|
||||
|
||||
ftptry: ftptry.o
|
||||
$(CC) $(CFLAGS) -o ftptry ftptry.o -lftp
|
||||
$(CC) $(CFLAGS) -o ftptry ftptry.o ${LDADD} -lftp
|
||||
|
||||
uftp: uftp.o uftpcmd.o libetc.a
|
||||
$(CC) $(CFLAGS) -o uftp uftp.o uftpcmd.o -lftp -letc
|
||||
$(CC) $(CFLAGS) -o uftp uftp.o uftpcmd.o ${LDADD} -lftp -letc
|
||||
|
||||
mirror: mirror.o
|
||||
$(CC) $(CFLAGS) -o mirror mirror.o -lftp
|
||||
$(CC) $(CFLAGS) -o mirror mirror.o ${LDADD} -lftp
|
||||
|
||||
clean:
|
||||
rm -f ftptry mirror uftp *~ *.o *.a
|
||||
|
@ -54,7 +54,7 @@
|
||||
* in between its arguments. __CONCAT can also concatenate double-quoted
|
||||
* strings produced by the __STRING macro, but this only works with ANSI C.
|
||||
*/
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#if (defined(__STDC__) || defined(__cplusplus)) && !defined(__CONCAT)
|
||||
#define __P(protos) protos /* full-blown ANSI C */
|
||||
#define __CONCAT(x,y) x ## y
|
||||
#define __STRING(x) #x
|
||||
|
Loading…
Reference in New Issue
Block a user