[CMAKE]
[reactos.git] / base / applications / network / ftp / ftp.c
index cc21736..5fdc81c 100644 (file)
@@ -295,7 +295,7 @@ int command(const char *fmt, ...)
                printf("\n");
                (void) fflush(stdout);
        }
-       if (cout == (int) NULL) {
+       if (cout == 0) {
                perror ("No control connection for command");
                code = -1;
                return (0);
@@ -345,7 +345,7 @@ getreply(expecteof)
                cp = reply_string;
                while ((c = fgetcSocket(cin)) != '\n') {
                        if (c == IAC) {     /* handle telnet commands */
-                               switch (c = fgetcSocket(cin)) {
+                               switch (fgetcSocket(cin)) {
                                case WILL:
                                case WONT:
                                        c = fgetcSocket(cin);
@@ -461,7 +461,7 @@ void sendrequest(const char *cmd, const char *local, const char *remote, int pri
 {
        FILE *fin;
        int dout = 0;
-       int (*closefunc)(), _pclose(), fclose();
+       int (*closefunc)();
        sig_t (*oldintr)(), (*oldintp)();
        char buf[BUFSIZ], *bufp;
        long bytes = 0, hashbytes = HASHBYTES;
@@ -583,7 +583,7 @@ null();//                           (void) signal(SIGPIPE, oldintp);
                        return;
                }
        dout = dataconn(mode);
-       if (dout == (int)NULL)
+       if (!dout)
                goto abort;
        (void) gettimeofday(&start, (struct timezone *)0);
 null();//      oldintp = signal(SIGPIPE, SIG_IGN);
@@ -735,7 +735,7 @@ void recvrequest(const char *cmd, const char *local, const char *remote, const c
 {
        FILE *fout = stdout;
        int din = 0;
-       int (*closefunc)(), _pclose(), fclose();
+       int (*closefunc)();
        void (*oldintr)(int), (*oldintp)(int);
        int oldverbose = 0, oldtype = 0, is_retr, tcrflag, nfnd, bare_lfs = 0;
        char msg;
@@ -745,10 +745,9 @@ void recvrequest(const char *cmd, const char *local, const char *remote, const c
        long bytes = 0, hashbytes = HASHBYTES;
 //     struct
                fd_set mask;
-       register int c, d;
+       register int c;
        struct timeval start, stop;
 //     struct stat st;
-       extern void *malloc();
 
        is_retr = strcmp(cmd, "RETR") == 0;
        if (is_retr && verbose && printnames) {
@@ -782,6 +781,7 @@ null();//                   (void) signal(SIGINT, oldintr);
 null();//      oldintr = signal(SIGINT, abortrecv);
        if (strcmp(local, "-") && *local != '|') {
 #ifndef _WIN32
+       register int d;
 // This whole thing is a problem... access Won't work on non-existent files
                if (access(local, 2) < 0) {
                        char *dir = rindex(local, '/');
@@ -888,7 +888,7 @@ null();//                   (void) signal(SIGINT, oldintr);
                }
        }
        din = dataconn("r");
-       if (din == (int)NULL)
+       if (!din)
                goto abort;
        if (strcmp(local, "-") == 0)
                fout = stdout;
@@ -920,7 +920,7 @@ null();//           oldintp = signal(SIGPIPE, SIG_IGN);
                                (*closefunc)(fout);
                        return;
                }
-               errno = d = 0;
+               errno = 0;
 //             while ((c = recv(din, buf, bufsize, 1)) > 0) {
 //                     if ((d = write(fileno(fout), buf, c)) != c)
 //                     if ((d = write(fileno(fout), buf, c)) != c)
@@ -1107,10 +1107,10 @@ null();//               (void) signal(SIGINT,oldintr);
                lostpeer();
        }
        if (din && FD_ISSET(din, &mask)) {
-               while ((c = recv(din, buf, bufsize, 0)) > 0)
+               while (recv(din, buf, bufsize, 0) > 0)
                        ;
        }
-       if ((c = getreply(0)) == ERROR && code == 552) { /* needed for nic style abort */
+       if (getreply(0) == ERROR && code == 552) { /* needed for nic style abort */
                if (data >= 0) {
                        (void) close(data);
                        data = -1;
@@ -1137,13 +1137,6 @@ null();//                (void) signal(SIGINT,oldintr);
 null();//      (void) signal(SIGINT,oldintr);
 }
 
-/*
- * Need to start a listen on the data channel
- * before we send the command, otherwise the
- * server's connect may fail.
- */
-int sendport = -1;
-
 int
 initconn()
 {
@@ -1272,7 +1265,7 @@ int dataconn(const char *mode)
        if (s < 0) {
                perror("ftp: accept");
                (void) closesocket(data), data = -1;
-               return (int) (NULL);
+               return 0;
        }
        if(closesocket(data)) {
                int iret=WSAGetLastError ();