]> sjero.net Git - wget/blobdiff - src/ftp-ls.c
[svn] * retr.c (fd_read_body): Report the amount of data *written* as
[wget] / src / ftp-ls.c
index 919b4a602d19f838ca66c501103b578d9f84484a..5c8532294ae348998ab975734391b0167e5b59cd 100644 (file)
@@ -48,6 +48,8 @@ so, delete this exception statement from your version.  */
 #include "ftp.h"
 #include "url.h"
 
+extern FILE *output_stream;
+
 /* Converts symbolic permissions to number-style ones, e.g. string
    rwxr-xr-x to 755.  For now, it knows nothing of
    setuid/setgid/sticky.  ACLs are ignored.  */
@@ -358,8 +360,8 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
       if (error || ignore)
        {
          DEBUGP (("Skipping.\n"));
-         FREE_MAYBE (cur.name);
-         FREE_MAYBE (cur.linkto);
+         xfree_null (cur.name);
+         xfree_null (cur.linkto);
          xfree (line);
          continue;
        }
@@ -783,7 +785,7 @@ ftp_parse_ls (const char *file, const enum stype system_type)
   switch (system_type)
     {
     case ST_UNIX:
-      return ftp_parse_unix_ls (file, FALSE);
+      return ftp_parse_unix_ls (file, 0);
     case ST_WINNT:
       {
        /* Detect whether the listing is simulating the UNIX format */
@@ -802,16 +804,16 @@ ftp_parse_ls (const char *file, const enum stype system_type)
        if (c >= '0' && c <='9')
          return ftp_parse_winnt_ls (file);
         else
-          return ftp_parse_unix_ls (file, TRUE);
+          return ftp_parse_unix_ls (file, 1);
       }
     case ST_VMS:
       return ftp_parse_vms_ls (file);
     case ST_MACOS:
-      return ftp_parse_unix_ls (file, TRUE);
+      return ftp_parse_unix_ls (file, 1);
     default:
       logprintf (LOG_NOTQUIET, _("\
 Unsupported listing type, trying Unix listing parser.\n"));
-      return ftp_parse_unix_ls (file, FALSE);
+      return ftp_parse_unix_ls (file, 0);
     }
 }
 \f
@@ -827,7 +829,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
   char *upwd;
   char *htclfile;              /* HTML-clean file name */
 
-  if (!opt.dfp)
+  if (!output_stream)
     {
       fp = fopen (file, "wb");
       if (!fp)
@@ -837,7 +839,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
        }
     }
   else
-    fp = opt.dfp;
+    fp = output_stream;
   if (u->user)
     {
       char *tmpu, *tmpp;        /* temporary, clean user and passwd */
@@ -848,7 +850,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
                             + (tmpp ? (1 + strlen (tmpp)) : 0) + 2);
       sprintf (upwd, "%s%s%s@", tmpu, tmpp ? ":" : "", tmpp ? tmpp : "");
       xfree (tmpu);
-      FREE_MAYBE (tmpp);
+      xfree_null (tmpp);
     }
   else
     upwd = xstrdup ("");
@@ -919,7 +921,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
     }
   fprintf (fp, "</pre>\n</body>\n</html>\n");
   xfree (upwd);
-  if (!opt.dfp)
+  if (!output_stream)
     fclose (fp);
   else
     fflush (fp);