]> sjero.net Git - wget/blobdiff - src/ftp.c
[svn] Gettext-ize previously missed messages.
[wget] / src / ftp.c
index 9a77fc108bbd76bcd6ed5229830f6ff033b5fedb..31ac37ae22a669b0da1802662f31ea5cf2f69280 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -236,8 +236,7 @@ print_length (wgint size, wgint start, int authoritative)
        logprintf (LOG_VERBOSE, _(", %s remaining"),
                   with_thousand_seps (size - start));
     }
-  if (!authoritative)
-    logputs (LOG_VERBOSE, _(" (unauthoritative)\n"));
+  logputs (LOG_VERBOSE, !authoritative ? _(" (unauthoritative)\n") : "\n");
 }
 
 /* Retrieves a file with denoted parameters through opening an FTP
@@ -1112,7 +1111,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
   if (opt.noclobber && file_exists_p (con->target))
     {
       logprintf (LOG_VERBOSE,
-                _("File `%s' already there, not retrieving.\n"), con->target);
+                _("File `%s' already there; not retrieving.\n"), con->target);
       /* If the file is there, we suppose it's retrieved OK.  */
       return RETROK;
     }
@@ -1159,13 +1158,17 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
        }
 
       /* Decide whether or not to restart.  */
-      restval = 0;
-      if (count > 1)
-       restval = len;          /* start where the previous run left off */
-      else if (opt.always_rest
-              && stat (locf, &st) == 0
-              && S_ISREG (st.st_mode))
+      if (opt.always_rest
+         && stat (locf, &st) == 0
+         && S_ISREG (st.st_mode))
+       /* When -c is used, continue from on-disk size.  (Can't use
+          hstat.len even if count>1 because we don't want a failed
+          first attempt to clobber existing data.)  */
        restval = st.st_size;
+      else if (count > 1)
+       restval = len;          /* start where the previous run left off */
+      else
+       restval = 0;
 
       /* Get the current time string.  */
       tms = time_str (NULL);
@@ -1850,15 +1853,25 @@ ftp_loop (struct url *u, int *dt, struct url *proxy)
     }
   else
     {
-      int wild = has_wildcards_p (u->file);
-      if ((opt.ftp_glob && wild) || opt.recursive || opt.timestamping)
+      int ispattern = 0;
+      if (opt.ftp_glob)
+       {
+         /* Treat the URL as a pattern if the file name part of the
+            URL path contains wildcards.  (Don't check for u->file
+            because it is unescaped and therefore doesn't leave users
+            the option to escape literal '*' as %2A.)  */
+         char *file_part = strrchr (u->path, '/');
+         if (!file_part)
+           file_part = u->path;
+         ispattern = has_wildcards_p (file_part);
+       }
+      if (ispattern || opt.recursive || opt.timestamping)
        {
          /* ftp_retrieve_glob is a catch-all function that gets called
             if we need globbing, time-stamping or recursion.  Its
             third argument is just what we really need.  */
          res = ftp_retrieve_glob (u, &con,
-                                  (opt.ftp_glob && wild)
-                                  ? GLOB_GLOBALL : GLOB_GETONE);
+                                  ispattern ? GLOB_GLOBALL : GLOB_GETONE);
        }
       else
        res = ftp_loop_internal (u, NULL, &con);