]> sjero.net Git - wget/blobdiff - src/ftp-ls.c
[svn] Concatenate strings using concat_strings.
[wget] / src / ftp-ls.c
index d2dde2ec5f5858e19a869617ca5e264010f8ba43..71d8e837138089fa928f5cf9ab41732802471364 100644 (file)
@@ -872,9 +872,10 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
 
       tmpu = url_escape (u->user);
       tmpp = u->passwd ? url_escape (u->passwd) : NULL;
-      upwd = (char *)xmalloc (strlen (tmpu)
-                            + (tmpp ? (1 + strlen (tmpp)) : 0) + 2);
-      sprintf (upwd, "%s%s%s@", tmpu, tmpp ? ":" : "", tmpp ? tmpp : "");
+      if (tmpp)
+       upwd = concat_strings (tmpu, ":", tmpp, "@", (char *) 0);
+      else
+       upwd = concat_strings (tmpu, "@", (char *) 0);
       xfree (tmpu);
       xfree_null (tmpp);
     }