diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-05 18:53:46 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-05 18:53:46 +0000 |
commit | 260b4435a85b9f4ae5d70830c1259af7afee256f (patch) | |
tree | 37aac92ff9a19ef32dc04b0d9d70c24a8233a278 /apps/examples/ftpc | |
parent | 672c0505c6c10c227c9315ed4f94746462392ea5 (diff) | |
download | px4-nuttx-260b4435a85b9f4ae5d70830c1259af7afee256f.tar.gz px4-nuttx-260b4435a85b9f4ae5d70830c1259af7afee256f.tar.bz2 px4-nuttx-260b4435a85b9f4ae5d70830c1259af7afee256f.zip |
More FTP fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3672 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/ftpc')
-rwxr-xr-x | apps/examples/ftpc/ftpc_cmds.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/examples/ftpc/ftpc_cmds.c b/apps/examples/ftpc/ftpc_cmds.c index 42091760b..f95f643cb 100755 --- a/apps/examples/ftpc/ftpc_cmds.c +++ b/apps/examples/ftpc/ftpc_cmds.c @@ -252,21 +252,35 @@ int cmd_rhelp(SESSION handle, int argc, char **argv) int cmd_rls(SESSION handle, int argc, char **argv) { FAR struct ftpc_dirlist_s *dirlist; + FAR char *dirname = NULL; int i; - dirlist = ftpc_listdir(handle, argv[1]); + /* Get the directory listing */ + + if (argc > 1) + { + dirname = argv[1]; + } + + dirlist = ftpc_listdir(handle, dirname); if (!dirlist) { return ERROR; } - printf("%s/\n", argv[1]); + /* Print the directory listing */ + + printf("%s/\n", dirname ? dirname : "."); for (i = 0; i < dirlist->nnames; i++) { printf(" %s\n", dirlist->name[i]); } FFLUSH(); + /* We are responsible for freeing the directory structure allocated by + * ftpc_listdir(). + */ + ftpc_dirfree(dirlist); return OK; } |