]> sjero.net Git - wget/blobdiff - src/ftp.c
[svn] Update copyright notices.
[wget] / src / ftp.c
index 1e8ad517d20d737c5f7e060a31bf25725ec5d016..f48f1beb583ef329143b105f75cc57d188b303d1 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1,20 +1,21 @@
 /* File Transfer Protocol support.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001
+   Free Software Foundation, Inc.
 
-This file is part of Wget.
+This file is part of GNU Wget.
 
-This program is free software; you can redistribute it and/or modify
+GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
+GNU Wget is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
+along with Wget; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <config.h>
@@ -133,8 +134,6 @@ getftp (struct urlinfo *u, long *len, long restval, ccon *con)
   passwd = u->passwd;
   search_netrc (u->host, (const char **)&user, (const char **)&passwd, 1);
   user = user ? user : opt.ftp_acc;
-  if (!opt.ftp_pass)
-    opt.ftp_pass = ftp_getaddress ();
   passwd = passwd ? passwd : opt.ftp_pass;
   assert (user && passwd);
 
@@ -991,7 +990,7 @@ Error in server response, closing control connection.\n"));
 static uerr_t
 ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
 {
-  int count, orig_lp, no_truncate;
+  int count, orig_lp;
   long restval, len;
   char *tms, *tmrate, *locf;
   uerr_t err;
@@ -1022,13 +1021,6 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
 
   orig_lp = con->cmd & LEAVE_PENDING ? 1 : 0;
 
-  /* In `-c' is used, check whether the file we're writing to exists
-     before we've done anything.  If so, we'll refuse to truncate it
-     if the server doesn't support continued downloads.  */
-  no_truncate = 0;
-  if (opt.always_rest)
-    no_truncate = file_exists_p (locf);
-
   /* THE loop.  */
   do
     {
@@ -1055,8 +1047,7 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
          else
            con->cmd |= DO_CWD;
        }
-      if (no_truncate)
-       con->cmd |= NO_TRUNCATE;
+
       /* Assume no restarting.  */
       restval = 0L;
       if ((count > 1 || opt.always_rest)
@@ -1064,6 +1055,14 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
          && file_exists_p (locf))
        if (stat (locf, &st) == 0 && S_ISREG (st.st_mode))
          restval = st.st_size;
+
+      /* In `-c' is used, check whether the file we're writing to
+        exists and is of non-zero length.  If so, we'll refuse to
+        truncate it if the server doesn't support continued
+        downloads.  */
+      if (opt.always_rest && restval > 0)
+       con->cmd |= NO_TRUNCATE;
+
       /* Get the current time string.  */
       tms = time_str (NULL);
       /* Print fetch message, if opt.verbose.  */