/* Skip if total... */
if (!strncasecmp (line, "total", 5))
{
- free (line);
+ xfree (line);
continue;
}
/* Get the first token (permissions). */
tok = strtok (line, " ");
if (!tok)
{
- free (line);
+ xfree (line);
continue;
}
DEBUGP (("Skipping.\n"));
FREE_MAYBE (cur.name);
FREE_MAYBE (cur.linkto);
- free (line);
+ xfree (line);
continue;
}
timestruct.tm_isdst = -1;
l->tstamp = mktime (×truct); /* store the time-stamp */
- free (line);
+ xfree (line);
}
fclose (fp);
l->tstamp = fp.mtime;
}
- free (line);
+ xfree (line);
}
fclose (fp);
\f
/* Stuff for creating FTP index. */
-/* The function returns the pointer to the malloc-ed quoted version of
- string s. It will recognize and quote numeric and special graphic
- entities, as per RFC1866:
-
- `&' -> `&'
- `<' -> `<'
- `>' -> `>'
- `"' -> `"'
-
- No other entities are recognized or replaced. */
-static char *
-html_quote_string (const char *s)
-{
- const char *b = s;
- char *p, *res;
- int i;
-
- /* Pass through the string, and count the new size. */
- for (i = 0; *s; s++, i++)
- {
- if (*s == '&')
- i += 4; /* `amp;' */
- else if (*s == '<' || *s == '>')
- i += 3; /* `lt;' and `gt;' */
- else if (*s == '\"')
- i += 5; /* `quot;' */
- }
- res = (char *)xmalloc (i + 1);
- s = b;
- for (p = res; *s; s++)
- {
- switch (*s)
- {
- case '&':
- *p++ = '&';
- *p++ = 'a';
- *p++ = 'm';
- *p++ = 'p';
- *p++ = ';';
- break;
- case '<': case '>':
- *p++ = '&';
- *p++ = (*s == '<' ? 'l' : 'g');
- *p++ = 't';
- *p++ = ';';
- break;
- case '\"':
- *p++ = '&';
- *p++ = 'q';
- *p++ = 'u';
- *p++ = 'o';
- *p++ = 't';
- *p++ = ';';
- break;
- default:
- *p++ = *s;
- }
- }
- *p = '\0';
- return res;
-}
-
/* The function creates an HTML index containing references to given
directories and files on the appropriate host. The references are
FTP. */
upwd = (char *)xmalloc (strlen (tmpu)
+ (tmpp ? (1 + strlen (tmpp)) : 0) + 2);
sprintf (upwd, "%s%s%s@", tmpu, tmpp ? ":" : "", tmpp ? tmpp : "");
- free (tmpu);
+ xfree (tmpu);
FREE_MAYBE (tmpp);
}
else
else if (f->type == FT_SYMLINK)
fprintf (fp, "-> %s", f->linkto ? f->linkto : "(nil)");
putc ('\n', fp);
- free (htclfile);
+ xfree (htclfile);
f = f->next;
}
fprintf (fp, "</pre>\n</body>\n</html>\n");
- free (upwd);
+ xfree (upwd);
if (!opt.dfp)
fclose (fp);
else