summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-04-25 15:08:02 +0000
committerjkh <jkh@FreeBSD.org>1995-04-25 15:08:02 +0000
commitfee915936394cebed78146c4bddb559eeeacf5d8 (patch)
tree9b41805883586269b27067b1538439a945b6b2e1 /lib
parente20597c1efe3291616fa34994320d3b84f438406 (diff)
downloadFreeBSD-src-fee915936394cebed78146c4bddb559eeeacf5d8.zip
FreeBSD-src-fee915936394cebed78146c4bddb559eeeacf5d8.tar.gz
Now check all the warning purges and general clean-up in on the second
pass.
Diffstat (limited to 'lib')
-rw-r--r--lib/libftp/FtpAbort.c6
-rw-r--r--lib/libftp/FtpBye.c9
-rw-r--r--lib/libftp/FtpConnect.c1
-rw-r--r--lib/libftp/FtpData.c10
-rw-r--r--lib/libftp/FtpDebug.c6
-rw-r--r--lib/libftp/FtpFilenameChecker.c4
-rw-r--r--lib/libftp/FtpFull.c2
-rw-r--r--lib/libftp/FtpGetHost.c2
-rw-r--r--lib/libftp/FtpIO.c4
-rw-r--r--lib/libftp/FtpInit.c1
-rw-r--r--lib/libftp/FtpLibrary.h5
-rw-r--r--lib/libftp/FtpMessage.c6
-rw-r--r--lib/libftp/FtpPasv.c5
-rw-r--r--lib/libftp/FtpRetr.c8
-rw-r--r--lib/libftp/FtpStor.c1
-rw-r--r--lib/libftp/FtpSyscalls.c5
-rw-r--r--lib/libftp/Makefile21
-rw-r--r--lib/libftp/utils/Makefile6
-rw-r--r--lib/libftp/utils/cdefs.h2
19 files changed, 66 insertions, 38 deletions
diff --git a/lib/libftp/FtpAbort.c b/lib/libftp/FtpAbort.c
index 50b32e6..98d72b8 100644
--- a/lib/libftp/FtpAbort.c
+++ b/lib/libftp/FtpAbort.c
@@ -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;
}
diff --git a/lib/libftp/FtpBye.c b/lib/libftp/FtpBye.c
index de300d5..f664cf6 100644
--- a/lib/libftp/FtpBye.c
+++ b/lib/libftp/FtpBye.c
@@ -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;
}
diff --git a/lib/libftp/FtpConnect.c b/lib/libftp/FtpConnect.c
index 6869e60..e114a50 100644
--- a/lib/libftp/FtpConnect.c
+++ b/lib/libftp/FtpConnect.c
@@ -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)
{
diff --git a/lib/libftp/FtpData.c b/lib/libftp/FtpData.c
index e0c768e..c1bbdb8 100644
--- a/lib/libftp/FtpData.c
+++ b/lib/libftp/FtpData.c
@@ -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);
diff --git a/lib/libftp/FtpDebug.c b/lib/libftp/FtpDebug.c
index c7fa811..98686b9 100644
--- a/lib/libftp/FtpDebug.c
+++ b/lib/libftp/FtpDebug.c
@@ -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;
}
diff --git a/lib/libftp/FtpFilenameChecker.c b/lib/libftp/FtpFilenameChecker.c
index 47483d4..0d486c4 100644
--- a/lib/libftp/FtpFilenameChecker.c
+++ b/lib/libftp/FtpFilenameChecker.c
@@ -35,9 +35,9 @@ STATUS FtpFilenameChecker(char ** in, char ** out)
strcat(new,"/");
strcat(new,sfn);
*out=new;
- return;
+ return 0;
};
-
+ return 0;
}
diff --git a/lib/libftp/FtpFull.c b/lib/libftp/FtpFull.c
index aefaa2d..e2e6a56 100644
--- a/lib/libftp/FtpFull.c
+++ b/lib/libftp/FtpFull.c
@@ -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 )
{
diff --git a/lib/libftp/FtpGetHost.c b/lib/libftp/FtpGetHost.c
index e0c2305..3dca113 100644
--- a/lib/libftp/FtpGetHost.c
+++ b/lib/libftp/FtpGetHost.c
@@ -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)
diff --git a/lib/libftp/FtpIO.c b/lib/libftp/FtpIO.c
index 3686981..ee70100 100644
--- a/lib/libftp/FtpIO.c
+++ b/lib/libftp/FtpIO.c
@@ -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);
diff --git a/lib/libftp/FtpInit.c b/lib/libftp/FtpInit.c
index eee7cea..184f7fb 100644
--- a/lib/libftp/FtpInit.c
+++ b/lib/libftp/FtpInit.c
@@ -25,6 +25,7 @@ FTP FtpInit = {
0, /*flags*/
{120,0}, /*timeout 2 min*/
21, /*Port*/
+ "johndoe", /* Title */
0, /*Counter*/
};
diff --git a/lib/libftp/FtpLibrary.h b/lib/libftp/FtpLibrary.h
index 02aa662..9a045d8 100644
--- a/lib/libftp/FtpLibrary.h
+++ b/lib/libftp/FtpLibrary.h
@@ -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);
diff --git a/lib/libftp/FtpMessage.c b/lib/libftp/FtpMessage.c
index dd02261..90106b1 100644
--- a/lib/libftp/FtpMessage.c
+++ b/lib/libftp/FtpMessage.c
@@ -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)];
}
diff --git a/lib/libftp/FtpPasv.c b/lib/libftp/FtpPasv.c
index 88b000d..d2959b7 100644
--- a/lib/libftp/FtpPasv.c
+++ b/lib/libftp/FtpPasv.c
@@ -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;
}
diff --git a/lib/libftp/FtpRetr.c b/lib/libftp/FtpRetr.c
index 889621f..eb19c16 100644
--- a/lib/libftp/FtpRetr.c
+++ b/lib/libftp/FtpRetr.c
@@ -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)
diff --git a/lib/libftp/FtpStor.c b/lib/libftp/FtpStor.c
index 2fe218c..9ddb326 100644
--- a/lib/libftp/FtpStor.c
+++ b/lib/libftp/FtpStor.c
@@ -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)
diff --git a/lib/libftp/FtpSyscalls.c b/lib/libftp/FtpSyscalls.c
index d1c74e6..649d16f 100644
--- a/lib/libftp/FtpSyscalls.c
+++ b/lib/libftp/FtpSyscalls.c
@@ -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;\
}
diff --git a/lib/libftp/Makefile b/lib/libftp/Makefile
index d75e47a..ebb6b5b 100644
--- a/lib/libftp/Makefile
+++ b/lib/libftp/Makefile
@@ -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>
diff --git a/lib/libftp/utils/Makefile b/lib/libftp/utils/Makefile
index 783451b..d750ca7 100644
--- a/lib/libftp/utils/Makefile
+++ b/lib/libftp/utils/Makefile
@@ -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
diff --git a/lib/libftp/utils/cdefs.h b/lib/libftp/utils/cdefs.h
index c104b9e..fc329d6 100644
--- a/lib/libftp/utils/cdefs.h
+++ b/lib/libftp/utils/cdefs.h
@@ -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
OpenPOWER on IntegriCloud