bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [ PATCH ] LIST changes (ver. 4)


From: Andrea Urbani
Subject: Re: [Bug-wget] [ PATCH ] LIST changes (ver. 4)
Date: Tue, 22 Oct 2013 01:08:59 -0400

Hello Giuseppe,

you find indentation because I followed this style:

do
  {
    <code>
  } while <condition>

In your mail I don't understand exactly how the format should be.

Do you mean (version A):
do
  {
    <code>
  }
while <condition>

or do you mean (version B)
do
{
<code>
} while <condition>

Please, let me know with an example.

About your changes, if I apply all them you remove the LIST -a explanation (why 
it is used) and you remove the "< __LIST_A_EXPLANATION__ >" keyword used inside 
ChangeLog and ftp.h (For more information about the following entries, please, 
look at ftp.c, function getftp, text "__LIST_A_EXPLANATION__").

Well, let me know I will fix or you can fix it directly (I'm still using my 
--no-list-a option).

Bye
Andrea



  
----- Original Message -----
From: Giuseppe Scrivano
Sent: 10/21/13 05:24 PM
To: Andrea Urbani
Subject: Re: [ PATCH ] LIST changes (ver. 4)
 "Andrea Urbani" <address@hidden> writes:

> Hi Giuseppe,
>
> attached the LIST changes, version 4.
> Version 4 because:
> - now the code/notes are formatted according to your indications.
> Please, check if src/ChangeLog is ok or if it is better the previous
> one
> - ftp-basic.c: in ftp_syst I removed the copy of the original response
> because I have found the ftp_last_respline global variable
> - ftp-basic.c: in ftp_list I removed the no more used rs parameter
> - ftp.c: in getftp fixed "warning: 'previous_rd_size' may be used
> uninitialized" reported by Tim Ruehsen
>
> About "tests/ChangeLog" I moved the description of the new server
> behaviours inside the FTPServer.pm source code.
> Is it correct or have you a place where to insert developer oriented
> documentation?

there is no special place for this kind of documentation, so an inline
comment is the correct way to go.

Please amend this change on top of your patch. Also there are many
changes that touch the existing indentation without changing the code,
they make it more difficult to follow the diff, could you please fix
them? If it is too much effort, then let me know and I'll try to fix it
here.

Thanks,
Giuseppe


diff --git a/src/ftp-basic.c b/src/ftp-basic.c
index f5183de..97310f9 100644
--- a/src/ftp-basic.c
+++ b/src/ftp-basic.c
@@ -971,7 +971,6 @@ ftp_list (int csock, const char *file, bool avoid_list_a, 
bool avoid_list, bool
 *list_a_used = false;
 
 
-
 /* 2013-10-12 Andrea Urbani (matfanjol)
 For more information about LIST and "LIST -a" please look at ftp.c,
 function getftp, text "__LIST_A_EXPLANATION__".
@@ -1011,10 +1010,7 @@ ftp_list (int csock, const char *file, bool 
avoid_list_a, bool avoid_list, bool
 err = FTPOK;
 ok = true;
 /* Which list command was used? */
- if (i==0)
- *list_a_used = true;
- else
- *list_a_used = false;
+ *list_a_used = (i == 0);
 }
 else
 {
@@ -1023,7 +1019,7 @@ ftp_list (int csock, const char *file, bool avoid_list_a, 
bool avoid_list, bool
 xfree (respline);
 }
 ++i;
- if ((avoid_list)&&(i==1))
+ if ((avoid_list) && (i == 1))
 {
 /* I skip LIST */
 ++i;
diff --git a/src/ftp.c b/src/ftp.c
index e07eb7e..2f61e69 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -399,7 +399,7 @@ Error in server response, closing control connection.\n"));
 If I don't know that system, I will try, the
 first time of each session, "LIST -a" and
 "LIST". (see __LIST_A_EXPLANATION__ below) */
- switch ( con->rs )
+ switch (con->rs)
 {
 case ST_VMS:
 /* About ST_VMS there is an old note:
@@ -413,13 +413,13 @@ Error in server response, closing control 
connection.\n"));
 con->st |= AVOID_LIST_A;
 break;
 case ST_UNIX:
- if (con->rsu==UST_MULTINET)
+ if (con->rsu == UST_MULTINET)
 {
 DEBUGP (("\nUNIX MultiNet: I know it and I will use \"LIST\" as standard list 
command\n"));
 con->st |= LIST_AFTER_LIST_A_CHECK_DONE;
 con->st |= AVOID_LIST_A;
 }
- else if (con->rsu==UST_TYPE_L8)
+ else if (con->rsu == UST_TYPE_L8)
 {
 DEBUGP (("\nUNIX TYPE L8: I know it and I will use \"LIST -a\" as standard 
list command\n"));
 con->st |= LIST_AFTER_LIST_A_CHECK_DONE;
@@ -1432,33 +1432,8 @@ Error in server response, closing control 
connection.\n"));
 } /* con->cmd & DO_LIST && server_response */
 
 /* 2013-10-17 Andrea Urbani (matfanjol)
- < __LIST_A_EXPLANATION__ >
- To get the content of a ftp directory you have to use the LIST command.
- The syntax of the LIST command, according to the RFC 959, is:
- LIST [<SP> <pathname>] <CRLF>
- Looking inside the log of GIT repository I found the following:
- ----
- commit d34270c536e3af009031c4fffd3d9a8c8440dbe8
- Author: mtortonesi <address@hidden>
- Date: Thu Mar 9 05:50:03 2006 -0800
-
- [svn] Add support for download of hidden files from FTP.
- ----
- reported in the ChangeLog as
- ----
- 2006-03-09 Mauro Tortonesi <address@hidden>
-
- * ftp.c (ftp_list): Try `LIST -a' command first and revert to `LIST'
- in case of failure.
- ----
- where "LIST -a" is tried first and, in case of error, a standard LIST
- is used.
- "LIST -a" is sent to receive hidden files too, but this is true only on
- some systems (i.e. Unix).
- The systems that recognised "-a" according to the RFC 959 returns an
- empty list if no files or folders have the "-a" name (try, i.e.,
- ftp://ftp.info-zip.org).
- So, now wget, after the SYST command, looks if it knows that system.
+ After the SYST command, looks if it knows that system.
+
 If yes, wget will force the use of "LIST" or "LIST -a".
 If no, wget will try, only the first time of each session, before the
 "LIST -a" command and after the "LIST".
@@ -1468,11 +1443,6 @@ Error in server response, closing control 
connection.\n"));
 of an existing file called "-a"), "LIST" will be the standard list
 command for all the session.
 
- Well, there is an unhandled situation (that I will not fix, at least
- now): I'm on an unknown system that recognise "LIST -a" as "give me the
- -a files/folders", I have to download files from different folders and
- the starting ftp folder contains.... only one "-a" folder and no "." and
- ".." folders are returned ! :-O)
 In this case wget will try "LIST -a" then "LIST". The result will be
 the same so "LIST -a" will be taken, but, as soon as wget will go
 inside the "-a" folder, the problems will begin...
@@ -1482,7 +1452,7 @@ Error in server response, closing control 
connection.\n"));
 /* We still have to check "LIST" after the first "LIST -a" to see
 if with "LIST" we get more data than "LIST -a", that means
 "LIST -a" returned files/folders with "-a" name. */
- if (con->st&AVOID_LIST_A)
+ if (con->st & AVOID_LIST_A)
 {
 /* LIST was used in this cycle.
 Let's see the result. */
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9fff9a9..e1ef334 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,35 +1,28 @@
 2013-10-17 Andrea Urbani <address@hidden>
 
- * FTPServer.pm (GetBehavior): new routine
-
+ * FTPServer.pm (GetBehavior): new routine.
 * FTPServer.pm (get_list): new parameter to skip hidden files
-
- * Test-ftp-list-Multinet.px: Test LIST on a "UNIX MultiNet 
+ * Test-ftp-list-Multinet.px: Test LIST on a "UNIX MultiNet
 Unix Emulation" system that returns an empty content when
 "LIST -a" is requested (probably because no "-a" files
 exist)
-
- * Test-ftp-list-Unknown.px: Test LIST on a "Unknown ftp 
+ * Test-ftp-list-Unknown.px: Test LIST on a "Unknown ftp
 service" system that returns an empty content when
 "LIST -a" is requested (probably because no "-a" files
 exist)
-
- * Test-ftp-list-Unknown-a.px: Test LIST on a "Unknown ftp 
+ * Test-ftp-list-Unknown-a.px: Test LIST on a "Unknown ftp
 service" system that recognises "LIST -a" as "give me the
 -a file" and there is a "-a" file + other two files.
 "LIST -a" will return only "-a", "LIST" all the three files.
-
- * Test-ftp-list-Unknown-hidden.px: Test LIST on a "Unknown ftp 
+ * Test-ftp-list-Unknown-hidden.px: Test LIST on a "Unknown ftp
 service" system that recognises "LIST -a" as an "UNIX Type:
 L8" system (show me also the hidden files) and there is an
 hidden file.
-
- * Test-ftp-list-Unknown-list-a-fails.px: Test LIST on a 
+ * Test-ftp-list-Unknown-list-a-fails.px: Test LIST on a
 "Unknown ftp service" system that raises an error on
 "LIST -a" command.
-
 * Test-ftp-list-UNIX-hidden.px: Test LIST on a "UNIX Type:
- L8" system that recognises "LIST -a" as "show me also the 
+ L8" system that recognises "LIST -a" as "show me also the
 hidden files" and there is an hidden file.
 
 2013-10-10 Giuseppe Scrivano <address@hidden> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]