As already mentioned, you need to use spaces instead of tabs. Here's sprintf from another built-in FTP server that should work:
sprintf(line, "%s 1 %-10s %-10s %10lu Jan 1 1980 %s\r\n",
permstr, username, username,
length,
filename);
permstrset to type string "-rw-rw-rw-".
As for date formats, these two should work, with the top part being used if the date is more than 6 months:
if (dfmt)
sprintf(buf, "%3.3s %2d %04d", month_name, month_num, year);
else
sprintf(buf, "%3.3s %2d %02d:%02d", month_name, month_num, hour, minute);
source
share