I agree that the printfs should not be there, but, at least in the example files, if you open a directory on the sd card as an ftp folder on a pc then the contents of the directory are streamed to stdio. I've looked at the FileSystemsUtils.cpp, and I don't think that's where the stdio output is coming from. Instead it looks like it's the calls like FTPD_ListFile() and FTPD_ListSubdirectories() from ftp_f.cpp (which are also in the example code). More specifically, on a remote pc, if you open a folder on the sd card that's visible via ftp, the FTPD_ListSubDirectories() function runs. When it runs, it makes the directory visible on the remote pc, but also streams a verbose listing of all the files to stdio. In small directories, this is not a problem, but for directories with hundreds of files it's a big problem
For example, here's a partial steam to stdio after refreshing the ftp directory on the remote pc:
Displaying directory info from function FTPD_ListSubDirectories()
Displaying time/date information from function FTPD_Listfile()
20120712_114521.g.log |12:00:00 |07/12/2012 | 29746 Bytes
20120712_120002.g.log |12:09:52 |07/12/2012 | 7478 Bytes
20120712_121005.g.log |12:50:20 |07/12/2012 | 50077 Bytes
20120712_125031.g.log |13:00:02 |07/12/2012 | 54799 Bytes
20120712_130002.g.log |13:10:52 |07/12/2012 | 61301 Bytes
20120712_131103.g.log |13:11:40 |07/12/2012 | 0 Bytes
20120712_131149.g.log |16:01:06 |07/12/2012 | 0 Bytes
20120712_160108.g.log |16:02:18 |07/12/2012 | 1560 Bytes
20120712_160227.g.log |16:07:52 |07/12/2012 | 6034 Bytes
20120712_160802.g.log |16:16:06 |07/12/2012 | 9308 Bytes
20120712_161619.g.log |16:24:12 |07/12/2012 | 9126 Bytes
20120712_162424.g.log |16:26:22 |07/12/2012 | 1753 Bytes
20120712_162631.g.log |16:51:14 |07/12/2012 | 41395 Bytes
And here's the code --- FTPD_ListSubDirectories() --- that seems to be called. However, I don't see the printfs. Any idea where they might be?
Code: Select all
////////////////////////////////////////////////////////////////////////////////
// FTPD_ListSubDirectories() - List directories.
//
int FTPD_ListSubDirectories( const char *current_directory, void *pSession,
FTPDCallBackReportFunct *pFunc, int socket )
{
F_FIND find;
long rc;
char s[256];
f_chdir( "/" );
if ( *current_directory )
{
if ( f_chdir( ( char * ) current_directory ) )
{
return( FTPD_FAIL );
}
}
rc = f_findfirst( "*.*", &find );
if ( !rc )
{
//Added comment and slight edit to line below to add function name.
iprintf("\r\nDisplaying directory info from function FTPD_ListSubDirectories()\r\n");
do
{
if ( find.attr & F_ATTR_DIR )
{
//Commenting the 2 lines below in an effort to eliminate chars to stdio
// stops the stdio output, but it also stops the ftp folder from being visible on a remote PC
getdirstring( &find, s );
pFunc( socket, s );
}
}
while ( !f_findnext( &find ) );
}
return( FTPD_OK );
}