summaryrefslogtreecommitdiff
path: root/apps/netutils/ftpc/ftpc_rename.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-02 01:14:12 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-02 01:14:12 +0000
commit6f39c643ac7af0880f49f7673307053db11218e9 (patch)
tree7d6b9fe3151d71661e51125e108087d3c6f5906c /apps/netutils/ftpc/ftpc_rename.c
parentdf12f072cba62c2c458a7845b4e9b30c30a4af33 (diff)
downloadnuttx-6f39c643ac7af0880f49f7673307053db11218e9.tar.gz
nuttx-6f39c643ac7af0880f49f7673307053db11218e9.tar.bz2
nuttx-6f39c643ac7af0880f49f7673307053db11218e9.zip
Improved comments
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3658 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/ftpc/ftpc_rename.c')
-rw-r--r--apps/netutils/ftpc/ftpc_rename.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/netutils/ftpc/ftpc_rename.c b/apps/netutils/ftpc/ftpc_rename.c
index c1a80c289..d14bdf3f3 100644
--- a/apps/netutils/ftpc/ftpc_rename.c
+++ b/apps/netutils/ftpc/ftpc_rename.c
@@ -87,6 +87,19 @@ int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname
oldcopy = strdup(oldname);
ftpc_stripslash(oldcopy);
+
+ /* A RNFR request asks the server to begin renaming a file. A typical
+ * server accepts RNFR with:
+ *
+ * - "350 Requested file action pending further information" if the file
+ * exists
+ *
+ * Or rejects RNFR with:
+ *
+ * - "450 Requested file action not taken"
+ * - "550 Requested action not taken"
+ */
+
ret = ftpc_cmd(session, "RNFR %s", oldcopy);
if (ret != OK)
{
@@ -96,6 +109,23 @@ int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname
newcopy = strdup(newname);
ftpc_stripslash(newcopy);
+
+ /* A RNTO request asks the server to finish renaming a file. RNTO must
+ * come immediately after RNFR; otherwise the server may reject RNTO with:
+ *
+ * - "503 Bad sequence of commands"
+ *
+ * A typical server accepts RNTO with:
+ *
+ * - "250 Requested file action okay, completed" if the file was renamed
+ * successfully
+ *
+ * Or rejects RMD with:
+ *
+ * - "550 Requested action not taken"
+ * - "553 Requested action not taken"
+ */
+
ret = ftpc_cmd(session, "RNTO %s", newcopy);
free(oldcopy);