]> sjero.net Git - wget/blobdiff - src/ftp.c
[svn] Add the --user, --password, --ftp-user and --ftp-password options.
[wget] / src / ftp.c
index a9ef47cef5f3ac0c090b214814d44e988df49e00..3542d18ed7ee95a7b54fd23c680392b1bbd109d4 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -271,9 +271,10 @@ getftp (struct url *u, wgint *len, wgint restval, ccon *con)
   user = u->user;
   passwd = u->passwd;
   search_netrc (u->host, (const char **)&user, (const char **)&passwd, 1);
-  user = user ? user : opt.ftp_acc;
-  passwd = passwd ? passwd : opt.ftp_pass;
-  assert (user && passwd);
+  user = user ? user : (opt.ftp_user ? opt.ftp_user : opt.user);
+  if (!user) user = "anonymous";
+  passwd = passwd ? passwd : (opt.ftp_passwd ? opt.ftp_passwd : opt.passwd);
+  if (!passwd) passwd = "-wget@";
 
   dtsock = -1;
   local_sock = -1;
@@ -982,7 +983,7 @@ Error in server response, closing control connection.\n"));
        fp = fopen (con->target, "wb");
       else
        {
-         fp = fopen_excl (con->target, 0);
+         fp = fopen_excl (con->target, 1);
          if (!fp && errno == EEXIST)
            {
              /* We cannot just invent a new name and use it (which is
@@ -1846,7 +1847,7 @@ ftp_loop (struct url *u, int *dt, struct url *proxy)
 
   *dt = 0;
 
-  memset (&con, 0, sizeof (con));
+  xzero (con);
 
   con.csock = -1;
   con.st = ON_YOUR_OWN;