#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. */
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;
}
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 */
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
char *upwd;
char *htclfile; /* HTML-clean file name */
- if (!opt.dfp)
+ if (!output_stream)
{
fp = fopen (file, "wb");
if (!fp)
}
}
else
- fp = opt.dfp;
+ fp = output_stream;
if (u->user)
{
char *tmpu, *tmpp; /* temporary, clean user and passwd */
+ (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 ("");
{
/* #### Should we translate the months? Or, even better, use
ISO 8601 dates? */
- static char *months[] = {
+ static const char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
}
fprintf (fp, "</pre>\n</body>\n</html>\n");
xfree (upwd);
- if (!opt.dfp)
+ if (!output_stream)
fclose (fp);
else
fflush (fp);