fix indent
This commit is contained in:
		
							
								
								
									
										61
									
								
								ftp.c
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								ftp.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: ftp.c,v 1.21 2003/01/11 15:54:09 ukai Exp $ */
 | 
					/* $Id: ftp.c,v 1.22 2003/01/11 15:55:10 ukai Exp $ */
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <pwd.h>
 | 
					#include <pwd.h>
 | 
				
			||||||
#include <Str.h>
 | 
					#include <Str.h>
 | 
				
			||||||
@@ -52,7 +52,7 @@ ftp_command(FTP ftp, char *cmd, char *arg, int *status)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!status)
 | 
					    if (!status)
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
    *status = -1;	/* error */
 | 
					    *status = -1;		/* error */
 | 
				
			||||||
    tmp = StrISgets(ftp->rf);
 | 
					    tmp = StrISgets(ftp->rf);
 | 
				
			||||||
    if (IS_DIGIT(tmp->ptr[0]) && IS_DIGIT(tmp->ptr[1]) &&
 | 
					    if (IS_DIGIT(tmp->ptr[0]) && IS_DIGIT(tmp->ptr[1]) &&
 | 
				
			||||||
	IS_DIGIT(tmp->ptr[2]) && tmp->ptr[3] == ' ')
 | 
						IS_DIGIT(tmp->ptr[2]) && tmp->ptr[3] == ' ')
 | 
				
			||||||
@@ -60,15 +60,15 @@ ftp_command(FTP ftp, char *cmd, char *arg, int *status)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (tmp->ptr[3] != '-')
 | 
					    if (tmp->ptr[3] != '-')
 | 
				
			||||||
	return tmp;
 | 
						return tmp;
 | 
				
			||||||
	/* RFC959 4.2 FTP REPLIES */
 | 
					    /* RFC959 4.2 FTP REPLIES */
 | 
				
			||||||
	/* multi-line response start */
 | 
					    /* multi-line response start */
 | 
				
			||||||
	/* 
 | 
					    /* 
 | 
				
			||||||
	 * Thus the format for multi-line replies is that the
 | 
					     * Thus the format for multi-line replies is that the
 | 
				
			||||||
	 * first line will begin with the exact required reply
 | 
					     * first line will begin with the exact required reply
 | 
				
			||||||
	 * code, followed immediately by a Hyphen, "-" (also known 
 | 
					     * code, followed immediately by a Hyphen, "-" (also known 
 | 
				
			||||||
	 * as Minus), followed by text.  The last line will begin
 | 
					     * as Minus), followed by text.  The last line will begin
 | 
				
			||||||
	 * with the same code, followed immediately by Space <SP>, 
 | 
					     * with the same code, followed immediately by Space <SP>, 
 | 
				
			||||||
	 * optionally some text, and the Telnet end-of-line code. */
 | 
					     * optionally some text, and the Telnet end-of-line code. */
 | 
				
			||||||
    while (1) {
 | 
					    while (1) {
 | 
				
			||||||
	tmp = StrISgets(ftp->rf);
 | 
						tmp = StrISgets(ftp->rf);
 | 
				
			||||||
	if (IS_DIGIT(tmp->ptr[0]) && IS_DIGIT(tmp->ptr[1]) &&
 | 
						if (IS_DIGIT(tmp->ptr[0]) && IS_DIGIT(tmp->ptr[1]) &&
 | 
				
			||||||
@@ -87,8 +87,8 @@ ftp_close(FTP ftp)
 | 
				
			|||||||
	return;
 | 
						return;
 | 
				
			||||||
    if (ftp->rf) {
 | 
					    if (ftp->rf) {
 | 
				
			||||||
	IStype(ftp->rf) &= ~IST_UNCLOSE;
 | 
						IStype(ftp->rf) &= ~IST_UNCLOSE;
 | 
				
			||||||
        ISclose(ftp->rf);
 | 
						ISclose(ftp->rf);
 | 
				
			||||||
        ftp->rf = NULL;
 | 
						ftp->rf = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (ftp->wf) {
 | 
					    if (ftp->wf) {
 | 
				
			||||||
	fclose(ftp->wf);
 | 
						fclose(ftp->wf);
 | 
				
			||||||
@@ -119,8 +119,7 @@ ftp_login(FTP ftp)
 | 
				
			|||||||
	    struct sockaddr_in sockname;
 | 
						    struct sockaddr_in sockname;
 | 
				
			||||||
	    int socknamelen = sizeof(sockname);
 | 
						    int socknamelen = sizeof(sockname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    if (!getsockname(sock, (struct sockaddr *)&sockname,
 | 
						    if (!getsockname(sock, (struct sockaddr *)&sockname, &socknamelen)) {
 | 
				
			||||||
			     &socknamelen)) {
 | 
					 | 
				
			||||||
		struct hostent *sockent;
 | 
							struct hostent *sockent;
 | 
				
			||||||
		tmp = Strnew_charp(ftp->pass);
 | 
							tmp = Strnew_charp(ftp->pass);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -264,13 +263,13 @@ ftp_modtime(FTP ftp, char *path)
 | 
				
			|||||||
static int
 | 
					static int
 | 
				
			||||||
ftp_quit(FTP ftp)
 | 
					ftp_quit(FTP ftp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/*
 | 
					    /*
 | 
				
			||||||
    int status;
 | 
					     * int status;
 | 
				
			||||||
    ftp_command(ftp, "QUIT", NULL, &status);
 | 
					     * ftp_command(ftp, "QUIT", NULL, &status);
 | 
				
			||||||
    ftp_close(ftp);
 | 
					     * ftp_close(ftp);
 | 
				
			||||||
    if (status != 221)
 | 
					     * if (status != 221)
 | 
				
			||||||
	return -1;
 | 
					     * return -1;
 | 
				
			||||||
*/
 | 
					     */
 | 
				
			||||||
    ftp_command(ftp, "QUIT", NULL, NULL);
 | 
					    ftp_command(ftp, "QUIT", NULL, NULL);
 | 
				
			||||||
    ftp_close(ftp);
 | 
					    ftp_close(ftp);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
@@ -287,7 +286,7 @@ static int ex_ftpdir_name_size_date(char *, char **, char **, char **);
 | 
				
			|||||||
#define	FTPDIR_FILE	3
 | 
					#define	FTPDIR_FILE	3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
closeFTPdata(FILE *f)
 | 
					closeFTPdata(FILE * f)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
    if (f) {
 | 
					    if (f) {
 | 
				
			||||||
@@ -337,8 +336,7 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (current_ftp.host) {
 | 
					    if (current_ftp.host) {
 | 
				
			||||||
	if (!strcmp(current_ftp.host, pu->host) &&
 | 
						if (!strcmp(current_ftp.host, pu->host) &&
 | 
				
			||||||
	    current_ftp.port == pu->port &&
 | 
						    current_ftp.port == pu->port && !strcmp(current_ftp.user, user)) {
 | 
				
			||||||
	    !strcmp(current_ftp.user, user)) {
 | 
					 | 
				
			||||||
	    ftp_command(¤t_ftp, "NOOP", NULL, &status);
 | 
						    ftp_command(¤t_ftp, "NOOP", NULL, &status);
 | 
				
			||||||
	    if (status != 200)
 | 
						    if (status != 200)
 | 
				
			||||||
		ftp_close(¤t_ftp);
 | 
							ftp_close(¤t_ftp);
 | 
				
			||||||
@@ -379,11 +377,11 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!current_ftp.host) {
 | 
					    if (!current_ftp.host) {
 | 
				
			||||||
        current_ftp.host = allocStr(pu->host, -1);
 | 
						current_ftp.host = allocStr(pu->host, -1);
 | 
				
			||||||
        current_ftp.port = pu->port;
 | 
						current_ftp.port = pu->port;
 | 
				
			||||||
        current_ftp.user = allocStr(user, -1);
 | 
						current_ftp.user = allocStr(user, -1);
 | 
				
			||||||
        current_ftp.pass = allocStr(pass, -1);
 | 
						current_ftp.pass = allocStr(pass, -1);
 | 
				
			||||||
        if (!ftp_login(¤t_ftp))
 | 
						if (!ftp_login(¤t_ftp))
 | 
				
			||||||
	    return NULL;
 | 
						    return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (add_auth_cookie_flag)
 | 
					    if (add_auth_cookie_flag)
 | 
				
			||||||
@@ -425,8 +423,7 @@ readFTPDir(ParsedURL *pu)
 | 
				
			|||||||
    if (current_ftp.data == NULL)
 | 
					    if (current_ftp.data == NULL)
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
    tmp = ftp_command(¤t_ftp, "SYST", NULL, &status);
 | 
					    tmp = ftp_command(¤t_ftp, "SYST", NULL, &status);
 | 
				
			||||||
    if (strstr(tmp->ptr, "UNIX") != NULL ||
 | 
					    if (strstr(tmp->ptr, "UNIX") != NULL || !strncmp(tmp->ptr + 4, "Windows_NT", 10))	/* :-) */
 | 
				
			||||||
	!strncmp(tmp->ptr + 4, "Windows_NT", 10))	/* :-) */
 | 
					 | 
				
			||||||
	sv_type = UNIXLIKE_SERVER;
 | 
						sv_type = UNIXLIKE_SERVER;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
	sv_type = SERVER_NONE;
 | 
						sv_type = SERVER_NONE;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user